@scalar/cli 1.9.9 → 2.0.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.
Files changed (4) hide show
  1. package/README.md +26 -8
  2. package/docs.html +233 -126
  3. package/index.js +765 -437
  4. package/package.json +14 -14
package/index.js CHANGED
@@ -13,7 +13,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
15
  var __commonJS = (cb, mod) => function __require2() {
16
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ try {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ } catch (e) {
19
+ throw mod = 0, e;
20
+ }
17
21
  };
18
22
  var __export = (target, all) => {
19
23
  for (var name2 in all)
@@ -69163,18 +69167,18 @@ Visit https://nodejs.org to download the latest version.`
69163
69167
  }
69164
69168
 
69165
69169
  // src/program.ts
69166
- import { Command as Command50 } from "commander";
69170
+ import { Command as Command51 } from "commander";
69167
69171
 
69168
69172
  // package.json
69169
69173
  var name = "@scalar/cli";
69170
- var version = "1.9.9";
69174
+ var version = "2.0.1";
69171
69175
  var bin = {
69172
69176
  scalar: "./dist/index.js",
69173
69177
  "scalar-cli": "./dist/index.js"
69174
69178
  };
69175
69179
 
69176
69180
  // src/domains/schema/index.ts
69177
- import { Command as Command6 } from "commander";
69181
+ import { Command as Command7 } from "commander";
69178
69182
 
69179
69183
  // src/domains/schema/delete.ts
69180
69184
  import { select } from "@clack/prompts";
@@ -86554,42 +86558,6 @@ var identityProviderRecordSchema = entitySchema.extend({
86554
86558
  consumerOnly: external_exports.boolean()
86555
86559
  }).meta({ id: "identity-provider-record" });
86556
86560
 
86557
- // ../../packages/entities/dist/auth/oauth-state.js
86558
- var googleProfileSchema = external_exports.object({
86559
- email: emailSchema,
86560
- name: external_exports.string().min(1),
86561
- picture: external_exports.string().optional(),
86562
- email_verified: external_exports.boolean()
86563
- }).meta({ id: "google-profile" });
86564
- var githubProfileSchema = external_exports.object({
86565
- login: external_exports.string(),
86566
- name: external_exports.string().optional().nullable().default(null),
86567
- email: emailSchema.optional().nullable().default(null),
86568
- avatar_url: external_exports.string().optional().nullable().default(null)
86569
- }).meta({ id: "github-profile" });
86570
- var oauthStateSchema = external_exports.object({
86571
- uid: external_exports.string(),
86572
- redirect: external_exports.string(),
86573
- signupDataUid: external_exports.string().optional(),
86574
- teamInvite: external_exports.string().optional(),
86575
- flow: external_exports.enum(OnboardingFlow).optional()
86576
- }).meta({ id: "oauth-state" });
86577
-
86578
- // ../../packages/entities/dist/auth/personal-token.js
86579
- var personalTokenRecordSchema = external_exports.object({
86580
- uid: external_exports.string(),
86581
- /** User friendly name */
86582
- name: external_exports.string().min(3).max(50),
86583
- /** User friendly description */
86584
- description: external_exports.string().max(200).optional().default(""),
86585
- /** Associate a personal token with a team */
86586
- teamUid: external_exports.string(),
86587
- /** Token expiry time in unix timestamp */
86588
- expiresAt: external_exports.number().int(),
86589
- /** Tracks if a token is blacklisted. Should not be used if token is revoked */
86590
- revoked: external_exports.boolean()
86591
- }).meta({ id: "personal-token-record" });
86592
-
86593
86561
  // ../../packages/entities/dist/registry/schema.js
86594
86562
  var RegistryAsset;
86595
86563
  (function(RegistryAsset3) {
@@ -86628,6 +86596,66 @@ var baseRegistrySchema = entitySchema.extend({
86628
86596
  verifiedContent: external_exports.boolean().optional()
86629
86597
  }).meta({ id: "base-registry" });
86630
86598
 
86599
+ // ../../packages/entities/dist/auth/oauth-state.js
86600
+ var googleProfileSchema = external_exports.object({
86601
+ email: emailSchema,
86602
+ name: external_exports.string().min(1),
86603
+ picture: external_exports.string().optional(),
86604
+ email_verified: external_exports.boolean()
86605
+ }).meta({ id: "google-profile" });
86606
+ var githubProfileSchema = external_exports.object({
86607
+ login: external_exports.string(),
86608
+ name: external_exports.string().optional().nullable().default(null),
86609
+ email: emailSchema.optional().nullable().default(null),
86610
+ avatar_url: external_exports.string().optional().nullable().default(null)
86611
+ }).meta({ id: "github-profile" });
86612
+ var oauthStateSchema = external_exports.object({
86613
+ uid: external_exports.string(),
86614
+ redirect: external_exports.string(),
86615
+ signupDataUid: external_exports.string().optional(),
86616
+ teamInvite: external_exports.string().optional(),
86617
+ flow: external_exports.enum(OnboardingFlow).optional()
86618
+ }).meta({ id: "oauth-state" });
86619
+ var microsoftProfileSchema = external_exports.object({
86620
+ email: emailSchema,
86621
+ name: external_exports.string().optional(),
86622
+ /** Entra tenant id; the consumer tenant means a personal account */
86623
+ tid: external_exports.string(),
86624
+ /**
86625
+ * "Email domain owner verified" optional claim. Entra tenant admins can
86626
+ * put arbitrary emails on their users (nOAuth), so without this claim a
86627
+ * work-account email cannot be trusted for allowlist checks.
86628
+ */
86629
+ xms_edov: external_exports.union([external_exports.boolean(), external_exports.string()]).optional()
86630
+ }).meta({ id: "microsoft-profile" });
86631
+ var hostingOauthResourceSchema = external_exports.enum([...RegistryResourceTypes, "sync-project", "project", "publish"]).meta({ id: "hosting-oauth-resource" });
86632
+ var hostingOauthStateSchema = external_exports.object({
86633
+ uid: nanoidSchema,
86634
+ resource: external_exports.object({
86635
+ uid: nanoidSchema,
86636
+ type: hostingOauthResourceSchema
86637
+ }),
86638
+ teamUid: nanoidSchema,
86639
+ redirect: external_exports.string().optional(),
86640
+ /** Stamped on the stored record so abandoned states can be vacuumed */
86641
+ createdAt: external_exports.number().optional()
86642
+ }).meta({ id: "hosting-oauth-state" });
86643
+
86644
+ // ../../packages/entities/dist/auth/personal-token.js
86645
+ var personalTokenRecordSchema = external_exports.object({
86646
+ uid: external_exports.string(),
86647
+ /** User friendly name */
86648
+ name: external_exports.string().min(3).max(50),
86649
+ /** User friendly description */
86650
+ description: external_exports.string().max(200).optional().default(""),
86651
+ /** Associate a personal token with a team */
86652
+ teamUid: external_exports.string(),
86653
+ /** Token expiry time in unix timestamp */
86654
+ expiresAt: external_exports.number().int(),
86655
+ /** Tracks if a token is blacklisted. Should not be used if token is revoked */
86656
+ revoked: external_exports.boolean()
86657
+ }).meta({ id: "personal-token-record" });
86658
+
86631
86659
  // ../../packages/entities/dist/auth/saml-state.js
86632
86660
  var samlStateSchema = external_exports.object({
86633
86661
  uid: nanoidSchema,
@@ -86689,7 +86717,11 @@ var typesenseConfigSchema = external_exports.object({
86689
86717
  var subpathSchema = external_exports.object({
86690
86718
  subpath: external_exports.string(),
86691
86719
  projectUid: external_exports.string(),
86692
- typesenseConfig: typesenseConfigSchema
86720
+ /**
86721
+ * Present only for sites still served by Typesense. Builds on the jsonl
86722
+ * search backend omit it; federated search fetches `${subpath}/search-entries.jsonl`.
86723
+ */
86724
+ typesenseConfig: typesenseConfigSchema.optional().nullable()
86693
86725
  }).meta({ id: "subpath" });
86694
86726
  var siteDeploySchema = entitySchema.extend({
86695
86727
  domain: external_exports.string(),
@@ -86697,6 +86729,9 @@ var siteDeploySchema = entitySchema.extend({
86697
86729
  projectUid: nanoidSchema,
86698
86730
  subpaths: subpathSchema.array().default([])
86699
86731
  }).meta({ id: "site-deploy" });
86732
+ var searchConfigResponseSchema = external_exports.object({
86733
+ subpaths: subpathSchema.array()
86734
+ }).meta({ id: "search-config-response" });
86700
86735
 
86701
86736
  // ../../packages/entities/dist/login-portals/customization.js
86702
86737
  var loginPortalEmailSchema = external_exports.object({
@@ -86860,6 +86895,8 @@ var agentTokenPayloadSchema = zod_default.object({
86860
86895
  uid: zod_default.string(),
86861
86896
  teamUid: nanoidSchema.optional(),
86862
86897
  documentUids: nanoidSchema.array().optional(),
86898
+ /** Ephemeral key minted for a registry API reference preview page. */
86899
+ registryPreview: zod_default.boolean().optional(),
86863
86900
  exp: zod_default.number().int()
86864
86901
  }).meta({ id: "agent-token-payload" });
86865
86902
 
@@ -86975,14 +87012,24 @@ var mcpInstallationSchema = external_exports.object({
86975
87012
  var monthlyUsageSchema = zod_default.object({
86976
87013
  identifier: zod_default.string(),
86977
87014
  month: zod_default.date(),
86978
- type: zod_default.enum(["public-user", "web-team-user", "agent-key", "docs-project"]),
87015
+ type: zod_default.enum([
87016
+ "public-user",
87017
+ "web-team-user",
87018
+ "agent-key",
87019
+ "docs-project",
87020
+ "mcp-installation",
87021
+ "registry-preview"
87022
+ ]),
86979
87023
  teamUid: zod_default.string().nullable(),
86980
87024
  inputTokens: zod_default.number(),
86981
87025
  outputTokens: zod_default.number(),
86982
- messages: zod_default.number()
87026
+ messages: zod_default.number(),
87027
+ toolCalls: zod_default.number(),
87028
+ // bigint column: the pg driver returns int8 as a string, so coerce on read.
87029
+ microCredits: zod_default.coerce.number()
86983
87030
  }).meta({ id: "monthly-usage" });
86984
87031
 
86985
- // ../../node_modules/.pnpm/@scalar+helpers@0.8.2/node_modules/@scalar/helpers/dist/http/http-methods.js
87032
+ // ../../node_modules/.pnpm/@scalar+helpers@0.9.0/node_modules/@scalar/helpers/dist/http/http-methods.js
86986
87033
  var HTTP_METHODS = ["delete", "get", "head", "options", "patch", "post", "put", "trace"];
86987
87034
  var httpMethods = Object.freeze(new Set(HTTP_METHODS));
86988
87035
 
@@ -87724,11 +87771,22 @@ var docsProjectRepositorySchema = external_exports.discriminatedUnion("provider"
87724
87771
  githubRepositorySchema,
87725
87772
  bitbucketRepositorySchema
87726
87773
  ]);
87774
+ var remoteActivitySchema = external_exports.object({
87775
+ at: timestampSchema,
87776
+ branch: external_exports.string().nullable(),
87777
+ sha: external_exports.string().nullable(),
87778
+ actorName: external_exports.string().nullable()
87779
+ }).meta({ id: "docs-project-remote-activity" });
87727
87780
  var docsProjectSchema = sharedProjectSchema.extend({
87728
87781
  slug: slugSchema,
87729
87782
  publishStatus: external_exports.string().default(""),
87730
87783
  publishMessage: external_exports.string().default(""),
87731
- repository: docsProjectRepositorySchema
87784
+ repository: docsProjectRepositorySchema,
87785
+ /**
87786
+ * `.catch(undefined)` so a malformed bump degrades to "no signal" instead
87787
+ * of failing the schema parse inside every subscribed dashboard.
87788
+ */
87789
+ remoteActivity: remoteActivitySchema.optional().catch(void 0)
87732
87790
  }).meta({ id: "docs-project" });
87733
87791
  function isGithubBackedDocsProject(project) {
87734
87792
  return project.repository.provider === "github";
@@ -87758,6 +87816,7 @@ var publishRecordSchema = entitySchema.extend({
87758
87816
  commitSha: external_exports.string().nullable().default(null),
87759
87817
  version: external_exports.enum(ConfigVersion).default(ConfigVersion.V1),
87760
87818
  isWysiwyg: external_exports.boolean().default(false),
87819
+ unifiedDocs: external_exports.boolean().default(false),
87761
87820
  subpath: external_exports.string().nullable().default(null),
87762
87821
  configPath: external_exports.string().optional().default("scalar.config.json"),
87763
87822
  registryApis: external_exports.object({
@@ -87785,13 +87844,13 @@ var signupDataSchema = external_exports.object({
87785
87844
  yjsReferences: external_exports.record(external_exports.string(), external_exports.string())
87786
87845
  }).meta({ id: "signup-data" });
87787
87846
 
87847
+ // ../../packages/entities/dist/sdk/helpers.js
87848
+ import semver3 from "semver";
87849
+
87788
87850
  // ../../packages/entities/dist/sdk/scalar-config.js
87789
87851
  var import_yaml = __toESM(require_dist(), 1);
87790
87852
  import semver4 from "semver";
87791
87853
 
87792
- // ../../packages/entities/dist/sdk/helpers.js
87793
- import semver3 from "semver";
87794
-
87795
87854
  // ../../packages/entities/dist/sdk/schema.js
87796
87855
  var SdkLanguage;
87797
87856
  (function(SdkLanguage2) {
@@ -87832,7 +87891,7 @@ var SdkLanguageExperimental = {
87832
87891
  [SdkLanguage.Java]: true,
87833
87892
  [SdkLanguage.Ruby]: true,
87834
87893
  [SdkLanguage.Php]: true,
87835
- [SdkLanguage.Go]: true,
87894
+ [SdkLanguage.Go]: false,
87836
87895
  [SdkLanguage.Rust]: true,
87837
87896
  [SdkLanguage.Kotlin]: true,
87838
87897
  [SdkLanguage.Swift]: true,
@@ -87855,10 +87914,46 @@ var sdkTargetDestinationSchema = external_exports.object({
87855
87914
  prComments: external_exports.boolean().default(false),
87856
87915
  expired: external_exports.boolean().default(false)
87857
87916
  }).meta({ id: "sdk-target-destination" });
87917
+ var sdkSampleRepoSchema = external_exports.object({
87918
+ provider: external_exports.literal("github").default("github"),
87919
+ /**
87920
+ * 'pending' from SDK creation until the repo is provisioned in scalar-sdks;
87921
+ * 'ready' once it exists (name/installationId are filled in then). The
87922
+ * pending state lets the dashboard show the section immediately. Defaults to
87923
+ * 'ready' so pre-existing bindings (which always have a repo) read correctly.
87924
+ */
87925
+ status: external_exports.enum(["pending", "ready"]).default("ready"),
87926
+ /** "scalar-sdks/<repo>" (present once ready). */
87927
+ name: external_exports.string().optional(),
87928
+ /** scalar-sdks installation that grants push access for the bot (once ready). */
87929
+ installationId: external_exports.number().int().optional(),
87930
+ baseBranch: external_exports.string().min(1).default("main"),
87931
+ /** GitHub invitation accept URL, surfaced in the dashboard. Null once the
87932
+ * invite has been re-issued for an already-accepted user (no link to show). */
87933
+ invitationUrl: external_exports.string().nullable().optional(),
87934
+ /** Last build whose artifact was pushed to the playground. */
87935
+ lastSyncedBuild: nanoidSchema.optional()
87936
+ }).meta({ id: "sdk-sample-repo" });
87858
87937
  var sdkTargetSchema = external_exports.object({
87859
87938
  language: external_exports.enum(SdkLanguage),
87860
87939
  slug: slugSchema,
87861
- destination: sdkTargetDestinationSchema.nullable().default(null)
87940
+ destination: sdkTargetDestinationSchema.nullable().default(null),
87941
+ /**
87942
+ * Preview repo in scalar-sdks for this target. Independent of `destination`:
87943
+ * it always mirrors the latest build so users can play with the output before
87944
+ * setting up a production repo.
87945
+ */
87946
+ sample: sdkSampleRepoSchema.nullable().default(null),
87947
+ /**
87948
+ * Build whose generated artifact is the current replay merge base (the last
87949
+ * generated output reconciled into the repo). Lives on the persistent target
87950
+ * rather than a version because the merge base is a property of the
87951
+ * destination. Advanced only on a clean reconcile, so a stuck conflict keeps
87952
+ * replaying against the same base. Absent means first-run overlay.
87953
+ */
87954
+ lastSyncedBuild: nanoidSchema.optional(),
87955
+ /** Rolling branch this target's replay pushes to (defaults per slug). */
87956
+ integrationBranch: external_exports.string().optional()
87862
87957
  }).meta({ id: "sdk-target" });
87863
87958
  var sdkVersionTargetStateSchema = external_exports.object({
87864
87959
  activeSync: external_exports.object({
@@ -87866,6 +87961,22 @@ var sdkVersionTargetStateSchema = external_exports.object({
87866
87961
  pullRequest: external_exports.number(),
87867
87962
  commitHash: external_exports.string()
87868
87963
  }).optional(),
87964
+ /**
87965
+ * Set when the last replay collided: the build awaiting conflict resolution
87966
+ * (resolved through the dashboard resolver, which produces clean code).
87967
+ * Cleared on a clean reconcile.
87968
+ */
87969
+ conflict: external_exports.object({
87970
+ build: nanoidSchema,
87971
+ /**
87972
+ * The conflict PR opened on scratch branches for native (GitHub/editor)
87973
+ * resolution. The merge webhook keys off this to find the target.
87974
+ * Absent for conflicts resolved only through the dashboard resolver.
87975
+ */
87976
+ pullRequest: external_exports.number().optional(),
87977
+ /** Scratch branch holding the resolved tree once that PR is merged. */
87978
+ resolvedBranch: external_exports.string().optional()
87979
+ }).optional(),
87869
87980
  activeBuild: nanoidSchema.optional()
87870
87981
  }).meta({ id: "sdk-version-target-state" });
87871
87982
  var sdkVersionStatusSchema = external_exports.enum(["draft", "published"]);
@@ -87914,7 +88025,7 @@ var sdkSchema = baseRegistrySchema.extend({
87914
88025
  config: external_exports.string().optional()
87915
88026
  }).meta({ id: "sdk" });
87916
88027
  var sdkBuildStatusSchema = external_exports.enum(["pending", "error", "generated"]).meta({ id: "sdk-build-status" });
87917
- var sdkGitStatusSchema = external_exports.enum(["pending", "error", "synced"]).meta({ id: "sdk-git-status" });
88028
+ var sdkGitStatusSchema = external_exports.enum(["pending", "error", "synced", "conflicts"]).meta({ id: "sdk-git-status" });
87918
88029
  var sdkBuildApiSchema = external_exports.object({
87919
88030
  uid: nanoidSchema,
87920
88031
  namespace: namespaceSchema,
@@ -87939,12 +88050,13 @@ var sdkBuildTargetSchema = external_exports.object({
87939
88050
  slug: slugSchema,
87940
88051
  /** Build status */
87941
88052
  buildStatus: sdkBuildStatusSchema,
87942
- /** Additional build message */
87943
- buildMessage: external_exports.string().optional(),
88053
+ /** Additional build message. Nullable: mongobase round-trips an unset
88054
+ * optional as null, and a strict string parse would drop the doc on read. */
88055
+ buildMessage: external_exports.string().nullable().optional(),
87944
88056
  /** Git sync status */
87945
88057
  gitStatus: sdkGitStatusSchema.optional(),
87946
- /** Additional git message */
87947
- gitMessage: external_exports.string().optional(),
88058
+ /** Additional git message. Nullable for the same round-trip reason as buildMessage. */
88059
+ gitMessage: external_exports.string().nullable().optional(),
87948
88060
  /** Linked git repository name */
87949
88061
  repository: external_exports.string().nullable().optional(),
87950
88062
  /** Git sync commit and PR */
@@ -88013,6 +88125,20 @@ var sdkLanguageToScalarTarget = {
88013
88125
  [SdkLanguage.Dart]: "dart",
88014
88126
  [SdkLanguage.Cli]: "cli"
88015
88127
  };
88128
+ var sdkLanguageToRegistry = {
88129
+ [SdkLanguage.Typescript]: "npm",
88130
+ [SdkLanguage.Python]: "pypi",
88131
+ [SdkLanguage.Go]: "go",
88132
+ [SdkLanguage.Rust]: "cargo",
88133
+ [SdkLanguage.Java]: "maven",
88134
+ [SdkLanguage.Kotlin]: "maven",
88135
+ [SdkLanguage.Ruby]: "rubygems",
88136
+ [SdkLanguage.Php]: "packagist",
88137
+ [SdkLanguage.CSharp]: "nuget",
88138
+ [SdkLanguage.Swift]: "swiftpm",
88139
+ [SdkLanguage.Dart]: "pub",
88140
+ [SdkLanguage.Cli]: "homebrew"
88141
+ };
88016
88142
  var scalarTargetDestinationsSchema = external_exports.object({
88017
88143
  production: external_exports.object({
88018
88144
  repo: external_exports.string(),
@@ -88022,7 +88148,10 @@ var scalarTargetDestinationsSchema = external_exports.object({
88022
88148
  var scalarTargetEntrySchema = external_exports.looseObject({
88023
88149
  packageName: external_exports.string().optional(),
88024
88150
  version: external_exports.string().optional(),
88025
- destinations: scalarTargetDestinationsSchema.optional()
88151
+ destinations: scalarTargetDestinationsSchema.optional(),
88152
+ // Per-registry publish config (e.g. `{ npm: { authMethod: 'oidc' } }`). Present only when the
88153
+ // target opts into publish-on-merge; the generator reads it to emit publish workflow steps.
88154
+ publish: external_exports.record(external_exports.string(), external_exports.any()).optional()
88026
88155
  }).meta({ id: "scalar-target-entry" });
88027
88156
  var scalarClientSettingsSchema = external_exports.looseObject({
88028
88157
  opts: external_exports.record(external_exports.string(), external_exports.any()).optional(),
@@ -88053,14 +88182,28 @@ var ExternalAccessMethod;
88053
88182
  (function(ExternalAccessMethod2) {
88054
88183
  ExternalAccessMethod2["Email"] = "email";
88055
88184
  ExternalAccessMethod2["SSO"] = "sso";
88185
+ ExternalAccessMethod2["Google"] = "google";
88186
+ ExternalAccessMethod2["Microsoft"] = "microsoft";
88056
88187
  })(ExternalAccessMethod || (ExternalAccessMethod = {}));
88188
+ var emailInheritingExternalAccessMethods = [
88189
+ ExternalAccessMethod.Google
88190
+ ];
88191
+ var externalAccessMethodByProvider = {
88192
+ google: ExternalAccessMethod.Google,
88193
+ microsoft: ExternalAccessMethod.Microsoft
88194
+ };
88057
88195
  var externalAccessMethodsSchema = external_exports.object({
88058
88196
  [ExternalAccessMethod.Email]: external_exports.boolean().default(true),
88059
- [ExternalAccessMethod.SSO]: external_exports.boolean().default(false)
88197
+ [ExternalAccessMethod.SSO]: external_exports.boolean().default(false),
88198
+ /** No default: an unset social method inherits the email setting */
88199
+ [ExternalAccessMethod.Google]: external_exports.boolean().optional(),
88200
+ [ExternalAccessMethod.Microsoft]: external_exports.boolean().optional()
88060
88201
  }).meta({ id: "external-access-methods" });
88061
88202
  var externalAccessMethodLabels = {
88062
88203
  [ExternalAccessMethod.Email]: "Email Magic Link",
88063
- [ExternalAccessMethod.SSO]: "Single Sign-On"
88204
+ [ExternalAccessMethod.SSO]: "Single Sign-On",
88205
+ [ExternalAccessMethod.Google]: "Google OAuth",
88206
+ [ExternalAccessMethod.Microsoft]: "Microsoft OAuth"
88064
88207
  };
88065
88208
  var externalAccessSchema = external_exports.object({
88066
88209
  /** Available authentication methods for external access */
@@ -88084,6 +88227,7 @@ var FeatureFlag;
88084
88227
  FeatureFlag2["UnifiedDocs"] = "unifiedDocs";
88085
88228
  FeatureFlag2["DocsAnalytics"] = "docsAnalytics";
88086
88229
  FeatureFlag2["McpAnalytics"] = "mcpAnalytics";
88230
+ FeatureFlag2["MicrosoftLogin"] = "microsoftLogin";
88087
88231
  })(FeatureFlag || (FeatureFlag = {}));
88088
88232
  var featureSchema = external_exports.boolean().optional().meta({ id: "feature" });
88089
88233
  var featureFlagSchema = external_exports.object({
@@ -88100,7 +88244,8 @@ var featureFlagSchema = external_exports.object({
88100
88244
  [FeatureFlag.DisableApiSSR]: featureSchema,
88101
88245
  [FeatureFlag.UnifiedDocs]: featureSchema,
88102
88246
  [FeatureFlag.DocsAnalytics]: featureSchema,
88103
- [FeatureFlag.McpAnalytics]: featureSchema
88247
+ [FeatureFlag.McpAnalytics]: featureSchema,
88248
+ [FeatureFlag.MicrosoftLogin]: featureSchema
88104
88249
  }).meta({ id: "feature-flag" });
88105
88250
 
88106
88251
  // ../../packages/entities/dist/team/schema.js
@@ -88157,7 +88302,9 @@ var billingInfoSchema = external_exports.preprocess((arg) => {
88157
88302
  billingId: nanoidSchema.optional(),
88158
88303
  email: emailSchema,
88159
88304
  plan: billingPlanSchema,
88160
- expires: external_exports.number().optional()
88305
+ expires: external_exports.number().optional(),
88306
+ sdkTrialReminderSentAt: external_exports.number().optional(),
88307
+ includedCreditsOverride: external_exports.number().optional()
88161
88308
  })).meta({ id: "billing-info" });
88162
88309
  var invoiceStatusSchema = external_exports.enum(["open", "paid", "draft", "void", "uncollectible"]).meta({ id: "invoice-status" });
88163
88310
  var billingInvoiceSchema = external_exports.object({
@@ -88384,13 +88531,30 @@ var exchangeTokenSchema = external_exports.object({
88384
88531
  expiry: external_exports.number(),
88385
88532
  teamUid: external_exports.string()
88386
88533
  }).meta({ id: "exchange-token" });
88534
+ var socialOauthProviderSchema = external_exports.enum(["google", "microsoft"]).meta({ id: "social-oauth-provider" });
88387
88535
  var hostingExchangeTokenSchema = external_exports.object({
88388
88536
  email: emailSchema,
88389
88537
  aud: external_exports.url(),
88390
- idp: nanoidSchema,
88538
+ /** Identity provider uid, present when minted from a SAML assertion */
88539
+ idp: nanoidSchema.optional(),
88540
+ /**
88541
+ * The social provider that authenticated the email, present only for
88542
+ * OAuth logins. Absent means SAML, where the team's IdP is the authority.
88543
+ * OAuth proves email ownership only, so the consumer must re-check the
88544
+ * resource's email allowlists and that this provider is enabled before
88545
+ * creating a session.
88546
+ */
88547
+ provider: socialOauthProviderSchema.optional(),
88391
88548
  teamUid: nanoidSchema,
88392
88549
  exp: external_exports.number()
88393
88550
  }).meta({ id: "hosting-exchange-token" });
88551
+ var hostingLoginTokenSchema = entitySchema.extend({
88552
+ email: emailSchema,
88553
+ host: external_exports.string(),
88554
+ redirect: external_exports.string().optional(),
88555
+ loginPortalUid: external_exports.string().optional(),
88556
+ exp: timestampSchema
88557
+ }).meta({ id: "hosting-login-token" });
88394
88558
  var docsAgentTokenSchema = external_exports.object({
88395
88559
  uid: external_exports.string(),
88396
88560
  publishUid: external_exports.string(),
@@ -88665,6 +88829,8 @@ var BaseCollections = {
88665
88829
  SignupMeta: "signup-meta",
88666
88830
  ExchangeTokens: "exchange-tokens",
88667
88831
  HostingExchange: "hosting-exchange",
88832
+ HostingLoginTokens: "hosting-login-tokens",
88833
+ HostingOauthStates: "hosting-oauth-states",
88668
88834
  Passwords: "passwords",
88669
88835
  SignupOtp: "signup-otp",
88670
88836
  GithubUsers: "github-users",
@@ -89493,6 +89659,16 @@ function sdksApiFactory(requestService) {
89493
89659
  schema: external_exports.unknown()
89494
89660
  });
89495
89661
  }
89662
+ async function transformConfig(data) {
89663
+ return await requestService.request({
89664
+ url: "sdk-generator/transform-config",
89665
+ method: "post",
89666
+ data,
89667
+ schema: external_exports.object({
89668
+ config: external_exports.string().nullable()
89669
+ })
89670
+ });
89671
+ }
89496
89672
  async function del(uid) {
89497
89673
  return await requestService.request({
89498
89674
  url: `core/v1/sdks/${uid}`,
@@ -89557,6 +89733,18 @@ function sdksApiFactory(requestService) {
89557
89733
  schema: external_exports.null()
89558
89734
  });
89559
89735
  }
89736
+ async function requestSampleAccess(data) {
89737
+ return await requestService.request({
89738
+ url: `core/v1/sdks/${data.uid}/sample/access`,
89739
+ method: "post",
89740
+ schema: external_exports.object({
89741
+ repositories: external_exports.object({
89742
+ repository: external_exports.string(),
89743
+ invitationUrl: external_exports.string().nullable()
89744
+ }).array()
89745
+ })
89746
+ });
89747
+ }
89560
89748
  async function updateRepo(data) {
89561
89749
  return await requestService.request({
89562
89750
  url: "core/v1/sdks/repository/update",
@@ -89573,6 +89761,14 @@ function sdksApiFactory(requestService) {
89573
89761
  schema: external_exports.null()
89574
89762
  });
89575
89763
  }
89764
+ async function updatePublishing(data) {
89765
+ return await requestService.request({
89766
+ url: "core/v1/sdks/repository/publishing",
89767
+ method: "post",
89768
+ data,
89769
+ schema: external_exports.null()
89770
+ });
89771
+ }
89576
89772
  async function syncBuild(data) {
89577
89773
  return await requestService.request({
89578
89774
  url: "core/v1/sdks/sync",
@@ -89589,11 +89785,39 @@ function sdksApiFactory(requestService) {
89589
89785
  schema: external_exports.null()
89590
89786
  });
89591
89787
  }
89788
+ async function getConflicts(data) {
89789
+ return await requestService.request({
89790
+ url: "core/v1/sdks/conflicts",
89791
+ method: "post",
89792
+ data,
89793
+ schema: external_exports.object({
89794
+ baseSha: external_exports.string(),
89795
+ files: external_exports.object({
89796
+ filepath: external_exports.string(),
89797
+ ours: external_exports.string(),
89798
+ base: external_exports.string(),
89799
+ theirs: external_exports.string()
89800
+ }).array()
89801
+ })
89802
+ });
89803
+ }
89804
+ async function resolveConflicts(data) {
89805
+ return await requestService.request({
89806
+ url: "core/v1/sdks/conflicts/resolve",
89807
+ method: "post",
89808
+ data,
89809
+ schema: external_exports.object({
89810
+ pullRequest: external_exports.number(),
89811
+ commitHash: external_exports.string()
89812
+ })
89813
+ });
89814
+ }
89592
89815
  return {
89593
89816
  create,
89594
89817
  fromConfig,
89595
89818
  createVersion,
89596
89819
  previewCodeSamples,
89820
+ transformConfig,
89597
89821
  update,
89598
89822
  delete: del,
89599
89823
  discardDraft,
@@ -89602,10 +89826,14 @@ function sdksApiFactory(requestService) {
89602
89826
  addAccessGroup,
89603
89827
  removeAccessGroup,
89604
89828
  linkRepo,
89829
+ requestSampleAccess,
89605
89830
  unlinkRepo,
89606
89831
  updateRepo,
89832
+ updatePublishing,
89607
89833
  build,
89608
- syncBuild
89834
+ syncBuild,
89835
+ getConflicts,
89836
+ resolveConflicts
89609
89837
  };
89610
89838
  }
89611
89839
 
@@ -89792,12 +90020,13 @@ function formatApiResponse(data, status, headers) {
89792
90020
  error: false
89793
90021
  };
89794
90022
  }
89795
- function formatApiError(message, status, error48 = null) {
90023
+ function formatApiError(message, status, error48 = null, code) {
89796
90024
  return {
89797
90025
  status,
89798
90026
  message,
89799
90027
  error: true,
89800
- originalError: error48
90028
+ originalError: error48,
90029
+ code
89801
90030
  };
89802
90031
  }
89803
90032
  function requestServiceFactory(baseUrl, getAuthToken) {
@@ -89832,8 +90061,10 @@ function requestServiceFactory(baseUrl, getAuthToken) {
89832
90061
  }).then(async (response) => {
89833
90062
  const isJson = response.headers.get("content-type")?.includes("application/json");
89834
90063
  if (!response.ok) {
89835
- const message = isJson ? String((await response.json().catch(() => ({ message: "Invalid response" }))).message) || "Unknown Error" : await response.text().catch(() => "Invalid response");
89836
- return formatApiError(message, response.status);
90064
+ const body = isJson ? await response.json().catch(() => ({ message: "Invalid response" })) : { message: await response.text().catch(() => "Invalid response") };
90065
+ const message = String(body.message ?? "") || "Unknown Error";
90066
+ const code = typeof body.code === "string" ? body.code : void 0;
90067
+ return formatApiError(message, response.status, null, code);
89837
90068
  }
89838
90069
  if (stream2)
89839
90070
  return response.body ?? new ReadableStream();
@@ -90730,13 +90961,14 @@ function publishApiFactory(requestService) {
90730
90961
  })
90731
90962
  });
90732
90963
  }
90733
- async function unpublish(projectUid, githubProjectUid) {
90964
+ async function unpublish(projectUid, githubProjectUid, unifiedProjectUid) {
90734
90965
  return await requestService.request({
90735
90966
  url: "core/unpublish",
90736
90967
  method: "delete",
90737
90968
  data: {
90738
90969
  projectUid,
90739
- githubProjectUid
90970
+ githubProjectUid,
90971
+ unifiedProjectUid
90740
90972
  },
90741
90973
  schema: external_exports.null()
90742
90974
  });
@@ -91258,7 +91490,7 @@ var config2 = {
91258
91490
  }
91259
91491
  },
91260
91492
  cdnUrl: process.env.CDN_URL ?? "https://cdn.scalar.com",
91261
- ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.4.4"
91493
+ ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.4.6"
91262
91494
  };
91263
91495
 
91264
91496
  // src/domains/auth/login/helpers/personal-token-generate-access.ts
@@ -91890,71 +92122,9 @@ var DeleteSchemaCommand = () => {
91890
92122
  return cmd2;
91891
92123
  };
91892
92124
 
91893
- // src/domains/schema/list.ts
91894
- import as2 from "ansis";
92125
+ // src/domains/schema/get.ts
92126
+ import fs3 from "node:fs/promises";
91895
92127
  import { Command as Command2 } from "commander";
91896
- var ListSchemaCommand = () => {
91897
- const cmd2 = new Command2("list");
91898
- cmd2.description("List all schemas for a team namespace");
91899
- cmd2.option("--namespace <namespace>", "Team namespace");
91900
- cmd2.action(async (args) => {
91901
- const { error: error48, data } = external_exports.object({
91902
- namespace: namespaceSchema.optional()
91903
- }).safeParse({
91904
- namespace: args.namespace
91905
- });
91906
- if (error48)
91907
- return output.error().title("Invalid input").message(error48.issues[0].message).exit("error");
91908
- const auth = await getAuthData();
91909
- auth.addEventListener((state) => Object.assign(auth, state));
91910
- const client = await getDatabaseClient();
91911
- const team = await client.getOne({
91912
- collectionPath: BaseCollections.Teams,
91913
- query: {
91914
- uid: auth.teamUid
91915
- },
91916
- schema: teamSchema
91917
- });
91918
- if (team.error)
91919
- return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
91920
- const namespace = data.namespace || team.data.namespaces.at(0);
91921
- if (!namespace) {
91922
- return output.error().title("Missing namespace").message(
91923
- "Could not find a valid namespace for your API. Please specify a namespace or contact support."
91924
- ).exit("error");
91925
- }
91926
- const apiClient = await apiService();
91927
- const schemas = await apiClient.managedSchemas.getSchemas(namespace);
91928
- if (schemas.error)
91929
- return output.error().title(schemas.message).exit("error");
91930
- output.info().table(
91931
- [
91932
- [
91933
- as2.underline.bold("Slug"),
91934
- as2.underline.bold("Title"),
91935
- as2.underline.bold("Version")
91936
- ],
91937
- ...schemas.data.map((schema) => {
91938
- return [
91939
- as2.blue(schema.slug),
91940
- as2.blue(schema.title),
91941
- schema.isPrivate ? as2.green("Private") : as2.yellow("Public")
91942
- ];
91943
- })
91944
- ],
91945
- { padding: 2 }
91946
- ).print();
91947
- });
91948
- return cmd2;
91949
- };
91950
-
91951
- // src/domains/schema/publish.ts
91952
- import { text } from "@clack/prompts";
91953
- import as6 from "ansis";
91954
- import { Command as Command4 } from "commander";
91955
- import { bundle as bundle2 } from "@scalar/json-magic/bundle";
91956
- import { fetchUrls as fetchUrls2, readFiles as readFiles2 } from "@scalar/json-magic/bundle/plugins/node";
91957
- import { parseJsonOrYaml } from "@scalar/oas-utils/helpers";
91958
92128
 
91959
92129
  // ../../packages/urls/dist/publish/full.js
91960
92130
  function getPublishUrl(domain2, subpath) {
@@ -92047,14 +92217,184 @@ function registry2(teamNamespace) {
92047
92217
  };
92048
92218
  }
92049
92219
 
92220
+ // src/domains/registry/helpers/links.ts
92221
+ function registryUrl(path13) {
92222
+ return `${config2.projects.registry}/${path13}`;
92223
+ }
92224
+ function dashboardUrl(asset, uid) {
92225
+ return `${config2.projects.dashboard}/registry/${asset}/${uid}`;
92226
+ }
92227
+
92228
+ // src/domains/registry/helpers/fetch.ts
92229
+ async function fetchFromRegistry(path13, accessToken) {
92230
+ let response;
92231
+ try {
92232
+ response = await fetch(registryUrl(path13), {
92233
+ headers: {
92234
+ "x-scalar-auth": accessToken
92235
+ },
92236
+ // Should always error on redirect
92237
+ redirect: "error"
92238
+ });
92239
+ } catch (error48) {
92240
+ return {
92241
+ error: true,
92242
+ message: error48 instanceof Error && error48.message.length > 0 ? error48.message : "Registry request failed before a response was received."
92243
+ };
92244
+ }
92245
+ if (!response.ok) {
92246
+ const message = await response.text();
92247
+ return {
92248
+ error: true,
92249
+ message: message.length ? message : `Registry request failed with status ${response.status}.`
92250
+ };
92251
+ }
92252
+ return {
92253
+ error: false,
92254
+ data: await response.text()
92255
+ };
92256
+ }
92257
+
92258
+ // src/domains/schema/get.ts
92259
+ var versionSchema3 = external_exports.union([docVersionSchema, external_exports.literal("latest")]);
92260
+ var GetSchemaCommand = () => {
92261
+ const cmd2 = new Command2("get");
92262
+ cmd2.description("Get a schema document version from the Scalar registry");
92263
+ cmd2.argument("[namespace]", "Team namespace");
92264
+ cmd2.argument("[slug]", "Schema slug");
92265
+ cmd2.option("--version <version>", "Schema version (defaults to latest)");
92266
+ cmd2.option("--format <format>", "Output format (json or yaml)", "json");
92267
+ cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
92268
+ cmd2.action(async (namespace, slug, args) => {
92269
+ if (!namespace) {
92270
+ output.error().title("Invalid input").message("Please provide namespace of the schema").exit("error");
92271
+ return;
92272
+ }
92273
+ if (!slug) {
92274
+ output.error().title("Invalid input").message("Please provide slug of the schema").exit("error");
92275
+ return;
92276
+ }
92277
+ const result = external_exports.object({
92278
+ version: versionSchema3,
92279
+ format: external_exports.enum(["json", "yaml"]),
92280
+ output: external_exports.string().min(1).optional()
92281
+ }).safeParse({
92282
+ version: args.version ?? "latest",
92283
+ format: args.format,
92284
+ output: args.output
92285
+ });
92286
+ if (result.error) {
92287
+ output.error().title("Invalid input").message(result.error.issues[0].message).exit("error");
92288
+ return;
92289
+ }
92290
+ const auth = await getAuthData();
92291
+ auth.addEventListener((state) => Object.assign(auth, state));
92292
+ const fetchResult = await fetchFromRegistry(
92293
+ registry2(namespace).schemas(slug).url({
92294
+ version: result.data.version,
92295
+ format: result.data.format
92296
+ }),
92297
+ auth.accessToken
92298
+ );
92299
+ if (fetchResult.error) {
92300
+ output.error().title("Unable to download schema").message(fetchResult.message).exit("error");
92301
+ return;
92302
+ }
92303
+ const document2 = fetchResult.data;
92304
+ const withTrailingNewline = document2.endsWith("\n") ? document2 : `${document2}
92305
+ `;
92306
+ if (result.data.output) {
92307
+ try {
92308
+ await fs3.writeFile(result.data.output, withTrailingNewline, "utf8");
92309
+ } catch (error48) {
92310
+ const message = error48 instanceof Error && error48.message.length > 0 ? error48.message : `Could not write to ${result.data.output}.`;
92311
+ output.error().title("Unable to write schema to file").message(message).exit("error");
92312
+ return;
92313
+ }
92314
+ output.info().line(
92315
+ `Downloaded ${namespace}/${slug}@${result.data.version} (${result.data.format})`
92316
+ ).line(`Written to ${result.data.output}`).print();
92317
+ return;
92318
+ }
92319
+ process.stdout.write(withTrailingNewline);
92320
+ });
92321
+ return cmd2;
92322
+ };
92323
+
92324
+ // src/domains/schema/list.ts
92325
+ import as2 from "ansis";
92326
+ import { Command as Command3 } from "commander";
92327
+ var ListSchemaCommand = () => {
92328
+ const cmd2 = new Command3("list");
92329
+ cmd2.description("List all schemas for a team namespace");
92330
+ cmd2.option("--namespace <namespace>", "Team namespace");
92331
+ cmd2.action(async (args) => {
92332
+ const { error: error48, data } = external_exports.object({
92333
+ namespace: namespaceSchema.optional()
92334
+ }).safeParse({
92335
+ namespace: args.namespace
92336
+ });
92337
+ if (error48)
92338
+ return output.error().title("Invalid input").message(error48.issues[0].message).exit("error");
92339
+ const auth = await getAuthData();
92340
+ auth.addEventListener((state) => Object.assign(auth, state));
92341
+ const client = await getDatabaseClient();
92342
+ const team = await client.getOne({
92343
+ collectionPath: BaseCollections.Teams,
92344
+ query: {
92345
+ uid: auth.teamUid
92346
+ },
92347
+ schema: teamSchema
92348
+ });
92349
+ if (team.error)
92350
+ return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
92351
+ const namespace = data.namespace || team.data.namespaces.at(0);
92352
+ if (!namespace) {
92353
+ return output.error().title("Missing namespace").message(
92354
+ "Could not find a valid namespace for your API. Please specify a namespace or contact support."
92355
+ ).exit("error");
92356
+ }
92357
+ const apiClient = await apiService();
92358
+ const schemas = await apiClient.managedSchemas.getSchemas(namespace);
92359
+ if (schemas.error)
92360
+ return output.error().title(schemas.message).exit("error");
92361
+ output.info().table(
92362
+ [
92363
+ [
92364
+ as2.underline.bold("Slug"),
92365
+ as2.underline.bold("Title"),
92366
+ as2.underline.bold("Version")
92367
+ ],
92368
+ ...schemas.data.map((schema) => {
92369
+ return [
92370
+ as2.blue(schema.slug),
92371
+ as2.blue(schema.title),
92372
+ schema.isPrivate ? as2.green("Private") : as2.yellow("Public")
92373
+ ];
92374
+ })
92375
+ ],
92376
+ { padding: 2 }
92377
+ ).print();
92378
+ });
92379
+ return cmd2;
92380
+ };
92381
+
92382
+ // src/domains/schema/publish.ts
92383
+ import { text } from "@clack/prompts";
92384
+ import as6 from "ansis";
92385
+ import { Command as Command5 } from "commander";
92386
+ import { bundle as bundle2 } from "@scalar/json-magic/bundle";
92387
+ import { fetchUrls as fetchUrls2, readFiles as readFiles2 } from "@scalar/json-magic/bundle/plugins/node";
92388
+ import { parseJsonOrYaml } from "@scalar/oas-utils/helpers";
92389
+
92050
92390
  // src/domains/document/bundle/index.ts
92051
92391
  var import_yaml2 = __toESM(require_dist(), 1);
92052
- import fs4 from "node:fs/promises";
92392
+ import fs5 from "node:fs/promises";
92053
92393
  import path3 from "node:path";
92054
92394
  import { cwd } from "node:process";
92055
92395
  import { confirm } from "@clack/prompts";
92056
92396
  import as5 from "ansis";
92057
- import { Command as Command3 } from "commander";
92397
+ import { Command as Command4 } from "commander";
92058
92398
  import { bundle } from "@scalar/json-magic/bundle";
92059
92399
  import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
92060
92400
 
@@ -92076,7 +92416,7 @@ var printSpecificationBanner = (result) => {
92076
92416
  };
92077
92417
 
92078
92418
  // src/domains/document/helpers/imports.ts
92079
- import fs3 from "node:fs";
92419
+ import fs4 from "node:fs";
92080
92420
  import as4 from "ansis";
92081
92421
  import { load, validate } from "@scalar/openapi-parser";
92082
92422
  var getFileOrUrl = async (input) => {
@@ -92087,10 +92427,10 @@ var getFileOrUrl = async (input) => {
92087
92427
  }
92088
92428
  return await response.text();
92089
92429
  }
92090
- if (!fs3.existsSync(input)) {
92430
+ if (!fs4.existsSync(input)) {
92091
92431
  return output.error().title("Could not read file.").exit("error");
92092
92432
  }
92093
- return fs3.readFileSync(input, "utf-8");
92433
+ return fs4.readFileSync(input, "utf-8");
92094
92434
  };
92095
92435
  var loadOpenApiFile = async (input) => {
92096
92436
  const specification = await getFileOrUrl(input);
@@ -92137,9 +92477,9 @@ async function measureTime(fn) {
92137
92477
  // src/domains/document/bundle/index.ts
92138
92478
  var DEFAULT_FETCH_CONCURRENCY = 5;
92139
92479
  function BundleCommand() {
92140
- const cmd2 = new Command3("bundle");
92480
+ const cmd2 = new Command4("bundle");
92141
92481
  cmd2.description(
92142
- "Bundle an OpenAPI specification by resolving all references and external dependencies"
92482
+ "Bundle an OpenAPI document by resolving all references and external dependencies"
92143
92483
  );
92144
92484
  cmd2.argument("[file|url]", "Path to OpenAPI file or URL to bundle");
92145
92485
  cmd2.option("-o, --output <file>", "Path to save the bundled output file");
@@ -92192,7 +92532,7 @@ function BundleCommand() {
92192
92532
  urlMap: !!urlMap
92193
92533
  })
92194
92534
  );
92195
- await fs4.writeFile(
92535
+ await fs5.writeFile(
92196
92536
  outputFilePath ?? input,
92197
92537
  isYaml ? import_yaml2.default.stringify(result) : JSON.stringify(result),
92198
92538
  "utf8"
@@ -92205,17 +92545,9 @@ function BundleCommand() {
92205
92545
  return cmd2;
92206
92546
  }
92207
92547
 
92208
- // src/domains/registry/helpers/links.ts
92209
- function registryUrl(path13) {
92210
- return `${config2.projects.registry}/${path13}`;
92211
- }
92212
- function dashboardUrl(asset, uid) {
92213
- return `${config2.projects.dashboard}/registry/${asset}/${uid}`;
92214
- }
92215
-
92216
92548
  // src/domains/schema/publish.ts
92217
92549
  var PublishSchemaCommand = () => {
92218
- const cmd2 = new Command4("publish");
92550
+ const cmd2 = new Command5("publish");
92219
92551
  cmd2.description("Publish a shared schema to the Scalar registry");
92220
92552
  cmd2.argument("[file]", "OpenAPI file to upload");
92221
92553
  cmd2.option(
@@ -92306,7 +92638,9 @@ var PublishSchemaCommand = () => {
92306
92638
  const matchingSchema = namespaceSchemaRes.data.find(
92307
92639
  (schema2) => schema2.slug === slug
92308
92640
  );
92309
- const title = matchingSchema || data.title ? data.title : (await text({
92641
+ const documentTitle = result?.info?.title;
92642
+ const providedTitle = data.title ?? documentTitle;
92643
+ const title = matchingSchema || providedTitle ? providedTitle : (await text({
92310
92644
  message: "Please provide a title for your schema",
92311
92645
  validate(value) {
92312
92646
  if (value.length === 0) return "Title is required.";
@@ -92361,9 +92695,9 @@ var PublishSchemaCommand = () => {
92361
92695
 
92362
92696
  // src/domains/schema/update.ts
92363
92697
  import { select as select2 } from "@clack/prompts";
92364
- import { Command as Command5 } from "commander";
92698
+ import { Command as Command6 } from "commander";
92365
92699
  var UpdateSchemaCommand = () => {
92366
- const cmd2 = new Command5("update");
92700
+ const cmd2 = new Command6("update");
92367
92701
  cmd2.description("Update schema metadata.");
92368
92702
  cmd2.option("-s, --slug <slug>", "Schema slug");
92369
92703
  cmd2.option("-n, --namespace <namespace>", "Team namespace");
@@ -92431,21 +92765,22 @@ var schemaCommands = [
92431
92765
  DeleteSchemaCommand,
92432
92766
  UpdateSchemaCommand,
92433
92767
  ListSchemaCommand,
92768
+ GetSchemaCommand,
92434
92769
  PublishSchemaCommand
92435
92770
  ];
92436
- var schemaDomain = new Command6("schema");
92771
+ var schemaDomain = new Command7("schema");
92437
92772
  schemaDomain.description("Manage your Scalar schemas");
92438
- schemaCommands.forEach((command) => schemaDomain.addCommand(command()));
92773
+ schemaCommands.forEach((command) => void schemaDomain.addCommand(command()));
92439
92774
  var schema_default = schemaDomain;
92440
92775
 
92441
92776
  // src/domains/sdk/index.ts
92442
- import { Command as Command12 } from "commander";
92777
+ import { Command as Command13 } from "commander";
92443
92778
 
92444
92779
  // src/domains/sdk/build.ts
92445
92780
  import { select as select3 } from "@clack/prompts";
92446
- import { Command as Command7 } from "commander";
92781
+ import { Command as Command8 } from "commander";
92447
92782
  var BuildSdkCommand = () => {
92448
- const cmd2 = new Command7("build");
92783
+ const cmd2 = new Command8("build");
92449
92784
  cmd2.description("Create an SDK build.");
92450
92785
  cmd2.option("-s, --slug <slug>", "SDK slug");
92451
92786
  cmd2.option("-n, --namespace <namespace>", "Team namespace");
@@ -92518,9 +92853,9 @@ var BuildSdkCommand = () => {
92518
92853
  // src/domains/sdk/create.ts
92519
92854
  import { select as select4, text as text2 } from "@clack/prompts";
92520
92855
  import as7 from "ansis";
92521
- import { Command as Command8, Option } from "commander";
92856
+ import { Command as Command9, Option } from "commander";
92522
92857
  var CreateSdkCommand = () => {
92523
- const cmd2 = new Command8("create");
92858
+ const cmd2 = new Command9("create");
92524
92859
  cmd2.description("Create a new SDK.");
92525
92860
  cmd2.option("-a, --api <api>", "Registry API slug");
92526
92861
  cmd2.option("-n, --namespace <namespace>", "Team namespace");
@@ -92596,9 +92931,9 @@ var CreateSdkCommand = () => {
92596
92931
 
92597
92932
  // src/domains/sdk/delete.ts
92598
92933
  import { select as select5 } from "@clack/prompts";
92599
- import { Command as Command9 } from "commander";
92934
+ import { Command as Command10 } from "commander";
92600
92935
  var DeleteSdkCommand = () => {
92601
- const cmd2 = new Command9("delete");
92936
+ const cmd2 = new Command10("delete");
92602
92937
  cmd2.description("Delete an SDK.");
92603
92938
  cmd2.option("-s, --slug <slug>", "SDK slug");
92604
92939
  cmd2.option("-n, --namespace <namespace>", "Team namespace");
@@ -92658,9 +92993,9 @@ var DeleteSdkCommand = () => {
92658
92993
 
92659
92994
  // src/domains/sdk/update.ts
92660
92995
  import { select as select6 } from "@clack/prompts";
92661
- import { Command as Command10 } from "commander";
92996
+ import { Command as Command11 } from "commander";
92662
92997
  var UpdateSdkCommand = () => {
92663
- const cmd2 = new Command10("update");
92998
+ const cmd2 = new Command11("update");
92664
92999
  cmd2.description("Update SDK metadata.");
92665
93000
  cmd2.option("-s, --slug <slug>", "SDK slug");
92666
93001
  cmd2.option("-n, --namespace <namespace>", "Team namespace");
@@ -92727,9 +93062,9 @@ var UpdateSdkCommand = () => {
92727
93062
 
92728
93063
  // src/domains/sdk/list.ts
92729
93064
  import as8 from "ansis";
92730
- import { Command as Command11 } from "commander";
93065
+ import { Command as Command12 } from "commander";
92731
93066
  var ListSdkCommand = () => {
92732
- const cmd2 = new Command11("list");
93067
+ const cmd2 = new Command12("list");
92733
93068
  cmd2.description("List all SDKs for a team namespace");
92734
93069
  cmd2.option("--namespace <namespace>", "Team namespace");
92735
93070
  cmd2.action(async (args) => {
@@ -92797,17 +93132,17 @@ var sdkCommands = [
92797
93132
  DeleteSdkCommand,
92798
93133
  BuildSdkCommand
92799
93134
  ];
92800
- var sdkDomain = new Command12("sdk");
93135
+ var sdkDomain = new Command13("sdk");
92801
93136
  sdkDomain.description("Manage your Scalar SDKs (Enterprise Only)");
92802
93137
  sdkCommands.forEach((command) => sdkDomain.addCommand(command()));
92803
93138
  var sdk_default = sdkDomain;
92804
93139
 
92805
93140
  // src/domains/auth/index.ts
92806
- import { Command as Command16 } from "commander";
93141
+ import { Command as Command17 } from "commander";
92807
93142
 
92808
93143
  // src/domains/auth/login/index.ts
92809
93144
  import as10 from "ansis";
92810
- import { Command as Command13 } from "commander";
93145
+ import { Command as Command14 } from "commander";
92811
93146
 
92812
93147
  // ../../packages/mongobase-client/dist/auth/node/exchange-callback-server.js
92813
93148
  import getPort from "get-port";
@@ -92951,7 +93286,7 @@ var emailPasswordAuth = async ({
92951
93286
 
92952
93287
  // src/domains/auth/login/index.ts
92953
93288
  var LoginCommand = () => {
92954
- const cmd2 = new Command13("login");
93289
+ const cmd2 = new Command14("login");
92955
93290
  cmd2.description("Login to scalar");
92956
93291
  cmd2.option("--email <email>", "Email");
92957
93292
  cmd2.option("--password <password>", "Password");
@@ -93012,9 +93347,9 @@ var LoginCommand = () => {
93012
93347
  };
93013
93348
 
93014
93349
  // src/domains/auth/logout/index.ts
93015
- import { Command as Command14 } from "commander";
93350
+ import { Command as Command15 } from "commander";
93016
93351
  var LogoutCommand = () => {
93017
- const cmd2 = new Command14("logout");
93352
+ const cmd2 = new Command15("logout");
93018
93353
  cmd2.description("Logout from scalar");
93019
93354
  cmd2.action(async () => {
93020
93355
  await clearAuthData();
@@ -93025,9 +93360,9 @@ var LogoutCommand = () => {
93025
93360
 
93026
93361
  // src/domains/auth/whoami/index.ts
93027
93362
  import as11 from "ansis";
93028
- import { Command as Command15 } from "commander";
93363
+ import { Command as Command16 } from "commander";
93029
93364
  var WhoAmICommand = () => {
93030
- const cmd2 = new Command15("whoami");
93365
+ const cmd2 = new Command16("whoami");
93031
93366
  cmd2.description("Display the current user");
93032
93367
  cmd2.action(async () => {
93033
93368
  const auth = await getAuthData({ skipRefresh: true });
@@ -93040,19 +93375,19 @@ var WhoAmICommand = () => {
93040
93375
 
93041
93376
  // src/domains/auth/index.ts
93042
93377
  var authCommands = [LoginCommand, WhoAmICommand, LogoutCommand];
93043
- var authDomain = new Command16("auth");
93378
+ var authDomain = new Command17("auth");
93044
93379
  authDomain.description("Manage authorization on scalar platform");
93045
93380
  authCommands.forEach((command) => authDomain.addCommand(command()));
93046
93381
  var auth_default = authDomain;
93047
93382
 
93048
93383
  // src/domains/document/index.ts
93049
- import { Command as Command29 } from "commander";
93384
+ import { Command as Command30 } from "commander";
93050
93385
 
93051
93386
  // src/domains/document/join/index.ts
93052
93387
  var import_yaml3 = __toESM(require_dist(), 1);
93053
- import fs5 from "node:fs/promises";
93388
+ import fs6 from "node:fs/promises";
93054
93389
  import as12 from "ansis";
93055
- import { Command as Command17 } from "commander";
93390
+ import { Command as Command18 } from "commander";
93056
93391
  import { join, normalize as normalize2 } from "@scalar/openapi-parser";
93057
93392
 
93058
93393
  // src/domains/document/join/helpers.ts
@@ -93088,7 +93423,7 @@ var formatErrorMessage = (conflicts) => {
93088
93423
  });
93089
93424
  };
93090
93425
  function JoinCommand() {
93091
- const cmd2 = new Command17("join");
93426
+ const cmd2 = new Command18("join");
93092
93427
  cmd2.description(
93093
93428
  "Merge multiple OpenAPI documents into a single unified document"
93094
93429
  );
@@ -93112,7 +93447,7 @@ function JoinCommand() {
93112
93447
  optsError.issues.map((e) => `${e.message} property: '${e.path}'`).join("\n")
93113
93448
  ).line("").exit("error");
93114
93449
  }
93115
- const files = (await Promise.all(input.map((file2) => fs5.readFile(file2, "utf-8")))).map((it) => normalize2(it));
93450
+ const files = (await Promise.all(input.map((file2) => fs6.readFile(file2, "utf-8")))).map((it) => normalize2(it));
93116
93451
  const prefixes = opts.prefixComponentsWithPathValue ? getPrefixes(files, opts.prefixComponentsWithPathValue) : [];
93117
93452
  const { executionTimeMs, result } = await measureTime(
93118
93453
  () => join(files, { prefixComponents: prefixes })
@@ -93122,7 +93457,7 @@ function JoinCommand() {
93122
93457
  ${formatErrorMessage(result.conflicts).join("\n")}`).line().exit("error");
93123
93458
  }
93124
93459
  const isYaml = isYamlFileName(opts.output);
93125
- await fs5.writeFile(
93460
+ await fs6.writeFile(
93126
93461
  opts.output,
93127
93462
  isYaml ? import_yaml3.default.stringify(result.document) : JSON.stringify(result.document, null, 2),
93128
93463
  "utf8"
@@ -93135,18 +93470,18 @@ ${formatErrorMessage(result.conflicts).join("\n")}`).line().exit("error");
93135
93470
  }
93136
93471
 
93137
93472
  // src/domains/document/split/index.ts
93138
- import fs6 from "node:fs/promises";
93473
+ import fs7 from "node:fs/promises";
93139
93474
  import path4 from "node:path";
93140
93475
  import { text as text3 } from "@clack/prompts";
93141
93476
  import as13 from "ansis";
93142
- import { Command as Command18 } from "commander";
93477
+ import { Command as Command19 } from "commander";
93143
93478
  import { normalize as normalize3 } from "@scalar/openapi-parser";
93144
93479
  import {
93145
93480
  createServerWorkspaceStore,
93146
93481
  WORKSPACE_FILE_NAME
93147
93482
  } from "@scalar/workspace-store/server";
93148
93483
  function SplitCommand() {
93149
- const cmd2 = new Command18("split");
93484
+ const cmd2 = new Command19("split");
93150
93485
  cmd2.description("Split your OpenAPI documents on small chunks");
93151
93486
  cmd2.argument("[file|url]", "Path to OpenAPI file or URL to split");
93152
93487
  cmd2.option("-o, --output <path>", "Path to save the chunks");
@@ -93186,13 +93521,13 @@ function SplitCommand() {
93186
93521
  await store.generateWorkspaceChunks();
93187
93522
  const workspaceFilePath = path4.join(outputPath, WORKSPACE_FILE_NAME);
93188
93523
  const sparseDocument = JSON.parse(
93189
- await fs6.readFile(workspaceFilePath, { encoding: "utf-8" })
93524
+ await fs7.readFile(workspaceFilePath, { encoding: "utf-8" })
93190
93525
  );
93191
- await fs6.writeFile(
93526
+ await fs7.writeFile(
93192
93527
  path4.join(outputPath, "out.json"),
93193
93528
  JSON.stringify(sparseDocument.documents[documentName])
93194
93529
  );
93195
- await fs6.rm(workspaceFilePath);
93530
+ await fs7.rm(workspaceFilePath);
93196
93531
  });
93197
93532
  output.info().line().title(as13.green("Document Split Successfully! \u{1F389}")).line().message(`\u2728 Chunks have been generated at: ${as13.blue(outputPath)}`).line(`\u23F1\uFE0F Split completed in ${as13.yellow(executionTimeMs.toFixed(2))}ms`).line("").print();
93198
93533
  });
@@ -93200,12 +93535,12 @@ function SplitCommand() {
93200
93535
  }
93201
93536
 
93202
93537
  // src/domains/document/format/index.ts
93203
- import fs7 from "node:fs";
93538
+ import fs8 from "node:fs";
93204
93539
  import as14 from "ansis";
93205
- import { Command as Command19 } from "commander";
93540
+ import { Command as Command20 } from "commander";
93206
93541
  import { normalize as normalize4, toJson, toYaml } from "@scalar/openapi-parser";
93207
93542
  function FormatCommand() {
93208
- const cmd2 = new Command19("format");
93543
+ const cmd2 = new Command20("format");
93209
93544
  cmd2.description("Format an OpenAPI file");
93210
93545
  cmd2.argument("[file|url]", "File or URL to format");
93211
93546
  cmd2.option("-o, --output <file>", "Output file");
@@ -93218,9 +93553,9 @@ function FormatCommand() {
93218
93553
  const specification = await getFileOrUrl(inputArgument);
93219
93554
  const newContent = isYamlFileName(outputPath || inputArgument) ? toYaml(normalize4(specification)) : toJson(normalize4(specification));
93220
93555
  if (outputPath) {
93221
- fs7.writeFileSync(outputPath, newContent, "utf8");
93556
+ fs8.writeFileSync(outputPath, newContent, "utf8");
93222
93557
  } else if (!isUrl(inputArgument)) {
93223
- fs7.writeFileSync(inputArgument, newContent, "utf8");
93558
+ fs8.writeFileSync(inputArgument, newContent, "utf8");
93224
93559
  } else {
93225
93560
  return output.error().title("Invalid argument").message().message(
93226
93561
  "Output file is required for URLs. Try passing --output file flag."
@@ -93240,7 +93575,7 @@ function FormatCommand() {
93240
93575
  // src/domains/document/lint/index.ts
93241
93576
  import spectralCore from "@stoplight/spectral-core";
93242
93577
  import as15 from "ansis";
93243
- import { Command as Command20 } from "commander";
93578
+ import { Command as Command21 } from "commander";
93244
93579
 
93245
93580
  // src/domains/document/lint/helpers.ts
93246
93581
  import { bundleAndLoadRuleset } from "@stoplight/spectral-ruleset-bundler/with-loader";
@@ -93272,7 +93607,7 @@ var severityToLabel = (severity) => {
93272
93607
  var { Spectral } = spectralCore;
93273
93608
  var spectral = new Spectral();
93274
93609
  function LintCommand() {
93275
- const cmd2 = new Command20("lint");
93610
+ const cmd2 = new Command21("lint");
93276
93611
  cmd2.description("Lint your OpenAPI file using spectral rules");
93277
93612
  cmd2.argument("[file|url]", "OpenAPI file path or url");
93278
93613
  cmd2.option("-r, --rule <file|url>", "Rule path or url");
@@ -93308,12 +93643,12 @@ function LintCommand() {
93308
93643
  }
93309
93644
 
93310
93645
  // src/domains/document/markdown/index.ts
93311
- import fs8 from "node:fs";
93646
+ import fs9 from "node:fs";
93312
93647
  import as16 from "ansis";
93313
- import { Command as Command21 } from "commander";
93648
+ import { Command as Command22 } from "commander";
93314
93649
  import { createMarkdownFromOpenApi } from "@scalar/openapi-to-markdown";
93315
93650
  function MarkdownCommand() {
93316
- const cmd2 = new Command21("markdown");
93651
+ const cmd2 = new Command22("markdown");
93317
93652
  cmd2.description("Generate Markdown from an OpenAPI file");
93318
93653
  cmd2.argument("[file|url]", "OpenAPI file path or URL to convert");
93319
93654
  cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
@@ -93326,7 +93661,7 @@ function MarkdownCommand() {
93326
93661
  const specification = await getFileOrUrl(inputArgument);
93327
93662
  const markdown = await createMarkdownFromOpenApi(specification);
93328
93663
  if (outputPath) {
93329
- fs8.writeFileSync(outputPath, markdown, "utf8");
93664
+ fs9.writeFileSync(outputPath, markdown, "utf8");
93330
93665
  const endTime = performance.now();
93331
93666
  output.info().line(
93332
93667
  `${as16.green("Markdown generated")} ${as16.grey(
@@ -93343,7 +93678,7 @@ function MarkdownCommand() {
93343
93678
 
93344
93679
  // src/domains/document/mock/index.ts
93345
93680
  import as18 from "ansis";
93346
- import { Command as Command22 } from "commander";
93681
+ import { Command as Command23 } from "commander";
93347
93682
 
93348
93683
  // src/domains/document/mock/helpers.ts
93349
93684
  import { serve } from "@hono/node-server";
@@ -93413,7 +93748,7 @@ function getMethodColor(method) {
93413
93748
 
93414
93749
  // src/domains/document/mock/index.ts
93415
93750
  function MockCommand() {
93416
- const cmd2 = new Command22("mock");
93751
+ const cmd2 = new Command23("mock");
93417
93752
  cmd2.description("Mock an API from an OpenAPI file");
93418
93753
  cmd2.argument("[file|url]", "OpenAPI file or URL to mock the server for");
93419
93754
  cmd2.option("-w, --watch", "watch the file for changes");
@@ -93424,7 +93759,7 @@ function MockCommand() {
93424
93759
  let server;
93425
93760
  const result = await loadOpenApiFile(fileArgument);
93426
93761
  if (!result.valid) {
93427
- return output.error().title("Invalid OpenAPI specification").exit("error");
93762
+ return output.error().title("Invalid OpenAPI document").exit("error");
93428
93763
  }
93429
93764
  printSpecificationBanner({
93430
93765
  version: result.version,
@@ -93473,12 +93808,12 @@ function MockCommand() {
93473
93808
 
93474
93809
  // src/domains/document/postman/index.ts
93475
93810
  var import_yaml4 = __toESM(require_dist(), 1);
93476
- import fs9 from "node:fs";
93811
+ import fs10 from "node:fs";
93477
93812
  import as19 from "ansis";
93478
- import { Command as Command23 } from "commander";
93813
+ import { Command as Command24 } from "commander";
93479
93814
  import { convert } from "@scalar/postman-to-openapi";
93480
93815
  function ConvertCommand() {
93481
- const cmd2 = new Command23("convert");
93816
+ const cmd2 = new Command24("convert");
93482
93817
  cmd2.description("Convert a Postman collection to an OpenAPI document");
93483
93818
  cmd2.argument("[file|url]", "Postman collection file path or URL to convert");
93484
93819
  cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
@@ -93506,7 +93841,7 @@ function ConvertCommand() {
93506
93841
  }
93507
93842
  const openApiDocument = outputPath ? isYamlFileName(outputPath) ? import_yaml4.default.stringify(specification) : JSON.stringify(specification, null, 2) : JSON.stringify(specification, null, 2);
93508
93843
  if (outputPath) {
93509
- fs9.writeFileSync(outputPath, openApiDocument, "utf8");
93844
+ fs10.writeFileSync(outputPath, openApiDocument, "utf8");
93510
93845
  const endTime = performance.now();
93511
93846
  output.info().line(
93512
93847
  `${as19.green("OpenAPI document generated")} ${as19.grey(
@@ -93525,11 +93860,11 @@ function ConvertCommand() {
93525
93860
  // src/domains/document/serve/index.ts
93526
93861
  import { serve as serve2 } from "@hono/node-server";
93527
93862
  import as20 from "ansis";
93528
- import { Command as Command24 } from "commander";
93863
+ import { Command as Command25 } from "commander";
93529
93864
  import { Hono } from "hono";
93530
93865
  import { stream } from "hono/streaming";
93531
93866
  function ServeCommand() {
93532
- const cmd2 = new Command24("serve");
93867
+ const cmd2 = new Command25("serve");
93533
93868
  cmd2.description("Serve an API Reference from an OpenAPI file");
93534
93869
  cmd2.argument("[file|url]", "OpenAPI file or URL to show the reference for");
93535
93870
  cmd2.option("-w, --watch", "watch the file for changes");
@@ -93648,9 +93983,9 @@ var getHtmlDocument = (specification, watch = false) => {
93648
93983
 
93649
93984
  // src/domains/document/share/index.ts
93650
93985
  import as21 from "ansis";
93651
- import { Command as Command25 } from "commander";
93986
+ import { Command as Command26 } from "commander";
93652
93987
  function ShareCommand() {
93653
- const cmd2 = new Command25("share");
93988
+ const cmd2 = new Command26("share");
93654
93989
  cmd2.description("Share an OpenAPI file");
93655
93990
  cmd2.argument("[file]", "file to share");
93656
93991
  cmd2.option(
@@ -93709,13 +94044,13 @@ function ShareCommand() {
93709
94044
 
93710
94045
  // src/domains/document/upgrade/index.ts
93711
94046
  var import_yaml5 = __toESM(require_dist(), 1);
93712
- import fs10 from "node:fs/promises";
94047
+ import fs11 from "node:fs/promises";
93713
94048
  import { confirm as confirm2 } from "@clack/prompts";
93714
94049
  import as22 from "ansis";
93715
- import { Command as Command26 } from "commander";
94050
+ import { Command as Command27 } from "commander";
93716
94051
  import { normalize as normalize5, upgrade } from "@scalar/openapi-parser";
93717
94052
  function UpgradeCommand() {
93718
- const cmd2 = new Command26("upgrade");
94053
+ const cmd2 = new Command27("upgrade");
93719
94054
  cmd2.description("Upgrade OpenAPI document to version 3.1");
93720
94055
  cmd2.argument("[file|url]", "File or URL to validate");
93721
94056
  cmd2.option("-o, --output <file>", "Path to save the upgraded output file");
@@ -93744,7 +94079,7 @@ function UpgradeCommand() {
93744
94079
  () => upgrade(document2)
93745
94080
  );
93746
94081
  const isYaml = isYamlFileName(outputFileName);
93747
- await fs10.writeFile(
94082
+ await fs11.writeFile(
93748
94083
  outputFileName,
93749
94084
  isYaml ? import_yaml5.default.stringify(result.specification) : JSON.stringify(result.specification, null, 2)
93750
94085
  );
@@ -93757,13 +94092,13 @@ function UpgradeCommand() {
93757
94092
 
93758
94093
  // src/domains/document/validate/index.ts
93759
94094
  import as23 from "ansis";
93760
- import { Command as Command27 } from "commander";
94095
+ import { Command as Command28 } from "commander";
93761
94096
  import prettyjson from "prettyjson";
93762
94097
  import { bundle as bundle3 } from "@scalar/json-magic/bundle";
93763
94098
  import { fetchUrls as fetchUrls3, readFiles as readFiles3 } from "@scalar/json-magic/bundle/plugins/node";
93764
94099
  import { validate as validate2 } from "@scalar/openapi-parser";
93765
94100
  function ValidateCommand() {
93766
- const cmd2 = new Command27("validate");
94101
+ const cmd2 = new Command28("validate");
93767
94102
  cmd2.description("Validate an OpenAPI file");
93768
94103
  cmd2.argument("[file|url]", "File or URL to validate");
93769
94104
  cmd2.action(async (inputArgument) => {
@@ -93810,10 +94145,10 @@ function ValidateCommand() {
93810
94145
  // src/domains/document/void/index.ts
93811
94146
  import { serve as serve3 } from "@hono/node-server";
93812
94147
  import as24 from "ansis";
93813
- import { Command as Command28 } from "commander";
94148
+ import { Command as Command29 } from "commander";
93814
94149
  import { createVoidServer } from "@scalar/void-server";
93815
94150
  function VoidCommand() {
93816
- const cmd2 = new Command28("void");
94151
+ const cmd2 = new Command29("void");
93817
94152
  cmd2.description("Boot a server to mirror HTTP requests");
93818
94153
  cmd2.option("-o, --once", "run the server only once and exit after that");
93819
94154
  cmd2.option("-p, --port <port>", "set the HTTP port for the mock server");
@@ -93870,23 +94205,23 @@ var documentCommands = [
93870
94205
  LintCommand,
93871
94206
  UpgradeCommand
93872
94207
  ];
93873
- var documentDomain = new Command29("document");
94208
+ var documentDomain = new Command30("document");
93874
94209
  documentDomain.description("Manage local openapi file");
93875
94210
  documentCommands.forEach((command) => documentDomain.addCommand(command()));
93876
94211
  var document_default = documentDomain;
93877
94212
 
93878
94213
  // src/domains/project/index.ts
93879
- import { Command as Command37 } from "commander";
94214
+ import { Command as Command38 } from "commander";
93880
94215
 
93881
94216
  // src/domains/project/preview/index.ts
93882
94217
  import { text as text4 } from "@clack/prompts";
93883
- import as27 from "ansis";
93884
- import { Command as Command32 } from "commander";
94218
+ import as28 from "ansis";
94219
+ import { Command as Command33 } from "commander";
93885
94220
 
93886
94221
  // src/domains/project/check-config/index.ts
93887
- import fs12 from "node:fs";
93888
- import as25 from "ansis";
93889
- import { Command as Command30 } from "commander";
94222
+ import fs13 from "node:fs";
94223
+ import as26 from "ansis";
94224
+ import { Command as Command31 } from "commander";
93890
94225
 
93891
94226
  // ../../packages/helpers/dist/parse/parse.js
93892
94227
  var import_json5 = __toESM(require_lib(), 1);
@@ -93919,10 +94254,11 @@ function parseAnything(val, schema) {
93919
94254
  error: "Document does not match the schema",
93920
94255
  issues: result.error.issues
93921
94256
  };
93922
- } catch {
94257
+ } catch (error48) {
94258
+ const detail = error48 instanceof Error ? error48.message : String(error48);
93923
94259
  return {
93924
94260
  success: false,
93925
- error: `Could not parse a valid ${docType} document`,
94261
+ error: `Could not parse a valid ${docType} document: ${detail}`,
93926
94262
  data: null
93927
94263
  };
93928
94264
  }
@@ -94517,6 +94853,9 @@ var linkSchema2 = zod_default.object({
94517
94853
  var headerSpacerSchema = zod_default.object({
94518
94854
  type: zod_default.literal("spacer")
94519
94855
  });
94856
+ var headerVersionSelectorSchema = zod_default.object({
94857
+ type: zod_default.literal("version-selector").describe("Renders the version selector dropdown at this position in the header")
94858
+ });
94520
94859
  var headerItem = zod_default.discriminatedUnion("type", [
94521
94860
  linkSchema2,
94522
94861
  headerSpacerSchema
@@ -94529,7 +94868,8 @@ var headerGroupSchema = zod_default.object({
94529
94868
  });
94530
94869
  var headerItemSchema = zod_default.discriminatedUnion("type", [
94531
94870
  headerItem,
94532
- headerGroupSchema
94871
+ headerGroupSchema,
94872
+ headerVersionSelectorSchema
94533
94873
  ]);
94534
94874
 
94535
94875
  // ../../packages/scalar-config/dist/schema/navigation/navigation.js
@@ -94745,11 +95085,20 @@ function parseConfig(rawConfig) {
94745
95085
  try {
94746
95086
  const jsonConfigResult = parseAnything(rawConfig, zod_default.record(zod_default.string(), zod_default.unknown()));
94747
95087
  if (!jsonConfigResult.success)
94748
- return { success: false, error: jsonConfigResult.error };
95088
+ return {
95089
+ success: false,
95090
+ errorType: "parse",
95091
+ error: jsonConfigResult.error
95092
+ };
94749
95093
  const version3 = getConfigVersion(jsonConfigResult.data);
94750
95094
  const { success: success2, data: config3, error: error48 } = configVersionToSchemaMapping[version3].safeParse(jsonConfigResult.data);
94751
95095
  if (!success2) {
94752
- return { success: false, error: error48, version: version3 };
95096
+ return {
95097
+ success: false,
95098
+ errorType: "validation",
95099
+ error: error48,
95100
+ version: version3
95101
+ };
94753
95102
  }
94754
95103
  return {
94755
95104
  success: true,
@@ -94759,7 +95108,7 @@ function parseConfig(rawConfig) {
94759
95108
  }
94760
95109
  };
94761
95110
  } catch (error48) {
94762
- return { success: false, error: error48 };
95111
+ return { success: false, errorType: "parse", error: error48 };
94763
95112
  }
94764
95113
  }
94765
95114
 
@@ -95162,7 +95511,7 @@ function generateGuideHeader({ header, guides, invalidRefs, references, isGroup
95162
95511
  invalidRefs,
95163
95512
  references,
95164
95513
  isGroup: true
95165
- }).filter((item2) => item2.type !== "group")
95514
+ }).filter((item2) => item2.type !== "group" && item2.type !== "version-selector")
95166
95515
  });
95167
95516
  }
95168
95517
  if (item.type === "guide") {
@@ -95197,6 +95546,11 @@ function generateGuideHeader({ header, guides, invalidRefs, references, isGroup
95197
95546
  type: "spacer"
95198
95547
  });
95199
95548
  }
95549
+ if (item.type === "version-selector") {
95550
+ headerItems.push({
95551
+ type: "version-selector"
95552
+ });
95553
+ }
95200
95554
  });
95201
95555
  if (!isGroup && !headerItems.some((item) => item.type === "spacer")) {
95202
95556
  headerItems.push({
@@ -95441,7 +95795,7 @@ var wysiwygProjectToV2 = n.safeFn(({ project, invalidRefs, theme }) => {
95441
95795
  }, (originalError) => createError("FAILED_TO_CONVERT_WYSIWYG_TO_V2", originalError));
95442
95796
 
95443
95797
  // src/domains/project/helpers.ts
95444
- import fs11 from "node:fs";
95798
+ import fs12 from "node:fs";
95445
95799
  import path5 from "node:path";
95446
95800
  var DEFAULT_MARKDOWN_FILE_NAME = "docs-quickstart.md";
95447
95801
  var DEFAULT_OPENAPI_FILE_NAME = "docs-openapi.json";
@@ -95453,7 +95807,7 @@ function findConfig(searchPath) {
95453
95807
  return searchInDirectory(process.cwd());
95454
95808
  }
95455
95809
  const searchPathResolved = path5.resolve(searchPath);
95456
- const stat = fs11.statSync(searchPathResolved, { throwIfNoEntry: false });
95810
+ const stat = fs12.statSync(searchPathResolved, { throwIfNoEntry: false });
95457
95811
  if (!stat) {
95458
95812
  return null;
95459
95813
  }
@@ -95470,7 +95824,7 @@ function getCurrentFolderName() {
95470
95824
  }
95471
95825
  function searchInDirectory(directory) {
95472
95826
  try {
95473
- const entries = fs11.readdirSync(directory);
95827
+ const entries = fs12.readdirSync(directory);
95474
95828
  for (const entry of entries) {
95475
95829
  if (entry === CONFIG_FILE_NAME || entry.startsWith(`${CONFIG_FILE_NAME}.`)) {
95476
95830
  return path5.join(directory, entry);
@@ -95482,6 +95836,46 @@ function searchInDirectory(directory) {
95482
95836
  }
95483
95837
  }
95484
95838
 
95839
+ // src/domains/project/render-config-error.ts
95840
+ import as25 from "ansis";
95841
+ function renderConfigError(error48) {
95842
+ if (error48.type === "file-not-found") {
95843
+ return output.error().title("Scalar Configuration file not found").message(error48.inputPath).line(
95844
+ as25.grey(
95845
+ "Create a `scalar.config.json`, or pass the path to your configuration file as an argument."
95846
+ )
95847
+ ).exit("error");
95848
+ }
95849
+ if (error48.type === "parse-error") {
95850
+ const block2 = output.error().title("Invalid configuration file").message("Could not parse the Scalar Configuration file:").line(error48.filePath);
95851
+ if (error48.detail) {
95852
+ block2.message(error48.detail);
95853
+ }
95854
+ return block2.exit("error");
95855
+ }
95856
+ const block = output.error().title("The given Scalar Configuration is invalid").message(error48.filePath);
95857
+ const note = versionNote(error48.version);
95858
+ if (note) {
95859
+ block.line(note);
95860
+ }
95861
+ block.line("");
95862
+ for (const line of error48.prettyError.split("\n")) {
95863
+ block.line(line);
95864
+ }
95865
+ return block.exit("error");
95866
+ }
95867
+ function versionNote(version3) {
95868
+ if (version3 === ConfigVersion.V2) {
95869
+ return as25.grey("Validated as Scalar Configuration v2.0.0.");
95870
+ }
95871
+ if (version3 === ConfigVersion.V1) {
95872
+ return as25.grey(
95873
+ 'Validated as a legacy (V1) configuration. If this should be a v2 config, add a top-level `scalar: "2.0.0"` field.'
95874
+ );
95875
+ }
95876
+ return "";
95877
+ }
95878
+
95485
95879
  // src/domains/project/check-config/index.ts
95486
95880
  function readAndParseConfig(configPath) {
95487
95881
  const startTime = performance.now();
@@ -95496,15 +95890,28 @@ function readAndParseConfig(configPath) {
95496
95890
  }
95497
95891
  };
95498
95892
  }
95499
- const fileContent = fs12.readFileSync(file2, "utf-8");
95893
+ const fileContent = fs13.readFileSync(file2, "utf-8");
95500
95894
  const parseConfigResult = parseConfig(fileContent);
95501
95895
  if (!parseConfigResult.success) {
95896
+ if (parseConfigResult.errorType === "validation") {
95897
+ return {
95898
+ success: false,
95899
+ error: {
95900
+ type: "validation-error",
95901
+ message: "The given Scalar Configuration is invalid",
95902
+ filePath: file2,
95903
+ prettyError: external_exports.prettifyError(parseConfigResult.error),
95904
+ version: parseConfigResult.version
95905
+ }
95906
+ };
95907
+ }
95502
95908
  return {
95503
95909
  success: false,
95504
95910
  error: {
95505
95911
  type: "parse-error",
95506
95912
  message: "Could not parse the Scalar Configuration file",
95507
- filePath: file2
95913
+ filePath: file2,
95914
+ detail: typeof parseConfigResult.error === "string" ? parseConfigResult.error : parseConfigResult.error instanceof Error ? parseConfigResult.error.message : void 0
95508
95915
  }
95509
95916
  };
95510
95917
  }
@@ -95516,41 +95923,22 @@ function readAndParseConfig(configPath) {
95516
95923
  };
95517
95924
  }
95518
95925
  function CheckConfigCommand() {
95519
- const cmd2 = new Command30("check-config");
95926
+ const cmd2 = new Command31("check-config");
95520
95927
  cmd2.description("Check a Scalar Configuration file");
95521
95928
  cmd2.argument("[file]", "File to check");
95522
95929
  cmd2.action(async (inputArgument) => {
95523
95930
  const result = readAndParseConfig(inputArgument);
95524
95931
  if (result.success) {
95525
95932
  output.info().line(
95526
- `${as25.green("[SUCCESS]")} ${as25.green("The Scalar Configuration is valid:")} ${as25.green(result.filePath)}`
95933
+ `${as26.green("[SUCCESS]")} ${as26.green("The Scalar Configuration is valid:")} ${as26.green(result.filePath)}`
95527
95934
  ).line(
95528
- `${as25.green("Scalar Configuration validated")} ${as25.grey(
95529
- `in ${as25.white.bold(`${result.validationTime} ms`)}`
95935
+ `${as26.green("Scalar Configuration validated")} ${as26.grey(
95936
+ `in ${as26.white.bold(`${result.validationTime} ms`)}`
95530
95937
  )}
95531
95938
  `
95532
95939
  ).print();
95533
95940
  } else {
95534
- const error48 = result.error;
95535
- if (error48.type === "file-not-found") {
95536
- return output.error().title("Invalid configuration file").message("Could not find the Scalar Configuration file:").message(error48.inputPath).exit("error");
95537
- }
95538
- if (error48.type === "parse-error") {
95539
- return output.error().title("Invalid configuration file").line("Could not parse the Scalar Configuration file:").message(error48.filePath).exit("error");
95540
- }
95541
- if (error48.type === "validation-error") {
95542
- output.error().title("The given Scalar Configuration is invalid.").message(error48.filePath).print();
95543
- if (error48.issues) {
95544
- output.error().table(
95545
- error48.issues.map((issue2) => [
95546
- as25.yellow(`${issue2.path.join("/").trim() || "root"}:`),
95547
- issue2.message
95548
- ]),
95549
- { padding: 2 }
95550
- ).print();
95551
- }
95552
- return output.error().exit("error");
95553
- }
95941
+ renderConfigError(result.error);
95554
95942
  }
95555
95943
  });
95556
95944
  return cmd2;
@@ -95562,24 +95950,24 @@ import path7 from "node:path";
95562
95950
 
95563
95951
  // src/domains/project/download-isolate/index.ts
95564
95952
  import { execFile } from "node:child_process";
95565
- import fs13 from "node:fs/promises";
95953
+ import fs14 from "node:fs/promises";
95566
95954
  import os2 from "node:os";
95567
95955
  import path6 from "node:path";
95568
95956
  import { Readable } from "node:stream";
95569
95957
  import zlib from "node:zlib";
95570
- import { Command as Command31 } from "commander";
95958
+ import { Command as Command32 } from "commander";
95571
95959
  import tar from "tar-fs";
95572
95960
 
95573
95961
  // src/helpers/run-command.ts
95574
95962
  import { exec as exec2 } from "node:child_process";
95575
- import as26 from "ansis";
95963
+ import as27 from "ansis";
95576
95964
  async function runCommand(command, cwd2) {
95577
95965
  return new Promise((resolve, reject) => {
95578
95966
  const comm = exec2(command, { cwd: cwd2 });
95579
95967
  comm.stdout?.pipe(process.stdout);
95580
95968
  comm.stderr?.pipe(process.stderr);
95581
95969
  comm.on("error", (err) => {
95582
- as26.redBright(err.message);
95970
+ as27.redBright(err.message);
95583
95971
  reject(err);
95584
95972
  });
95585
95973
  comm.on("close", (code) => code === 0 ? resolve(true) : reject(code));
@@ -95591,7 +95979,7 @@ var ISOLATE_EXTRACTION_DIR = path6.join(os2.homedir(), ".scalar");
95591
95979
  var ISOLATE_DIR = path6.join(ISOLATE_EXTRACTION_DIR, "isolate");
95592
95980
  async function getExistingIsolateVersion() {
95593
95981
  try {
95594
- const packageJsonString = await fs13.readFile(
95982
+ const packageJsonString = await fs14.readFile(
95595
95983
  path6.join(ISOLATE_DIR, "package.json"),
95596
95984
  "utf8"
95597
95985
  );
@@ -95646,7 +96034,7 @@ Remove-Item $tempFile
95646
96034
  async function downloadIsolate() {
95647
96035
  const existingIsolateVersion = await getExistingIsolateVersion();
95648
96036
  if (config2.ssgDocsIsolateVersion === existingIsolateVersion) return;
95649
- await fs13.rm(ISOLATE_EXTRACTION_DIR, { force: true, recursive: true });
96037
+ await fs14.rm(ISOLATE_EXTRACTION_DIR, { force: true, recursive: true });
95650
96038
  const logger = output.info({ animate: true }).loader("Downloading docs isolate. This may take a minute...");
95651
96039
  const ISOLATE_URL = `${config2.cdnUrl}/isolates/${config2.ssgDocsIsolateVersion}-isolate.tar.gz`;
95652
96040
  if (process.platform === "win32") {
@@ -95663,7 +96051,7 @@ async function downloadIsolate() {
95663
96051
  logger.finish();
95664
96052
  }
95665
96053
  var DownloadIsolateCommand = () => {
95666
- const cmd2 = new Command31("download-isolate");
96054
+ const cmd2 = new Command32("download-isolate");
95667
96055
  cmd2.description("Download the docs isolate");
95668
96056
  cmd2.action(async () => {
95669
96057
  await downloadIsolate();
@@ -95721,7 +96109,7 @@ async function previewV2Project({
95721
96109
 
95722
96110
  // src/domains/project/preview/index.ts
95723
96111
  var PreviewCommand = () => {
95724
- const cmd2 = new Command32("preview");
96112
+ const cmd2 = new Command33("preview");
95725
96113
  cmd2.description("Preview scalar guides");
95726
96114
  cmd2.argument(
95727
96115
  "[config]",
@@ -95762,35 +96150,11 @@ var PreviewCommand = () => {
95762
96150
  });
95763
96151
  const parseConfigResult = readAndParseConfig(configPath);
95764
96152
  if (!parseConfigResult.success) {
95765
- const error48 = parseConfigResult.error;
95766
- if (error48.type === "file-not-found") {
95767
- if (Number.isNaN(_port)) {
95768
- return output.error().title("Invalid port").message("Please provide a valid port number").exit("error");
95769
- }
95770
- if (_port < 0 || _port > 65535) {
95771
- return output.error().title("Invalid port").message("Port number must be between 0 and 65535").exit("error");
95772
- }
95773
- }
95774
- if (error48.type === "parse-error") {
95775
- return output.error().title("Invalid configuration file").message("Could not parse the Scalar Configuration file:").message(error48.filePath).exit("error");
95776
- }
95777
- if (error48.type === "validation-error") {
95778
- output.error().title("The given Scalar Configuration is invalid.").message(error48.filePath).print();
95779
- if (error48.issues) {
95780
- output.error().table(
95781
- error48.issues.map((issue2) => [
95782
- as27.yellow(`${issue2.path.join("/").trim() || "root"}:`),
95783
- issue2.message
95784
- ]),
95785
- { padding: 2 }
95786
- ).print();
95787
- }
95788
- }
95789
- return output.error().exit("error");
96153
+ renderConfigError(parseConfigResult.error);
95790
96154
  }
95791
96155
  if (parseConfigResult.success) {
95792
96156
  output.info().line(
95793
- `${as27.green("[SUCCESS]")} ${as27.green("Configuration is valid:")} ${as27.green(parseConfigResult.filePath)}`
96157
+ `${as28.green("[SUCCESS]")} ${as28.green("Configuration is valid:")} ${as28.green(parseConfigResult.filePath)}`
95794
96158
  ).print();
95795
96159
  }
95796
96160
  const { config: config3 } = parseConfigResult;
@@ -95813,10 +96177,10 @@ var PreviewCommand = () => {
95813
96177
 
95814
96178
  // src/domains/project/create/index.ts
95815
96179
  import { text as text5 } from "@clack/prompts";
95816
- import as28 from "ansis";
95817
- import { Command as Command33 } from "commander";
96180
+ import as29 from "ansis";
96181
+ import { Command as Command34 } from "commander";
95818
96182
  var CreateCommand = () => {
95819
- const cmd2 = new Command33("create");
96183
+ const cmd2 = new Command34("create");
95820
96184
  cmd2.description(
95821
96185
  "Create a new project that is not linked to a github project."
95822
96186
  );
@@ -95853,19 +96217,19 @@ var CreateCommand = () => {
95853
96217
  }
95854
96218
  logger.update("loader", 0, { content: "Project created successfully!" });
95855
96219
  logger.message(
95856
- `Project uid: ${as28.cyan(response.data.uid)}
95857
- Project slug: ${as28.cyan(response.data.slug)}`
96220
+ `Project uid: ${as29.cyan(response.data.uid)}
96221
+ Project slug: ${as29.cyan(response.data.slug)}`
95858
96222
  ).exit("success");
95859
96223
  });
95860
96224
  return cmd2;
95861
96225
  };
95862
96226
 
95863
96227
  // src/domains/project/init/index.ts
95864
- import fs14 from "node:fs/promises";
96228
+ import fs15 from "node:fs/promises";
95865
96229
  import path8 from "node:path";
95866
96230
  import { cancel, confirm as confirm3, isCancel, text as text6 } from "@clack/prompts";
95867
- import as29 from "ansis";
95868
- import { Command as Command34 } from "commander";
96231
+ import as30 from "ansis";
96232
+ import { Command as Command35 } from "commander";
95869
96233
 
95870
96234
  // ../../node_modules/.pnpm/@scalar+galaxy@0.6.7/node_modules/@scalar/galaxy/dist/3.1.json
95871
96235
  var __default = {
@@ -97823,14 +98187,14 @@ We're here to help:
97823
98187
  // src/domains/project/init/index.ts
97824
98188
  async function fileExists2(path13) {
97825
98189
  try {
97826
- await fs14.access(path13, fs14.constants.F_OK);
98190
+ await fs15.access(path13, fs15.constants.F_OK);
97827
98191
  return true;
97828
98192
  } catch {
97829
98193
  return false;
97830
98194
  }
97831
98195
  }
97832
98196
  var InitCommand = () => {
97833
- const cmd2 = new Command34("init");
98197
+ const cmd2 = new Command35("init");
97834
98198
  cmd2.description("Create a new Scalar Docs project.");
97835
98199
  cmd2.option("-s, --subdomain [url]", "subdomain to publish on");
97836
98200
  cmd2.option("--force", "override existing configuration");
@@ -97839,14 +98203,14 @@ var InitCommand = () => {
97839
98203
  let validInput;
97840
98204
  const nextSteps = () => {
97841
98205
  output.info().line("What to do next:").line(
97842
- ` ${as29.cyan("scalar project preview")} to preview your project locally`
98206
+ ` ${as30.cyan("scalar project preview")} to preview your project locally`
97843
98207
  ).line(
97844
- ` ${as29.cyan("scalar project check-config")} to validate your scalar.config.json file`
98208
+ ` ${as30.cyan("scalar project check-config")} to validate your scalar.config.json file`
97845
98209
  ).line(
97846
- ` ${as29.cyan("scalar project publish --slug")} ${as29.gray("[dashboard-project-slug]")} to publish your project`
98210
+ ` ${as30.cyan("scalar project publish --slug")} ${as30.gray("[dashboard-project-slug]")} to publish your project`
97847
98211
  ).line(
97848
- as29.white(
97849
- `Run ${as29.magenta("scalar --help")} to see all available commands.`
98212
+ as30.white(
98213
+ `Run ${as30.magenta("scalar --help")} to see all available commands.`
97850
98214
  )
97851
98215
  ).print();
97852
98216
  };
@@ -97857,10 +98221,10 @@ var InitCommand = () => {
97857
98221
  };
97858
98222
  if (await fileExists2(configFile)) {
97859
98223
  output.info().line(
97860
- `${as29.green("\u26A0")} Found existing configuration: ${as29.green.bold(`${configFile}`)}`
98224
+ `${as30.green("\u26A0")} Found existing configuration: ${as30.green.bold(`${configFile}`)}`
97861
98225
  ).print();
97862
98226
  if (force) {
97863
- output.info().line(`${as29.green("\u2714")} Overwriting existing file\u2026`).print();
98227
+ output.info().line(`${as30.green("\u2714")} Overwriting existing file\u2026`).print();
97864
98228
  }
97865
98229
  const shouldOverwriteExisting = force ?? await confirm3({
97866
98230
  message: "Do you want to override the file?",
@@ -97915,23 +98279,23 @@ var InitCommand = () => {
97915
98279
  const slug = slugify3(title);
97916
98280
  configuration.info = { title, description: `Documentation for ${title}` };
97917
98281
  subdomain = slug;
97918
- output.info().line(`${as29.green("\u2714")} Subdomain: ${as29.green(subdomain)}`).print();
98282
+ output.info().line(`${as30.green("\u2714")} Subdomain: ${as30.green(subdomain)}`).print();
97919
98283
  }
97920
98284
  configuration.siteConfig.subdomain = subdomain.trim();
97921
98285
  const content = JSON.stringify(configuration, null, 2);
97922
- await fs14.writeFile(configFile, content);
97923
- await fs14.writeFile(
98286
+ await fs15.writeFile(configFile, content);
98287
+ await fs15.writeFile(
97924
98288
  path8.join(currentDir, DEFAULT_MARKDOWN_FILE_NAME),
97925
98289
  quickstartMarkdown
97926
98290
  );
97927
- await fs14.writeFile(
98291
+ await fs15.writeFile(
97928
98292
  path8.join(currentDir, DEFAULT_OPENAPI_FILE_NAME),
97929
98293
  JSON.stringify(__default, null, 2)
97930
98294
  );
97931
- output.info().line(`${as29.green("\u2714")} Configuration stored.
97932
- `).line(`${as29.green.bold(`${configFile}`)}
98295
+ output.info().line(`${as30.green("\u2714")} Configuration stored.
98296
+ `).line(`${as30.green.bold(`${configFile}`)}
97933
98297
  `).line(
97934
- `${as29.grey(
98298
+ `${as30.grey(
97935
98299
  content.split("\n").map((line) => ` ${line}`).join("\n")
97936
98300
  )}`
97937
98301
  ).print();
@@ -97941,12 +98305,11 @@ var InitCommand = () => {
97941
98305
  };
97942
98306
 
97943
98307
  // src/domains/project/publish/index.ts
97944
- import fs16 from "node:fs";
97945
98308
  import { dirname } from "node:path";
97946
- import { Command as Command35 } from "commander";
98309
+ import { Command as Command36 } from "commander";
97947
98310
 
97948
98311
  // src/domains/project/publish/publish.ts
97949
- import fs15 from "node:fs";
98312
+ import fs16 from "node:fs";
97950
98313
  import path9 from "node:path";
97951
98314
  import { Readable as Readable2 } from "node:stream";
97952
98315
  import ignore from "ignore";
@@ -97957,7 +98320,7 @@ function isErrnoException(error48) {
97957
98320
  }
97958
98321
  async function readGitIgnore(configDir) {
97959
98322
  try {
97960
- const gitignore = await fs15.promises.readFile(
98323
+ const gitignore = await fs16.promises.readFile(
97961
98324
  path9.resolve(configDir, ".gitignore"),
97962
98325
  "utf8"
97963
98326
  );
@@ -98069,7 +98432,7 @@ var sleep = (ms) => {
98069
98432
 
98070
98433
  // src/domains/project/publish/index.ts
98071
98434
  var PublishCommand = () => {
98072
- const cmd2 = new Command35("publish");
98435
+ const cmd2 = new Command36("publish");
98073
98436
  cmd2.description(
98074
98437
  "Publish new build for a github sync project that is not linked."
98075
98438
  );
@@ -98149,19 +98512,13 @@ var PublishCommand = () => {
98149
98512
  publishUid: publishResult2.publishUid
98150
98513
  });
98151
98514
  }
98152
- const configPath = configPathOption ?? findConfig();
98153
- if (!configPath || !fs16.existsSync(configPath)) {
98154
- return output.error().title("Invalid configuration file").message("Could not find the Scalar Configuration file:").message(configPath ?? "").exit("error");
98155
- }
98156
- const rawConfig = fs16.readFileSync(configPath, "utf-8");
98157
- const configParseResult = parseConfig(rawConfig);
98158
- if (!configParseResult.success) {
98159
- return output.error().title("Invalid configuration file").line(
98160
- "Please check your scalar configuration file to match the specification."
98161
- ).message(configPath).exit("error");
98515
+ const configResult = readAndParseConfig(configPathOption ?? "");
98516
+ if (!configResult.success) {
98517
+ renderConfigError(configResult.error);
98162
98518
  }
98519
+ const { config: config3, filePath: configPath } = configResult;
98163
98520
  const publishResult = await publishProject({
98164
- config: configParseResult.config,
98521
+ config: config3,
98165
98522
  slug,
98166
98523
  configDir: dirname(configPath),
98167
98524
  configPath,
@@ -98240,8 +98597,8 @@ async function getDeployStatus({
98240
98597
  import fs17 from "node:fs/promises";
98241
98598
  import path10 from "node:path";
98242
98599
  import { text as text7 } from "@clack/prompts";
98243
- import as30 from "ansis";
98244
- import { Command as Command36 } from "commander";
98600
+ import as31 from "ansis";
98601
+ import { Command as Command37 } from "commander";
98245
98602
  import { n as n2 } from "neverpanic";
98246
98603
 
98247
98604
  // src/errors.ts
@@ -98270,7 +98627,7 @@ function displayError(error48, fallback = "Unknown error occurred. Please contac
98270
98627
 
98271
98628
  // src/domains/project/upgrade/index.ts
98272
98629
  var UpgradeCommand2 = () => {
98273
- const cmd2 = new Command36("upgrade");
98630
+ const cmd2 = new Command37("upgrade");
98274
98631
  cmd2.description("Upgrade scalar project");
98275
98632
  cmd2.argument(
98276
98633
  "[config]",
@@ -98284,30 +98641,11 @@ var UpgradeCommand2 = () => {
98284
98641
  });
98285
98642
  const parseConfigResult = readAndParseConfig(configPath);
98286
98643
  if (!parseConfigResult.success) {
98287
- const error48 = parseConfigResult.error;
98288
- if (error48.type === "file-not-found") {
98289
- return output.error().title("Scalar configuration could not be found").message("Could not parse the Scalar Configuration file:").message(error48.inputPath).exit("error");
98290
- }
98291
- if (error48.type === "parse-error") {
98292
- return output.error().title("Invalid configuration file").message("Could not parse the Scalar Configuration file:").message(error48.filePath).exit("error");
98293
- }
98294
- if (error48.type === "validation-error") {
98295
- output.error().title("The given Scalar Configuration is invalid.").message(error48.filePath).print();
98296
- if (error48.issues) {
98297
- output.error().table(
98298
- error48.issues.map((issue2) => [
98299
- as30.yellow(`${issue2.path.join("/").trim() || "root"}:`),
98300
- issue2.message
98301
- ]),
98302
- { padding: 2 }
98303
- ).print();
98304
- }
98305
- }
98306
- return output.error().exit("error");
98644
+ renderConfigError(parseConfigResult.error);
98307
98645
  }
98308
98646
  if (parseConfigResult.success) {
98309
98647
  output.info().line(
98310
- `${as30.green("[SUCCESS]")} ${as30.green("Configuration is valid:")} ${as30.green(parseConfigResult.filePath)}`
98648
+ `${as31.green("[SUCCESS]")} ${as31.green("Configuration is valid:")} ${as31.green(parseConfigResult.filePath)}`
98311
98649
  ).print();
98312
98650
  }
98313
98651
  const { config: config3 } = parseConfigResult;
@@ -98396,19 +98734,19 @@ var projectCommands = [
98396
98734
  PublishCommand,
98397
98735
  UpgradeCommand2
98398
98736
  ];
98399
- var projectDomain = new Command37("project");
98737
+ var projectDomain = new Command38("project");
98400
98738
  projectDomain.description("Manage scalar project");
98401
98739
  projectCommands.forEach((command) => projectDomain.addCommand(command()));
98402
98740
  projectDomain.addCommand(DownloadIsolateCommand(), { hidden: true });
98403
98741
  var project_default = projectDomain;
98404
98742
 
98405
98743
  // src/domains/readme/index.ts
98406
- import { Command as Command39 } from "commander";
98744
+ import { Command as Command40 } from "commander";
98407
98745
 
98408
98746
  // src/domains/readme/generate.ts
98409
98747
  import { text as text8 } from "@clack/prompts";
98410
- import as31 from "ansis";
98411
- import { Command as Command38 } from "commander";
98748
+ import as32 from "ansis";
98749
+ import { Command as Command39 } from "commander";
98412
98750
 
98413
98751
  // src/helpers/documentation/index.ts
98414
98752
  import fs18 from "node:fs/promises";
@@ -98455,7 +98793,7 @@ var generateDocumentationFile = async (outputPath) => {
98455
98793
 
98456
98794
  // src/domains/readme/generate.ts
98457
98795
  function GenerateReadmeCommand() {
98458
- const cmd2 = new Command38("generate");
98796
+ const cmd2 = new Command39("generate");
98459
98797
  cmd2.description("Self generate documentation for the cli");
98460
98798
  cmd2.option(
98461
98799
  "-o, --output [file]",
@@ -98480,8 +98818,8 @@ function GenerateReadmeCommand() {
98480
98818
  const { executionTimeMs } = await measureTime(
98481
98819
  () => generateDocumentationFile(outputPath)
98482
98820
  );
98483
- output.info().line().title(as31.green("Documentation Generated Successfully! \u{1F389}")).line().message(`\u2728 Documentation has been generated at: ${as31.blue(outputPath)}`).line(
98484
- `\u23F1\uFE0F Generation completed in ${as31.yellow(executionTimeMs.toFixed(2))}ms`
98821
+ output.info().line().title(as32.green("Documentation Generated Successfully! \u{1F389}")).line().message(`\u2728 Documentation has been generated at: ${as32.blue(outputPath)}`).line(
98822
+ `\u23F1\uFE0F Generation completed in ${as32.yellow(executionTimeMs.toFixed(2))}ms`
98485
98823
  ).line("").exit("success");
98486
98824
  });
98487
98825
  return cmd2;
@@ -98490,7 +98828,7 @@ function GenerateReadmeCommand() {
98490
98828
  // src/domains/readme/serve.ts
98491
98829
  import fs19 from "node:fs/promises";
98492
98830
  import path12 from "node:path";
98493
- import as32 from "ansis";
98831
+ import as33 from "ansis";
98494
98832
  var fileExists3 = async (filePath) => {
98495
98833
  try {
98496
98834
  await fs19.access(filePath);
@@ -98512,29 +98850,29 @@ function ServeReadmeCommand(cmd2) {
98512
98850
  openBrowser(docsUrl);
98513
98851
  output.info().message(
98514
98852
  "Documentation is being opened in your default browser. If it does not open automatically, please visit the following URL:"
98515
- ).line(as32.blue(docsUrl)).line().exit("success");
98853
+ ).line(as33.blue(docsUrl)).line().exit("success");
98516
98854
  });
98517
98855
  return cmd2;
98518
98856
  }
98519
98857
 
98520
98858
  // src/domains/readme/index.ts
98521
- var readmeDomain = new Command39("readme");
98859
+ var readmeDomain = new Command40("readme");
98522
98860
  readmeDomain.addCommand(GenerateReadmeCommand());
98523
98861
  ServeReadmeCommand(readmeDomain);
98524
98862
  var readme_default = readmeDomain;
98525
98863
 
98526
98864
  // src/domains/registry/index.ts
98527
- import { Command as Command45 } from "commander";
98865
+ import { Command as Command46 } from "commander";
98528
98866
 
98529
98867
  // src/domains/registry/publish/index.ts
98530
98868
  import { text as text9 } from "@clack/prompts";
98531
- import as33 from "ansis";
98532
- import { Command as Command40 } from "commander";
98869
+ import as34 from "ansis";
98870
+ import { Command as Command41 } from "commander";
98533
98871
  import { bundle as bundle4 } from "@scalar/json-magic/bundle";
98534
98872
  import { fetchUrls as fetchUrls4, readFiles as readFiles4 } from "@scalar/json-magic/bundle/plugins/node";
98535
98873
  import { parseJsonOrYaml as parseJsonOrYaml2 } from "@scalar/oas-utils/helpers";
98536
98874
  var PublishCommand2 = () => {
98537
- const cmd2 = new Command40("publish");
98875
+ const cmd2 = new Command41("publish");
98538
98876
  cmd2.description("Publish an OpenAPI document to the Scalar registry");
98539
98877
  cmd2.argument("[file]", "OpenAPI file to upload");
98540
98878
  cmd2.option(
@@ -98671,15 +99009,15 @@ var PublishCommand2 = () => {
98671
99009
  RegistryAsset2.Apis,
98672
99010
  matchingApi?.uid ?? publishRes.data.uid
98673
99011
  );
98674
- output.info().line(`${as33.green("\u279C")} ${as33.white.bold("View in dashboard:")}`).line(as33.cyan(apiUrl)).line().line(`${as33.green("\u279C")} ${as33.white.bold("Registry Preview:")}`).line(as33.cyan(registryUrl(api.url({ version: version3 })))).line().line(`${as33.green("\u279C")} ${as33.white.bold("Registry YAML:")}`).line(as33.cyan(registryUrl(api.url({ version: version3, format: "yaml" })))).line().line(`${as33.green("\u279C")} ${as33.white.bold("Registry JSON:")}`).line(as33.cyan(registryUrl(api.url({ version: version3, format: "json" })))).print();
99012
+ output.info().line(`${as34.green("\u279C")} ${as34.white.bold("View in dashboard:")}`).line(as34.cyan(apiUrl)).line().line(`${as34.green("\u279C")} ${as34.white.bold("Registry Preview:")}`).line(as34.cyan(registryUrl(api.url({ version: version3 })))).line().line(`${as34.green("\u279C")} ${as34.white.bold("Registry YAML:")}`).line(as34.cyan(registryUrl(api.url({ version: version3, format: "yaml" })))).line().line(`${as34.green("\u279C")} ${as34.white.bold("Registry JSON:")}`).line(as34.cyan(registryUrl(api.url({ version: version3, format: "json" })))).print();
98675
99013
  });
98676
99014
  return cmd2;
98677
99015
  };
98678
99016
 
98679
99017
  // src/domains/registry/delete/index.ts
98680
- import { Command as Command41 } from "commander";
99018
+ import { Command as Command42 } from "commander";
98681
99019
  var DeleteCommand = () => {
98682
- const cmd2 = new Command41("delete");
99020
+ const cmd2 = new Command42("delete");
98683
99021
  cmd2.description("Delete a document from scalar registry");
98684
99022
  cmd2.argument("[namespace]", "Team namespace");
98685
99023
  cmd2.argument("[slug]", "Managed doc slug");
@@ -98696,11 +99034,11 @@ var DeleteCommand = () => {
98696
99034
  };
98697
99035
 
98698
99036
  // src/domains/registry/get/index.ts
98699
- import fs20 from "node:fs";
98700
- import { Command as Command42 } from "commander";
98701
- var versionSchema3 = external_exports.union([docVersionSchema, external_exports.literal("latest")]);
99037
+ import fs20 from "node:fs/promises";
99038
+ import { Command as Command43 } from "commander";
99039
+ var versionSchema4 = external_exports.union([docVersionSchema, external_exports.literal("latest")]);
98702
99040
  var GetCommand = () => {
98703
- const cmd2 = new Command42("get");
99041
+ const cmd2 = new Command43("get");
98704
99042
  cmd2.description("Get a document version from scalar registry");
98705
99043
  cmd2.argument("[namespace]", "Team namespace");
98706
99044
  cmd2.argument("[slug]", "Managed doc slug");
@@ -98717,7 +99055,7 @@ var GetCommand = () => {
98717
99055
  return;
98718
99056
  }
98719
99057
  const result = external_exports.object({
98720
- version: versionSchema3,
99058
+ version: versionSchema4,
98721
99059
  format: external_exports.enum(["json", "yaml"]),
98722
99060
  output: external_exports.string().min(1).optional()
98723
99061
  }).safeParse({
@@ -98731,38 +99069,28 @@ var GetCommand = () => {
98731
99069
  }
98732
99070
  const auth = await getAuthData();
98733
99071
  auth.addEventListener((state) => Object.assign(auth, state));
98734
- const registryDocumentUrl = registryUrl(
99072
+ const fetchResult = await fetchFromRegistry(
98735
99073
  registry2(namespace).apis(slug).url({
98736
99074
  version: result.data.version,
98737
99075
  format: result.data.format
98738
- })
99076
+ }),
99077
+ auth.accessToken
98739
99078
  );
98740
- let getDocument;
98741
- try {
98742
- getDocument = await fetch(registryDocumentUrl, {
98743
- headers: {
98744
- "x-scalar-auth": auth.accessToken
98745
- },
98746
- // Should always error on redirect
98747
- redirect: "error"
98748
- });
98749
- } catch (error48) {
98750
- const message = error48 instanceof Error && error48.message.length > 0 ? error48.message : "Registry request failed before a response was received.";
98751
- output.error().title("Unable to download document").message(message).exit("error");
99079
+ if (fetchResult.error) {
99080
+ output.error().title("Unable to download document").message(fetchResult.message).exit("error");
98752
99081
  return;
98753
99082
  }
98754
- if (!getDocument.ok) {
98755
- const message = await getDocument.text();
98756
- output.error().title("Unable to download document").message(
98757
- message.length ? message : `Registry request failed with status ${getDocument.status}.`
98758
- ).exit("error");
98759
- return;
98760
- }
98761
- const document2 = await getDocument.text();
99083
+ const document2 = fetchResult.data;
98762
99084
  const withTrailingNewline = document2.endsWith("\n") ? document2 : `${document2}
98763
99085
  `;
98764
99086
  if (result.data.output) {
98765
- fs20.writeFileSync(result.data.output, withTrailingNewline, "utf8");
99087
+ try {
99088
+ await fs20.writeFile(result.data.output, withTrailingNewline, "utf8");
99089
+ } catch (error48) {
99090
+ const message = error48 instanceof Error && error48.message.length > 0 ? error48.message : `Could not write to ${result.data.output}.`;
99091
+ output.error().title("Unable to write document to file").message(message).exit("error");
99092
+ return;
99093
+ }
98766
99094
  output.info().line(
98767
99095
  `Downloaded ${namespace}/${slug}@${result.data.version} (${result.data.format})`
98768
99096
  ).line(`Written to ${result.data.output}`).print();
@@ -98774,10 +99102,10 @@ var GetCommand = () => {
98774
99102
  };
98775
99103
 
98776
99104
  // src/domains/registry/list/index.ts
98777
- import as34 from "ansis";
98778
- import { Command as Command43 } from "commander";
99105
+ import as35 from "ansis";
99106
+ import { Command as Command44 } from "commander";
98779
99107
  var ListCommand = () => {
98780
- const cmd2 = new Command43("list");
99108
+ const cmd2 = new Command44("list");
98781
99109
  cmd2.description("List all registry APIs for a team namespace");
98782
99110
  cmd2.option("--namespace <namespace>", "Team namespace");
98783
99111
  cmd2.action(async (args) => {
@@ -98813,17 +99141,17 @@ var ListCommand = () => {
98813
99141
  output.info().table(
98814
99142
  [
98815
99143
  [
98816
- as34.underline.bold("Slug"),
98817
- as34.underline.bold("Title"),
98818
- as34.underline.bold("Version"),
98819
- as34.underline.bold("Privacy")
99144
+ as35.underline.bold("Slug"),
99145
+ as35.underline.bold("Title"),
99146
+ as35.underline.bold("Version"),
99147
+ as35.underline.bold("Privacy")
98820
99148
  ],
98821
99149
  ...listApisRes.data.map((api) => {
98822
99150
  return [
98823
- as34.blue(api.slug),
98824
- as34.blue(api.title),
98825
- as34.blue(api.version),
98826
- api.isPrivate ? as34.green("Private") : as34.yellow("Public")
99151
+ as35.blue(api.slug),
99152
+ as35.blue(api.title),
99153
+ as35.blue(api.version),
99154
+ api.isPrivate ? as35.green("Private") : as35.yellow("Public")
98827
99155
  ];
98828
99156
  })
98829
99157
  ],
@@ -98835,10 +99163,10 @@ var ListCommand = () => {
98835
99163
 
98836
99164
  // src/domains/registry/update/index.ts
98837
99165
  import { text as text10 } from "@clack/prompts";
98838
- import as35 from "ansis";
98839
- import { Command as Command44 } from "commander";
99166
+ import as36 from "ansis";
99167
+ import { Command as Command45 } from "commander";
98840
99168
  var UpdateCommand = () => {
98841
- const cmd2 = new Command44("update");
99169
+ const cmd2 = new Command45("update");
98842
99170
  cmd2.description("Update document metadata on scalar registry");
98843
99171
  cmd2.argument("[namespace]", "namespace of document you want to update");
98844
99172
  cmd2.argument("[slug]", "slug of document you want to update");
@@ -98857,12 +99185,12 @@ var UpdateCommand = () => {
98857
99185
  const shouldPrompt = ![title, description].some((it) => it !== void 0);
98858
99186
  if (!titleValue && shouldPrompt) {
98859
99187
  titleValue = await text10({
98860
- message: `What is the new title of your document? ${as35.grey("(Optional)")}`
99188
+ message: `What is the new title of your document? ${as36.grey("(Optional)")}`
98861
99189
  });
98862
99190
  }
98863
99191
  if (!descriptionValue && shouldPrompt) {
98864
99192
  descriptionValue = await text10({
98865
- message: `What is the new description of your document? ${as35.grey("(Optional)")}`
99193
+ message: `What is the new description of your document? ${as36.grey("(Optional)")}`
98866
99194
  });
98867
99195
  }
98868
99196
  if (!titleValue && !descriptionValue) {
@@ -98892,17 +99220,17 @@ var registryCommands = [
98892
99220
  ListCommand,
98893
99221
  GetCommand
98894
99222
  ];
98895
- var registryDomain = new Command45("registry");
99223
+ var registryDomain = new Command46("registry");
98896
99224
  registryDomain.description("Manage your scalar registry");
98897
99225
  registryCommands.forEach((command) => registryDomain.addCommand(command()));
98898
99226
  var registry_default = registryDomain;
98899
99227
 
98900
99228
  // src/domains/team/index.ts
98901
- import { Command as Command48 } from "commander";
99229
+ import { Command as Command49 } from "commander";
98902
99230
 
98903
99231
  // src/domains/team/list/index.ts
98904
- import as36 from "ansis";
98905
- import { Command as Command46 } from "commander";
99232
+ import as37 from "ansis";
99233
+ import { Command as Command47 } from "commander";
98906
99234
 
98907
99235
  // src/domains/team/helpers.ts
98908
99236
  var getUserTeams = async (client, email3) => {
@@ -98917,7 +99245,7 @@ var getUserTeams = async (client, email3) => {
98917
99245
 
98918
99246
  // src/domains/team/list/index.ts
98919
99247
  var ListCommand2 = () => {
98920
- const cmd2 = new Command46("list");
99248
+ const cmd2 = new Command47("list");
98921
99249
  cmd2.description("List all teams current user is part of");
98922
99250
  cmd2.action(async () => {
98923
99251
  const auth = await getAuthData();
@@ -98930,7 +99258,7 @@ var ListCommand2 = () => {
98930
99258
  output.info().table(
98931
99259
  teams.data.map((it) => {
98932
99260
  const isCurrentTeam = it.teamUid === auth.teamUid;
98933
- const color = isCurrentTeam ? as36.green : as36.blue;
99261
+ const color = isCurrentTeam ? as37.green : as37.blue;
98934
99262
  const teamName = isCurrentTeam ? `${it.teamName} (default)` : it.teamName;
98935
99263
  return [isCurrentTeam ? color("\u279C") : " ", color(teamName)];
98936
99264
  }),
@@ -98942,10 +99270,10 @@ var ListCommand2 = () => {
98942
99270
 
98943
99271
  // src/domains/team/set/index.ts
98944
99272
  import { select as select7 } from "@clack/prompts";
98945
- import as37 from "ansis";
98946
- import { Command as Command47 } from "commander";
99273
+ import as38 from "ansis";
99274
+ import { Command as Command48 } from "commander";
98947
99275
  var SetCommand = () => {
98948
- const cmd2 = new Command47("set");
99276
+ const cmd2 = new Command48("set");
98949
99277
  cmd2.description("Set current active team for the user");
98950
99278
  cmd2.option("--team <team>", "Team uid");
98951
99279
  cmd2.action(async ({ team }) => {
@@ -98977,7 +99305,7 @@ var SetCommand = () => {
98977
99305
  }
98978
99306
  await refreshToken(auth.refreshToken, teamValue);
98979
99307
  output.info().message(
98980
- `Operation ${as37.green("successful")}. Selected team: ${as37.cyan(selectedTeam.teamName)}`
99308
+ `Operation ${as38.green("successful")}. Selected team: ${as38.cyan(selectedTeam.teamName)}`
98981
99309
  ).print();
98982
99310
  });
98983
99311
  return cmd2;
@@ -98985,18 +99313,18 @@ var SetCommand = () => {
98985
99313
 
98986
99314
  // src/domains/team/index.ts
98987
99315
  var teamCommands = [ListCommand2, SetCommand];
98988
- var teamDomain = new Command48("team");
99316
+ var teamDomain = new Command49("team");
98989
99317
  teamDomain.description("Manage user teams");
98990
99318
  teamCommands.forEach((command) => teamDomain.addCommand(command()));
98991
99319
  var team_default = teamDomain;
98992
99320
 
98993
99321
  // src/domains/upgrade/index.ts
98994
99322
  import { execSync } from "node:child_process";
98995
- import as39 from "ansis";
98996
- import { Command as Command49 } from "commander";
99323
+ import as40 from "ansis";
99324
+ import { Command as Command50 } from "commander";
98997
99325
 
98998
99326
  // src/helpers/upgrade.ts
98999
- import as38 from "ansis";
99327
+ import as39 from "ansis";
99000
99328
  import semver5 from "semver";
99001
99329
  var packageJsonSchema = external_exports.object({
99002
99330
  version: external_exports.string()
@@ -99024,7 +99352,7 @@ async function getUpgradeInformation() {
99024
99352
  }
99025
99353
  async function checkUpgrade() {
99026
99354
  const emitOutput = () => output.info().message(
99027
- `New version available! Run ${as38.cyan("`scalar upgrade`")} to install the latest version`
99355
+ `New version available! Run ${as39.cyan("`scalar upgrade`")} to install the latest version`
99028
99356
  ).print();
99029
99357
  const now = performance.now();
99030
99358
  const delay = 1 * 60 * 60 * 1e3;
@@ -99049,7 +99377,7 @@ async function checkUpgrade() {
99049
99377
  }
99050
99378
 
99051
99379
  // src/domains/upgrade/index.ts
99052
- var cmd = new Command49("upgrade");
99380
+ var cmd = new Command50("upgrade");
99053
99381
  cmd.description("Upgrade current version of your cli");
99054
99382
  cmd.action(async () => {
99055
99383
  const upgradeStatus = await getUpgradeInformation();
@@ -99066,7 +99394,7 @@ cmd.action(async () => {
99066
99394
  });
99067
99395
  output.info().message("Successfully upgraded to the latest version").print();
99068
99396
  } catch {
99069
- output.error().title("Upgrade failed").message("Failed to upgrade the CLI. Please try running:").message(as39.cyan(`npm install -g ${upgradeStatus.name}@latest`)).exit("error");
99397
+ output.error().title("Upgrade failed").message("Failed to upgrade the CLI. Please try running:").message(as40.cyan(`npm install -g ${upgradeStatus.name}@latest`)).exit("error");
99070
99398
  }
99071
99399
  });
99072
99400
  var upgrade_default = cmd;
@@ -99087,7 +99415,7 @@ var domains_default = domains;
99087
99415
 
99088
99416
  // src/program.ts
99089
99417
  var getProgram = () => {
99090
- const program2 = new Command50();
99418
+ const program2 = new Command51();
99091
99419
  program2.enablePositionalOptions().name(Object.keys(bin)[0]).description("CLI to work with your OpenAPI files").version(version, "-v, --version");
99092
99420
  program2.showHelpAfterError();
99093
99421
  domains_default.forEach((domain2) => program2.addCommand(domain2));