@temps-sdk/cli 0.1.34 → 0.1.36

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 (2) hide show
  1. package/dist/index.js +3373 -144
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -15312,6 +15312,7 @@ __export(exports_sdk_gen, {
15312
15312
  updateProject: () => updateProject,
15313
15313
  updatePreferences: () => updatePreferences,
15314
15314
  updateOidcProvider: () => updateOidcProvider,
15315
+ updateNotificationRoute: () => updateNotificationRoute,
15315
15316
  updateNotificationProvider: () => updateNotificationProvider,
15316
15317
  updateNotificationEmailProvider: () => updateNotificationEmailProvider,
15317
15318
  updateMcp: () => updateMcp,
@@ -15393,6 +15394,7 @@ __export(exports_sdk_gen, {
15393
15394
  setPreviewPassword: () => setPreviewPassword,
15394
15395
  setFlagEnvironment: () => setFlagEnvironment,
15395
15396
  setDefaultS3Source: () => setDefaultS3Source,
15397
+ setAlternateSources: () => setAlternateSources,
15396
15398
  setAiDataAccess: () => setAiDataAccess,
15397
15399
  sendMessage: () => sendMessage,
15398
15400
  sendFailureReport: () => sendFailureReport,
@@ -15414,6 +15416,7 @@ __export(exports_sdk_gen, {
15414
15416
  revokeProjectAccess: () => revokeProjectAccess,
15415
15417
  revokeJoinToken: () => revokeJoinToken,
15416
15418
  revokeEnrollmentToken: () => revokeEnrollmentToken,
15419
+ revokeEmailDomainProject: () => revokeEmailDomainProject,
15417
15420
  revokeDsn: () => revokeDsn,
15418
15421
  revenueUpdateSecret: () => revenueUpdateSecret,
15419
15422
  revenueUpdateConfig: () => revenueUpdateConfig,
@@ -15501,7 +15504,9 @@ __export(exports_sdk_gen, {
15501
15504
  oidcCallback: () => oidcCallback,
15502
15505
  observabilityListEvents: () => observabilityListEvents,
15503
15506
  observabilityFullEvent: () => observabilityFullEvent,
15507
+ nodeMetricsUpdateAlertRule: () => nodeMetricsUpdateAlertRule,
15504
15508
  nodeMetricsGetRange: () => nodeMetricsGetRange,
15509
+ nodeMetricsGetAlertRules: () => nodeMetricsGetAlertRules,
15505
15510
  nodeHeartbeat: () => nodeHeartbeat,
15506
15511
  mkdir: () => mkdir3,
15507
15512
  mintEnrollmentToken: () => mintEnrollmentToken,
@@ -15559,6 +15564,7 @@ __export(exports_sdk_gen, {
15559
15564
  listOidcRoleMappings: () => listOidcRoleMappings,
15560
15565
  listOidcProviders: () => listOidcProviders,
15561
15566
  listOidcProviderUsers: () => listOidcProviderUsers,
15567
+ listNotificationRoutes: () => listNotificationRoutes,
15562
15568
  listNotificationProviders: () => listNotificationProviders,
15563
15569
  listMonitors: () => listMonitors,
15564
15570
  listModels: () => listModels,
@@ -15590,6 +15596,7 @@ __export(exports_sdk_gen, {
15590
15596
  listEmails: () => listEmails,
15591
15597
  listEmailProviders: () => listEmailProviders,
15592
15598
  listEmailDomains: () => listEmailDomains,
15599
+ listEmailDomainProjects: () => listEmailDomainProjects,
15593
15600
  listDsns: () => listDsns,
15594
15601
  listDomains: () => listDomains,
15595
15602
  listDnsProviders: () => listDnsProviders,
@@ -15601,6 +15608,7 @@ __export(exports_sdk_gen, {
15601
15608
  listConversations: () => listConversations,
15602
15609
  listContainersAtPath: () => listContainersAtPath,
15603
15610
  listContainers: () => listContainers,
15611
+ listContainerHistory: () => listContainerHistory,
15604
15612
  listConnections: () => listConnections,
15605
15613
  listCommitsByRepositoryId: () => listCommitsByRepositoryId,
15606
15614
  listBackupsForSchedule: () => listBackupsForSchedule,
@@ -15763,6 +15771,7 @@ __export(exports_sdk_gen, {
15763
15771
  getPostgresWalHealth: () => getPostgresWalHealth,
15764
15772
  getPlatformInfo: () => getPlatformInfo,
15765
15773
  getPipelineStats: () => getPipelineStats,
15774
+ getPipelineHistory: () => getPipelineHistory,
15766
15775
  getPgUpgradeLogs: () => getPgUpgradeLogs,
15767
15776
  getPgUpgrade: () => getPgUpgrade,
15768
15777
  getPerformanceMetrics: () => getPerformanceMetrics,
@@ -15775,6 +15784,7 @@ __export(exports_sdk_gen, {
15775
15784
  getPageFlow: () => getPageFlow,
15776
15785
  getOrCreateDsn: () => getOrCreateDsn,
15777
15786
  getOnDemandCertStatus: () => getOnDemandCertStatus,
15787
+ getNotificationRoute: () => getNotificationRoute,
15778
15788
  getNotificationProvider: () => getNotificationProvider,
15779
15789
  getMonitor: () => getMonitor,
15780
15790
  getMetricsOverTime: () => getMetricsOverTime,
@@ -15783,10 +15793,12 @@ __export(exports_sdk_gen, {
15783
15793
  getLiveVisitorsList: () => getLiveVisitorsList,
15784
15794
  getLatestScansPerEnvironment: () => getLatestScansPerEnvironment,
15785
15795
  getLatestScan: () => getLatestScan,
15796
+ getLatestDeploymentMedia: () => getLatestDeploymentMedia,
15786
15797
  getLastDeployment: () => getLastDeployment,
15787
15798
  getJoinTokenStatus: () => getJoinTokenStatus,
15788
15799
  getIpGeolocation: () => getIpGeolocation,
15789
15800
  getIpAccessControl: () => getIpAccessControl,
15801
+ getIngestErrors: () => getIngestErrors,
15790
15802
  getIncidentUpdates: () => getIncidentUpdates,
15791
15803
  getIncident: () => getIncident,
15792
15804
  getImportStatus: () => getImportStatus,
@@ -15972,6 +15984,7 @@ __export(exports_sdk_gen, {
15972
15984
  deletePreferences: () => deletePreferences,
15973
15985
  deleteOidcRoleMapping: () => deleteOidcRoleMapping,
15974
15986
  deleteOidcProvider: () => deleteOidcProvider,
15987
+ deleteNotificationRoute: () => deleteNotificationRoute,
15975
15988
  deleteNotificationProvider: () => deleteNotificationProvider,
15976
15989
  deleteMonitor: () => deleteMonitor,
15977
15990
  deleteMcp: () => deleteMcp,
@@ -16024,6 +16037,7 @@ __export(exports_sdk_gen, {
16024
16037
  createOrRecreateOrder: () => createOrRecreateOrder,
16025
16038
  createOidcRoleMapping: () => createOidcRoleMapping,
16026
16039
  createOidcProvider: () => createOidcProvider,
16040
+ createNotificationRoute: () => createNotificationRoute,
16027
16041
  createNotificationProvider: () => createNotificationProvider,
16028
16042
  createNotificationEmailProvider: () => createNotificationEmailProvider,
16029
16043
  createMonitor: () => createMonitor,
@@ -16064,6 +16078,7 @@ __export(exports_sdk_gen, {
16064
16078
  cmdLogs: () => cmdLogs,
16065
16079
  cmdKill: () => cmdKill,
16066
16080
  cmd: () => cmd,
16081
+ clusterDnsStatus: () => clusterDnsStatus,
16067
16082
  cliLogout: () => cliLogout,
16068
16083
  cliDeviceStart: () => cliDeviceStart,
16069
16084
  cliDevicePoll: () => cliDevicePoll,
@@ -16101,6 +16116,7 @@ __export(exports_sdk_gen, {
16101
16116
  blobDisable: () => blobDisable,
16102
16117
  blobDelete: () => blobDelete,
16103
16118
  blobCopy: () => blobCopy,
16119
+ authorizeEmailDomainProject: () => authorizeEmailDomainProject,
16104
16120
  attachScheduleServices: () => attachScheduleServices,
16105
16121
  assignRole: () => assignRole,
16106
16122
  archiveFlag: () => archiveFlag,
@@ -16867,6 +16883,10 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
16867
16883
  security: [{ scheme: "bearer", type: "http" }],
16868
16884
  url: "/blob/{project_id}/{path}",
16869
16885
  ...options
16886
+ }), clusterDnsStatus = (options) => (options?.client ?? client).get({
16887
+ security: [{ scheme: "bearer", type: "http" }],
16888
+ url: "/cluster/dns/status",
16889
+ ...options
16870
16890
  }), getDashboardProjectsAnalytics = (options) => (options.client ?? client).get({
16871
16891
  security: [{ scheme: "bearer", type: "http" }],
16872
16892
  url: "/dashboard/projects-analytics",
@@ -16875,6 +16895,10 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
16875
16895
  security: [{ scheme: "bearer", type: "http" }],
16876
16896
  url: "/deployments/activity-graph",
16877
16897
  ...options
16898
+ }), getLatestDeploymentMedia = (options) => (options.client ?? client).get({
16899
+ security: [{ scheme: "bearer", type: "http" }],
16900
+ url: "/deployments/latest-media",
16901
+ ...options
16878
16902
  }), getScanByDeployment = (options) => (options.client ?? client).get({
16879
16903
  security: [{ scheme: "bearer", type: "http" }],
16880
16904
  url: "/deployments/{deployment_id}/vulnerability-scan",
@@ -16971,7 +16995,11 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
16971
16995
  security: [{ scheme: "bearer", type: "http" }],
16972
16996
  url: "/dns-providers/{provider_id}/domains/{domain}/verify",
16973
16997
  ...options
16974
- }), lookupDnsARecords = (options) => (options.client ?? client).get({ url: "/dns/lookup", ...options }), listDomains = (options) => (options?.client ?? client).get({
16998
+ }), lookupDnsARecords = (options) => (options.client ?? client).get({
16999
+ security: [{ scheme: "bearer", type: "http" }],
17000
+ url: "/dns/lookup",
17001
+ ...options
17002
+ }), listDomains = (options) => (options?.client ?? client).get({
16975
17003
  security: [{ scheme: "bearer", type: "http" }],
16976
17004
  url: "/domains",
16977
17005
  ...options
@@ -17088,6 +17116,18 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
17088
17116
  security: [{ scheme: "bearer", type: "http" }],
17089
17117
  url: "/email-domains/{id}/dns-records",
17090
17118
  ...options
17119
+ }), listEmailDomainProjects = (options) => (options.client ?? client).get({
17120
+ security: [{ scheme: "bearer", type: "http" }],
17121
+ url: "/email-domains/{id}/projects",
17122
+ ...options
17123
+ }), revokeEmailDomainProject = (options) => (options.client ?? client).delete({
17124
+ security: [{ scheme: "bearer", type: "http" }],
17125
+ url: "/email-domains/{id}/projects/{project_id}",
17126
+ ...options
17127
+ }), authorizeEmailDomainProject = (options) => (options.client ?? client).post({
17128
+ security: [{ scheme: "bearer", type: "http" }],
17129
+ url: "/email-domains/{id}/projects/{project_id}",
17130
+ ...options
17091
17131
  }), setupDns = (options) => (options.client ?? client).post({
17092
17132
  security: [{ scheme: "bearer", type: "http" }],
17093
17133
  url: "/email-domains/{id}/setup-dns",
@@ -17885,6 +17925,18 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
17885
17925
  security: [{ scheme: "bearer", type: "http" }],
17886
17926
  url: "/nodes/{id}/metrics",
17887
17927
  ...options
17928
+ }), nodeMetricsGetAlertRules = (options) => (options.client ?? client).get({
17929
+ security: [{ scheme: "bearer", type: "http" }],
17930
+ url: "/nodes/{id}/metrics/alert-rules",
17931
+ ...options
17932
+ }), nodeMetricsUpdateAlertRule = (options) => (options.client ?? client).patch({
17933
+ security: [{ scheme: "bearer", type: "http" }],
17934
+ url: "/nodes/{id}/metrics/alert-rules/{rule_id}",
17935
+ ...options,
17936
+ headers: {
17937
+ "Content-Type": "application/json",
17938
+ ...options.headers
17939
+ }
17888
17940
  }), deletePreferences = (options) => (options?.client ?? client).delete({
17889
17941
  security: [{ scheme: "bearer", type: "http" }],
17890
17942
  url: "/notification-preferences",
@@ -18001,6 +18053,34 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
18001
18053
  security: [{ scheme: "bearer", type: "http" }],
18002
18054
  url: "/notification-providers/{id}/test",
18003
18055
  ...options
18056
+ }), listNotificationRoutes = (options) => (options?.client ?? client).get({
18057
+ security: [{ scheme: "bearer", type: "http" }],
18058
+ url: "/notification-routes",
18059
+ ...options
18060
+ }), createNotificationRoute = (options) => (options.client ?? client).post({
18061
+ security: [{ scheme: "bearer", type: "http" }],
18062
+ url: "/notification-routes",
18063
+ ...options,
18064
+ headers: {
18065
+ "Content-Type": "application/json",
18066
+ ...options.headers
18067
+ }
18068
+ }), deleteNotificationRoute = (options) => (options.client ?? client).delete({
18069
+ security: [{ scheme: "bearer", type: "http" }],
18070
+ url: "/notification-routes/{id}",
18071
+ ...options
18072
+ }), getNotificationRoute = (options) => (options.client ?? client).get({
18073
+ security: [{ scheme: "bearer", type: "http" }],
18074
+ url: "/notification-routes/{id}",
18075
+ ...options
18076
+ }), updateNotificationRoute = (options) => (options.client ?? client).put({
18077
+ security: [{ scheme: "bearer", type: "http" }],
18078
+ url: "/notification-routes/{id}",
18079
+ ...options,
18080
+ headers: {
18081
+ "Content-Type": "application/json",
18082
+ ...options.headers
18083
+ }
18004
18084
  }), listOrders = (options) => (options?.client ?? client).get({
18005
18085
  security: [{ scheme: "bearer", type: "http" }],
18006
18086
  url: "/orders",
@@ -18109,6 +18189,10 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
18109
18189
  security: [{ scheme: "bearer", type: "http" }],
18110
18190
  url: "/otel/health/{project_id}",
18111
18191
  ...options
18192
+ }), getIngestErrors = (options) => (options?.client ?? client).get({
18193
+ security: [{ scheme: "bearer", type: "http" }],
18194
+ url: "/otel/ingest-errors",
18195
+ ...options
18112
18196
  }), listInsights = (options) => (options.client ?? client).get({
18113
18197
  security: [{ scheme: "bearer", type: "http" }],
18114
18198
  url: "/otel/insights/{project_id}",
@@ -18133,6 +18217,10 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
18133
18217
  security: [{ scheme: "bearer", type: "http" }],
18134
18218
  url: "/otel/metrics",
18135
18219
  ...options
18220
+ }), getPipelineHistory = (options) => (options?.client ?? client).get({
18221
+ security: [{ scheme: "bearer", type: "http" }],
18222
+ url: "/otel/pipeline-history",
18223
+ ...options
18136
18224
  }), getPipelineStats = (options) => (options?.client ?? client).get({
18137
18225
  security: [{ scheme: "bearer", type: "http" }],
18138
18226
  url: "/otel/pipeline-stats",
@@ -18323,6 +18411,14 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
18323
18411
  "Content-Type": "application/json",
18324
18412
  ...options.headers
18325
18413
  }
18414
+ }), setAlternateSources = (options) => (options.client ?? client).patch({
18415
+ security: [{ scheme: "bearer", type: "http" }],
18416
+ url: "/projects/{id}/alternate-sources",
18417
+ ...options,
18418
+ headers: {
18419
+ "Content-Type": "application/json",
18420
+ ...options.headers
18421
+ }
18326
18422
  }), getProjectDeployments = (options) => (options.client ?? client).get({ url: "/projects/{id}/deployments", ...options }), getLastDeployment = (options) => (options.client ?? client).get({ url: "/projects/{id}/last-deployment", ...options }), changeProjectSource = (options) => (options.client ?? client).patch({
18327
18423
  security: [{ scheme: "bearer", type: "http" }],
18328
18424
  url: "/projects/{id}/source",
@@ -18782,7 +18878,11 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
18782
18878
  "Content-Type": "application/json",
18783
18879
  ...options.headers
18784
18880
  }
18785
- }), teardownEnvironment = (options) => (options.client ?? client).delete({ url: "/projects/{project_id}/environments/{env_id}/teardown", ...options }), wakeEnvironment = (options) => (options.client ?? client).post({ url: "/projects/{project_id}/environments/{env_id}/wake", ...options }), getContainerLogs = (options) => (options.client ?? client).get({
18881
+ }), teardownEnvironment = (options) => (options.client ?? client).delete({ url: "/projects/{project_id}/environments/{env_id}/teardown", ...options }), wakeEnvironment = (options) => (options.client ?? client).post({ url: "/projects/{project_id}/environments/{env_id}/wake", ...options }), listContainerHistory = (options) => (options.client ?? client).get({
18882
+ security: [{ scheme: "bearer", type: "http" }],
18883
+ url: "/projects/{project_id}/environments/{environment_id}/container-history",
18884
+ ...options
18885
+ }), getContainerLogs = (options) => (options.client ?? client).get({
18786
18886
  security: [{ scheme: "bearer", type: "http" }],
18787
18887
  url: "/projects/{project_id}/environments/{environment_id}/container-logs",
18788
18888
  ...options
@@ -19789,10 +19889,14 @@ var getPlatformInfo = (options) => (options?.client ?? client).get({
19789
19889
  "Content-Type": "application/json",
19790
19890
  ...options.headers
19791
19891
  }
19792
- }), setupMfa = (options) => (options?.client ?? client).post({
19892
+ }), setupMfa = (options) => (options.client ?? client).post({
19793
19893
  security: [{ scheme: "bearer", type: "http" }],
19794
19894
  url: "/users/me/mfa/setup",
19795
- ...options
19895
+ ...options,
19896
+ headers: {
19897
+ "Content-Type": "application/json",
19898
+ ...options.headers
19899
+ }
19796
19900
  }), verifyAndEnableMfa = (options) => (options.client ?? client).post({
19797
19901
  security: [{ scheme: "bearer", type: "http" }],
19798
19902
  url: "/users/me/mfa/verify",
@@ -38579,10 +38683,12 @@ async function promptSearch(options) {
38579
38683
  pageSize: options.pageSize ?? 10,
38580
38684
  source: async (term) => {
38581
38685
  if (!term) {
38582
- return options.choices.slice(0, options.pageSize ?? 10);
38686
+ const head = options.choices.slice(0, options.pageSize ?? 10);
38687
+ const pinned = options.choices.filter((c) => c.alwaysShow && !head.includes(c));
38688
+ return [...head, ...pinned];
38583
38689
  }
38584
38690
  const searchTerm = term.toLowerCase();
38585
- return options.choices.filter((choice) => choice.name.toLowerCase().includes(searchTerm) || (choice.description?.toLowerCase() || "").includes(searchTerm));
38691
+ return options.choices.filter((choice) => choice.alwaysShow || choice.name.toLowerCase().includes(searchTerm) || (choice.description?.toLowerCase() || "").includes(searchTerm));
38586
38692
  },
38587
38693
  theme: {
38588
38694
  prefix: colors.primary("?")
@@ -75478,7 +75584,7 @@ var require_extension2 = __commonJS((exports, module) => {
75478
75584
  else
75479
75585
  dest[name].push(elem);
75480
75586
  }
75481
- function parse(header2) {
75587
+ function parse3(header2) {
75482
75588
  const offers = Object.create(null);
75483
75589
  let params = Object.create(null);
75484
75590
  let mustUnescape = false;
@@ -75616,7 +75722,7 @@ var require_extension2 = __commonJS((exports, module) => {
75616
75722
  }
75617
75723
  return offers;
75618
75724
  }
75619
- function format2(extensions) {
75725
+ function format3(extensions) {
75620
75726
  return Object.keys(extensions).map((extension) => {
75621
75727
  let configurations = extensions[extension];
75622
75728
  if (!Array.isArray(configurations))
@@ -75631,7 +75737,7 @@ var require_extension2 = __commonJS((exports, module) => {
75631
75737
  }).join(", ");
75632
75738
  }).join(", ");
75633
75739
  }
75634
- module.exports = { format: format2, parse };
75740
+ module.exports = { format: format3, parse: parse3 };
75635
75741
  });
75636
75742
 
75637
75743
  // node_modules/ws/lib/websocket.js
@@ -75642,7 +75748,7 @@ var require_websocket2 = __commonJS((exports, module) => {
75642
75748
  var net = __require("net");
75643
75749
  var tls = __require("tls");
75644
75750
  var { randomBytes, createHash } = __require("crypto");
75645
- var { Duplex, Readable } = __require("stream");
75751
+ var { Duplex, Readable: Readable2 } = __require("stream");
75646
75752
  var { URL: URL2 } = __require("url");
75647
75753
  var PerMessageDeflate = require_permessage_deflate2();
75648
75754
  var Receiver2 = require_receiver2();
@@ -75662,7 +75768,7 @@ var require_websocket2 = __commonJS((exports, module) => {
75662
75768
  var {
75663
75769
  EventTarget: { addEventListener, removeEventListener }
75664
75770
  } = require_event_target2();
75665
- var { format: format2, parse } = require_extension2();
75771
+ var { format: format3, parse: parse3 } = require_extension2();
75666
75772
  var { toBuffer } = require_buffer_util2();
75667
75773
  var kAborted = Symbol("kAborted");
75668
75774
  var protocolVersions = [8, 13];
@@ -76080,7 +76186,7 @@ var require_websocket2 = __commonJS((exports, module) => {
76080
76186
  isServer: false,
76081
76187
  maxPayload: opts.maxPayload
76082
76188
  });
76083
- opts.headers["Sec-WebSocket-Extensions"] = format2({
76189
+ opts.headers["Sec-WebSocket-Extensions"] = format3({
76084
76190
  [PerMessageDeflate.extensionName]: perMessageDeflate.offer()
76085
76191
  });
76086
76192
  }
@@ -76215,7 +76321,7 @@ var require_websocket2 = __commonJS((exports, module) => {
76215
76321
  }
76216
76322
  let extensions;
76217
76323
  try {
76218
- extensions = parse(secWebSocketExtensions);
76324
+ extensions = parse3(secWebSocketExtensions);
76219
76325
  } catch (err) {
76220
76326
  const message = "Invalid Sec-WebSocket-Extensions header";
76221
76327
  abortHandshake(websocket, socket, message);
@@ -76512,7 +76618,7 @@ var require_stream2 = __commonJS((exports, module) => {
76512
76618
  // node_modules/ws/lib/subprotocol.js
76513
76619
  var require_subprotocol2 = __commonJS((exports, module) => {
76514
76620
  var { tokenChars } = require_validation4();
76515
- function parse(header2) {
76621
+ function parse3(header2) {
76516
76622
  const protocols = new Set;
76517
76623
  let start = -1;
76518
76624
  let end = -1;
@@ -76551,7 +76657,7 @@ var require_subprotocol2 = __commonJS((exports, module) => {
76551
76657
  protocols.add(protocol);
76552
76658
  return protocols;
76553
76659
  }
76554
- module.exports = { parse };
76660
+ module.exports = { parse: parse3 };
76555
76661
  });
76556
76662
 
76557
76663
  // node_modules/ws/lib/websocket-server.js
@@ -78715,6 +78821,9 @@ var credentials = {
78715
78821
  return getSecretsPath();
78716
78822
  }
78717
78823
  };
78824
+ function getApiUrl() {
78825
+ return config.get("apiUrl");
78826
+ }
78718
78827
  async function requireAuth() {
78719
78828
  const apiKey = await credentials.getApiKey();
78720
78829
  if (!apiKey) {
@@ -81057,6 +81166,19 @@ async function configureEnvironmentVariables() {
81057
81166
  init_spinner();
81058
81167
  init_output();
81059
81168
  init_sdk_gen();
81169
+ function gitProviderLabel(providerType) {
81170
+ const labels = {
81171
+ github: "GitHub",
81172
+ github_app: "GitHub (App)",
81173
+ gitlab: "GitLab",
81174
+ gitea: "Gitea",
81175
+ bitbucket: "Bitbucket",
81176
+ generic: "Self-hosted Git"
81177
+ };
81178
+ if (!providerType)
81179
+ return "Not connected";
81180
+ return labels[providerType.toLowerCase()] ?? providerType;
81181
+ }
81060
81182
  async function show(options) {
81061
81183
  await requireAuth();
81062
81184
  await setupClient();
@@ -81096,6 +81218,7 @@ async function show(options) {
81096
81218
  Directory: project.directory,
81097
81219
  "Main Branch": project.main_branch,
81098
81220
  Repository: project.repo_name ? `${project.repo_owner}/${project.repo_name}` : "Not connected",
81221
+ "Git Provider": gitProviderLabel(project.git_provider_type),
81099
81222
  "Attack Mode": project.attack_mode ? "Enabled" : "Disabled",
81100
81223
  "Preview Envs": project.enable_preview_environments ? "Enabled" : "Disabled",
81101
81224
  Created: formatDate(new Date(project.created_at * 1000).toISOString()),
@@ -81263,14 +81386,19 @@ async function updateSettingsAction(options) {
81263
81386
  }
81264
81387
  return data;
81265
81388
  });
81389
+ let name = options.name;
81266
81390
  let slug = options.slug;
81267
81391
  let attackMode = options.attackMode;
81268
81392
  let previewEnvs = options.previewEnvs;
81269
- if (slug === undefined && attackMode === undefined && previewEnvs === undefined && imageRetentionHours === undefined && !options.yes) {
81393
+ if (name === undefined && slug === undefined && attackMode === undefined && previewEnvs === undefined && imageRetentionHours === undefined && !options.yes) {
81270
81394
  newline();
81271
81395
  header("Update Project Settings");
81272
81396
  info2(`Current settings for "${project.name}"`);
81273
81397
  newline();
81398
+ name = await promptText({
81399
+ message: "Project name (display name)",
81400
+ default: project.name
81401
+ });
81274
81402
  slug = await promptText({
81275
81403
  message: "Project slug (URL-friendly identifier)",
81276
81404
  default: project.slug
@@ -81289,6 +81417,7 @@ async function updateSettingsAction(options) {
81289
81417
  client,
81290
81418
  path: { project_id: project.id },
81291
81419
  body: {
81420
+ name: name ?? undefined,
81292
81421
  slug: slug ?? undefined,
81293
81422
  attack_mode: attackMode ?? undefined,
81294
81423
  enable_preview_environments: previewEnvs ?? undefined,
@@ -81305,7 +81434,8 @@ async function updateSettingsAction(options) {
81305
81434
  return;
81306
81435
  }
81307
81436
  success2("Project settings updated successfully");
81308
- keyValue("Slug", slug ?? project.slug);
81437
+ keyValue("Name", updated?.name ?? name ?? project.name);
81438
+ keyValue("Slug", updated?.slug ?? slug ?? project.slug);
81309
81439
  keyValue("Attack Mode", attackMode ? colors.success("Enabled") : colors.muted("Disabled"));
81310
81440
  keyValue("Preview Environments", previewEnvs ? colors.success("Enabled") : colors.muted("Disabled"));
81311
81441
  const effectiveRetention = imageRetentionHours !== undefined ? imageRetentionHours : updated?.image_retention_hours ?? null;
@@ -81548,6 +81678,96 @@ async function updateConfigAction(options) {
81548
81678
  keyValue("WebSocket Idle Timeout", `${websocketIdleTimeoutSeconds}s`);
81549
81679
  }
81550
81680
 
81681
+ // src/commands/projects/source.ts
81682
+ init_sdk_gen();
81683
+ init_spinner();
81684
+ init_output();
81685
+ var SWITCHABLE = [
81686
+ "docker_image",
81687
+ "static_files",
81688
+ "uploaded_source",
81689
+ "manual"
81690
+ ];
81691
+ async function fetchProject(reference) {
81692
+ const id = Number.parseInt(reference, 10);
81693
+ const result = Number.isNaN(id) ? await getProjectBySlug({ client, path: { slug: reference } }) : await getProject({ client, path: { id } });
81694
+ if (result.error || !result.data) {
81695
+ throw new Error(getErrorMessage(result.error) ?? `Project "${reference}" not found`);
81696
+ }
81697
+ return result.data;
81698
+ }
81699
+ function printProject(project, asJson) {
81700
+ if (asJson) {
81701
+ json(project);
81702
+ return;
81703
+ }
81704
+ newline();
81705
+ keyValue("Project", project.slug);
81706
+ keyValue("Source", project.source_type);
81707
+ keyValue("Alternate sources", project.allow_alternate_sources ? "allowed" : "not allowed");
81708
+ }
81709
+ async function projectSourceAction(options) {
81710
+ await requireAuth();
81711
+ await setupClient();
81712
+ const resolved = await requireProjectSlug(options.project);
81713
+ if (resolved.source !== "flag") {
81714
+ info2(`Using project ${colors.bold(resolved.slug)} (from ${resolved.source})`);
81715
+ }
81716
+ const project = await withSpinner("Fetching project...", () => fetchProject(resolved.slug));
81717
+ if (!options.type && options.allowAlternate === undefined) {
81718
+ printProject(project, options.json);
81719
+ if (!options.json) {
81720
+ newline();
81721
+ info2(`Change the primary source: --type <${SWITCHABLE.join("|")}>`);
81722
+ info2("Also accept `drop` uploads: --allow-alternate");
81723
+ }
81724
+ return;
81725
+ }
81726
+ let updated = project;
81727
+ if (options.type) {
81728
+ if (options.type === "git") {
81729
+ throw new Error(`Switching to a Git source needs a repository and a provider connection.
81730
+ ` + `Use: bunx @temps-sdk/cli projects git --project ${project.slug}`);
81731
+ }
81732
+ if (!SWITCHABLE.includes(options.type)) {
81733
+ throw new Error(`Unknown source type "${options.type}". Expected one of: ${SWITCHABLE.join(", ")}`);
81734
+ }
81735
+ updated = await withSpinner(`Changing source to ${options.type}...`, async () => {
81736
+ const { data, error: error3 } = await changeProjectSource({
81737
+ client,
81738
+ path: { id: project.id },
81739
+ body: { source_type: options.type }
81740
+ });
81741
+ if (error3 || !data) {
81742
+ throw new Error(getErrorMessage(error3) ?? "Failed to change deployment source");
81743
+ }
81744
+ return data;
81745
+ });
81746
+ success2(`Source changed to ${options.type}`);
81747
+ }
81748
+ if (options.allowAlternate !== undefined) {
81749
+ const allow = options.allowAlternate;
81750
+ updated = await withSpinner(allow ? "Allowing alternate sources..." : "Restricting to configured source...", async () => {
81751
+ const { data, error: error3 } = await setAlternateSources({
81752
+ client,
81753
+ path: { id: project.id },
81754
+ body: { allow_alternate_sources: allow }
81755
+ });
81756
+ if (error3 || !data) {
81757
+ throw new Error(getErrorMessage(error3) ?? "Failed to update alternate sources");
81758
+ }
81759
+ return data;
81760
+ });
81761
+ if (allow) {
81762
+ success2(`${updated.slug} still deploys from ${updated.source_type} and now also accepts uploaded source`);
81763
+ info2(`Try: bunx @temps-sdk/cli drop ./ --project ${updated.slug}`);
81764
+ } else {
81765
+ success2(`${updated.slug} now only deploys from ${updated.source_type}`);
81766
+ }
81767
+ }
81768
+ printProject(updated, options.json);
81769
+ }
81770
+
81551
81771
  // src/commands/projects/secrets.ts
81552
81772
  import { readFileSync as readFileSync4 } from "node:fs";
81553
81773
  init_sdk_gen();
@@ -81597,10 +81817,10 @@ async function findSecretByKey(projectId, key) {
81597
81817
  return found;
81598
81818
  }
81599
81819
  function registerProjectSecretsCommands(projects) {
81600
- const secrets = projects.command("secrets").description("Manage project secrets — mounted into the deployed container as files at /run/secrets/<KEY> (mode 0400), not environment variables. Distinct from `temps secrets` (agent/MCP-sandbox-scoped).");
81820
+ const secrets = projects.command("secrets").description("Manage project secrets — mounted into the deployed container as files at /run/secrets/<KEY>, not environment variables. Distinct from `temps secrets` (agent/MCP-sandbox-scoped).");
81601
81821
  secrets.command("list").alias("ls").description("List secrets for a project (values are never returned)").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <name>", "Filter to one environment").option("--json", "Output in JSON format").action(listAction2);
81602
- secrets.command("create").alias("add").description("Create a project secret (mounted at /run/secrets/<KEY> on the next deployment)").option("-p, --project <project>", "Project slug or ID").requiredOption("-k, --key <key>", "Secret key — becomes the filename at /run/secrets/<KEY>. Letters, digits, underscore; must start with a letter or underscore.").requiredOption("-v, --value <value>", "Secret value (<=1 MiB). Prefix with @ to read from a local file, e.g. @./auth.json — never touches shell history.").option("-e, --environment <name>", "Scope to one environment (repeatable; default: all)", collect, []).option("--include-in-preview", "Also mount this secret in preview environments").action(createAction);
81603
- secrets.command("update").description("Update a project secret (a redeploy is required for running containers to pick it up)").option("-p, --project <project>", "Project slug or ID").requiredOption("-k, --key <key>", "Key of the secret to update").option("-v, --value <value>", "New value (<=1 MiB). Prefix with @ to read from a local file. Omit to keep the existing value.").option("-e, --environment <name>", "Replace environment scoping (repeatable)", collect, []).option("--include-in-preview", "Include in preview environments").option("--no-include-in-preview", "Exclude from preview environments").action(updateAction);
81822
+ secrets.command("create").alias("add").description("Create a project secret (mounted at /run/secrets/<KEY> on the next deployment)").option("-p, --project <project>", "Project slug or ID").requiredOption("-k, --key <key>", "Secret key — becomes the filename at /run/secrets/<KEY>. Letters, digits, underscore; must start with a letter or underscore.").requiredOption("-v, --value <value>", "Secret value (<=1 MiB). Prefix with @ to read from a local file, e.g. @./auth.json — never touches shell history.").option("-e, --environment <name>", "Scope to one environment (repeatable; default: all)", collect, []).option("-s, --service <name>", "Docker Compose service allowed to read this secret (repeatable; default: every service). Ignored for non-Compose projects, which deploy a single container.", collect, []).option("--include-in-preview", "Also mount this secret in preview environments").action(createAction);
81823
+ secrets.command("update").description("Update a project secret (a redeploy is required for running containers to pick it up)").option("-p, --project <project>", "Project slug or ID").requiredOption("-k, --key <key>", "Key of the secret to update").option("-v, --value <value>", "New value (<=1 MiB). Prefix with @ to read from a local file. Omit to keep the existing value.").option("-e, --environment <name>", "Replace environment scoping (repeatable)", collect, []).option("-s, --service <name>", "Replace the Docker Compose service scope (repeatable). Pass none to keep the current scope; use --all-services to widen it back to every service.", collect, []).option("--all-services", "Deliver to every Compose service, clearing any per-service scope").option("--include-in-preview", "Include in preview environments").option("--no-include-in-preview", "Exclude from preview environments").action(updateAction);
81604
81824
  secrets.command("delete").alias("rm").description("Delete a project secret").argument("<key>", "Key of the secret to delete").option("-p, --project <project>", "Project slug or ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation (alias for --force)").action(deleteAction);
81605
81825
  }
81606
81826
  async function listAction2(options) {
@@ -81642,6 +81862,8 @@ async function listAction2(options) {
81642
81862
  console.log(` ${colors.muted("Mount path:")} ${colors.bold(`/run/secrets/${secret.key}`)}`);
81643
81863
  const scope = secret.environments.length > 0 ? secret.environments.map((e) => e.name).join(", ") : "all environments";
81644
81864
  console.log(` ${colors.muted("Environments:")} ${scope}${secret.include_in_preview ? " (+ preview)" : ""}`);
81865
+ const services = secret.compose_services && secret.compose_services.length > 0 ? secret.compose_services.join(", ") : "all services";
81866
+ console.log(` ${colors.muted("Compose services:")} ${services}`);
81645
81867
  newline();
81646
81868
  }
81647
81869
  }
@@ -81663,6 +81885,7 @@ async function createAction(options) {
81663
81885
  key: options.key,
81664
81886
  value,
81665
81887
  ...environmentIds ? { environment_ids: environmentIds } : {},
81888
+ ...options.service.length > 0 ? { compose_services: options.service } : {},
81666
81889
  ...options.includeInPreview !== undefined ? { include_in_preview: options.includeInPreview } : {}
81667
81890
  }
81668
81891
  });
@@ -81671,16 +81894,20 @@ async function createAction(options) {
81671
81894
  return data;
81672
81895
  });
81673
81896
  success2(`Secret created: ${secret.key}`);
81674
- info2(`Mounted at ${colors.bold(`/run/secrets/${secret.key}`)} (mode 0400) on the next deployment`);
81897
+ info2(`Mounted at ${colors.bold(`/run/secrets/${secret.key}`)} on the next deployment`);
81898
+ info2(secret.compose_services && secret.compose_services.length > 0 ? `Readable only by Compose service(s): ${secret.compose_services.join(", ")}` : "Readable by every service in the stack (use --service to restrict it)");
81675
81899
  info2("A redeploy is required for this to take effect.");
81676
81900
  }
81677
81901
  async function updateAction(options) {
81678
81902
  await requireAuth();
81679
81903
  await setupClient();
81680
- if (options.value === undefined && options.environment.length === 0 && options.includeInPreview === undefined) {
81681
- warning2("No fields to update. Provide at least one of --value, --environment, or --include-in-preview");
81904
+ if (options.value === undefined && options.environment.length === 0 && options.service.length === 0 && options.allServices !== true && options.includeInPreview === undefined) {
81905
+ warning2("No fields to update. Provide at least one of --value, --environment, --service, --all-services, or --include-in-preview");
81682
81906
  return;
81683
81907
  }
81908
+ if (options.service.length > 0 && options.allServices === true) {
81909
+ throw new Error("--service and --all-services are mutually exclusive");
81910
+ }
81684
81911
  const resolved = await requireProjectSlug(options.project);
81685
81912
  if (resolved.source !== "flag") {
81686
81913
  info2(`Using project ${colors.bold(resolved.slug)} (from ${resolved.source})`);
@@ -81689,12 +81916,14 @@ async function updateAction(options) {
81689
81916
  const projectId = await getProjectId(resolved.slug);
81690
81917
  const current = await findSecretByKey(projectId, options.key);
81691
81918
  const environmentIds = options.environment.length > 0 ? await resolveEnvironmentIds(projectId, options.environment) : undefined;
81919
+ const composeServices = options.allServices ? [] : options.service.length > 0 ? options.service : current.compose_services ?? [];
81692
81920
  const { data, error: error3 } = await updateProjectSecret({
81693
81921
  client,
81694
81922
  path: { project_id: projectId, secret_id: current.id },
81695
81923
  body: {
81696
81924
  ...options.value !== undefined ? { value: resolveValue(options.value) } : {},
81697
81925
  ...environmentIds ? { environment_ids: environmentIds } : {},
81926
+ compose_services: composeServices,
81698
81927
  ...options.includeInPreview !== undefined ? { include_in_preview: options.includeInPreview } : {}
81699
81928
  }
81700
81929
  });
@@ -81745,8 +81974,9 @@ function registerProjectsCommands(program2) {
81745
81974
  projects.command("create").alias("new").description("Create a new project (git-based or manual deployment)").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("--repo <repository>", "Repository in owner/name format (nested groups supported: group/subgroup/name)").option("--branch <branch>", "Git branch").option("--directory <directory>", "Root directory (relative to repo)").option("--preset <preset>", "Build preset (e.g., nextjs, nodejs, static, docker)").option("--connection <id>", "Git connection ID").option("--manual", "Create a manual (non-git) project - deploy via Docker image or static files").option("--source-type <type>", "Manual deployment method: manual (flexible), docker_image, or static_files").option("--image <image>", "Docker image for the first deployment (manual mode)").option("--port <port>", "Application/container port (manual mode, default: 3000)").option("-y, --yes", "Skip optional prompts (services, env vars, set-default)").action(create);
81746
81975
  projects.command("show").alias("get").description("Show project details").option("-p, --project <project>", "Project slug or ID").option("--json", "Output in JSON format").action(show);
81747
81976
  projects.command("update").alias("edit").description("Update project name and description").option("-p, --project <project>", "Project slug or ID").option("-n, --name <name>", "New project name").option("-d, --description <description>", "New project description").option("--json", "Output in JSON format").option("-y, --yes", "Skip prompts, use provided values (for automation)").action(updateProjectAction);
81748
- projects.command("settings").description("Update project settings (slug, attack mode, preview environments, image retention)").option("-p, --project <project>", "Project slug or ID").option("--slug <slug>", "Project URL slug").option("--attack-mode", "Enable attack mode (CAPTCHA protection)").option("--no-attack-mode", "Disable attack mode").option("--preview-envs", "Enable preview environments").option("--no-preview-envs", "Disable preview environments").option("--image-retention-hours <hours>", "Hours to keep built images before nightly cleanup removes them (1-8760). " + "Images are needed to roll back, so this is the project rollback window").option("--reset-image-retention", "Clear the per-project image retention override and use the system default").option("--json", "Output in JSON format").option("-y, --yes", "Skip prompts (for automation)").action(updateSettingsAction);
81977
+ projects.command("settings").description("Update project settings (name, slug, attack mode, preview environments, image retention)").option("-p, --project <project>", "Project slug or ID").option("--name <name>", "Project display name (does not change the URL)").option("--slug <slug>", "Project URL slug").option("--attack-mode", "Enable attack mode (CAPTCHA protection)").option("--no-attack-mode", "Disable attack mode").option("--preview-envs", "Enable preview environments").option("--no-preview-envs", "Disable preview environments").option("--image-retention-hours <hours>", "Hours to keep built images before nightly cleanup removes them (1-8760). " + "Images are needed to roll back, so this is the project rollback window").option("--reset-image-retention", "Clear the per-project image retention override and use the system default").option("--json", "Output in JSON format").option("-y, --yes", "Skip prompts (for automation)").action(updateSettingsAction);
81749
81978
  projects.command("git").description("Update git repository settings").option("-p, --project <project>", "Project slug or ID").option("--owner <owner>", "Repository owner").option("--repo <repo>", "Repository name").option("--branch <branch>", "Main branch").option("--directory <directory>", "App directory path").option("--preset <preset>", "Build preset (auto, nextjs, nodejs, static, docker, rust, go, python)").option("--connection <id>", "Git connection ID (links the project to an actual clone-access connection; omit to leave the existing connection unchanged)").option("--json", "Output in JSON format").option("-y, --yes", "Skip prompts, use provided/existing values (for automation)").action(updateGitAction);
81979
+ projects.command("source").description("Show or change how a project is deployed (primary source, and whether it also accepts `drop` uploads)").option("-p, --project <project>", "Project slug or ID").option("--type <type>", "Set the primary source: docker_image, static_files, uploaded_source or manual (use `projects git` to switch to git)").option("--allow-alternate", "Also accept an uploaded source archive from `drop`, keeping the current source as default").option("--no-allow-alternate", "Only deploy from the configured source").option("--json", "Output in JSON format").action(projectSourceAction);
81750
81980
  projects.command("config").description("Update deployment configuration (resources, replicas)").option("-p, --project <project>", "Project slug or ID").option("--replicas <n>", "Number of container replicas").option("--cpu-limit <limit>", "CPU limit in cores (e.g., 0.5, 1, 2)").option("--memory-limit <limit>", "Memory limit in MB").option("--auto-deploy", "Enable automatic deployments").option("--no-auto-deploy", "Disable automatic deployments").option("--request-timeout <seconds>", "Default timeout for regular HTTP requests, in seconds").option("--sse-idle-timeout <seconds>", "Default idle timeout for SSE streams, in seconds").option("--websocket-idle-timeout <seconds>", "Default idle timeout for WebSocket connections, in seconds").option("--json", "Output in JSON format").option("-y, --yes", "Skip prompts (for automation)").action(updateConfigAction);
81751
81981
  projects.command("delete").alias("rm").description("Delete a project").option("-p, --project <project>", "Project slug or ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation (alias for --force)").action(remove);
81752
81982
  }
@@ -87158,8 +87388,9 @@ init_prompts();
87158
87388
  init_spinner();
87159
87389
  init_output();
87160
87390
  import { spawn as spawn3 } from "node:child_process";
87161
- import { existsSync as existsSync6, createWriteStream, writeFileSync as writeFileSync3, mkdirSync } from "node:fs";
87391
+ import { existsSync as existsSync6, createWriteStream, writeFileSync as writeFileSync3, mkdirSync, createReadStream } from "node:fs";
87162
87392
  import { unlink as unlink2 } from "node:fs/promises";
87393
+ import { Readable } from "node:stream";
87163
87394
  import { resolve as resolve2, basename, join as join3 } from "node:path";
87164
87395
  import { tmpdir as tmpdir2 } from "node:os";
87165
87396
  async function deployLocalImage(options) {
@@ -87409,10 +87640,9 @@ ${colors.dim("(freshly built)")}` : ""), `${icons.rocket} Deploy Local Image`);
87409
87640
  queryParams.set("health_check_path", healthCheckPath);
87410
87641
  }
87411
87642
  const finalUrl = queryParams.toString() ? `${uploadUrl}?${queryParams.toString()}` : uploadUrl;
87412
- const file = Bun.file(tempFilePath);
87413
87643
  const filename = `${imageName.replace(/[/:]/g, "-")}.tar`;
87414
- const boundary = `----BunFormBoundary${Date.now().toString(16)}`;
87415
- const fileStream = file.stream();
87644
+ const boundary = `----TempsFormBoundary${Date.now().toString(16)}`;
87645
+ const fileStream = Readable.toWeb(createReadStream(tempFilePath));
87416
87646
  const header2 = [
87417
87647
  `--${boundary}`,
87418
87648
  `Content-Disposition: form-data; name="file"; filename="${filename}"`,
@@ -89078,10 +89308,13 @@ async function resolveExistingProject(reference) {
89078
89308
  function assertUploadable(project) {
89079
89309
  if (UPLOADABLE_SOURCE_TYPES.includes(project.source_type))
89080
89310
  return;
89311
+ if (project.allow_alternate_sources)
89312
+ return;
89081
89313
  const command = COMMAND_BY_SOURCE_TYPE[project.source_type];
89082
89314
  const alternative = command ? `
89083
- Use: bunx @temps-sdk/cli ${command} --project ${project.slug}` : "";
89084
- throw new Error(`Project "${project.slug}" deploys from ${project.source_type}, ` + `so it cannot take an uploaded source archive.${alternative}`);
89315
+ Deploy it from its configured source: bunx @temps-sdk/cli ${command} --project ${project.slug}` : "";
89316
+ throw new Error(`Project "${project.slug}" deploys from ${project.source_type}, ` + `so it cannot take an uploaded source archive.
89317
+ ` + `Allow it to: bunx @temps-sdk/cli projects source --project ${project.slug} --allow-alternate` + alternative);
89085
89318
  }
89086
89319
  function selectCandidate(candidates, options, currentDirectory) {
89087
89320
  const matches2 = candidates.filter((item) => (!options.preset || item.preset === options.preset) && (!options.directory || item.directory === options.directory));
@@ -89110,6 +89343,9 @@ async function syncBuildConfig(project, candidate) {
89110
89343
  if (updated.error)
89111
89344
  throw new Error(JSON.stringify(updated.error));
89112
89345
  succeedSpinner(`Build config updated: ${changes.join(", ")}`);
89346
+ if (!UPLOADABLE_SOURCE_TYPES.includes(project.source_type)) {
89347
+ warning2(`These build settings also apply to ${project.slug}'s ${project.source_type} deployments. ` + `Re-run \`projects settings\` if the next non-drop deploy should build differently.`);
89348
+ }
89113
89349
  }
89114
89350
  function buildConfigChanges(project, candidate) {
89115
89351
  const changes = [];
@@ -93079,6 +93315,10 @@ init_sdk_gen();
93079
93315
  init_spinner();
93080
93316
  init_prompts();
93081
93317
  init_output();
93318
+ var SEVERITIES = ["debug", "info", "warning", "error", "critical", "emergency"];
93319
+ function parseProviderIds(value) {
93320
+ return value.split(",").map((id) => id.trim()).filter((id) => id.length > 0).map((id) => parseInt(id, 10));
93321
+ }
93082
93322
  function parseEnabledFlag(value) {
93083
93323
  if (value === undefined)
93084
93324
  return;
@@ -93132,6 +93372,12 @@ function registerNotificationsCommands(program2) {
93132
93372
  notifications.command("show").description("Show notification provider details").requiredOption("--id <id>", "Provider ID").option("--json", "Output in JSON format").action(showProvider2);
93133
93373
  notifications.command("remove").alias("rm").description("Remove a notification provider").requiredOption("--id <id>", "Provider ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(removeProvider2);
93134
93374
  notifications.command("test").description("Send a test notification").requiredOption("--id <id>", "Provider ID").action(testProviderAction);
93375
+ const routes = notifications.command("routes").description("Manage severity-based notification routes (which providers receive which severities)");
93376
+ routes.command("list").alias("ls").description("List notification routes").option("--json", "Output in JSON format").action(listRoutes2);
93377
+ routes.command("show").description("Show notification route details").requiredOption("--id <id>", "Route ID").option("--json", "Output in JSON format").action(showRoute);
93378
+ routes.command("create").description("Create a notification route").option("-n, --name <name>", "Route name").option("--min-severity <severity>", `Minimum severity: ${SEVERITIES.join(", ")}`).option("--max-severity <severity>", `Maximum severity: ${SEVERITIES.join(", ")}`).option("--provider-ids <ids>", "Comma-separated notification provider IDs").option("--enabled <enabled>", "Enable or disable (true/false, default: true)").option("--json", "Output in JSON format").option("-y, --yes", "Skip confirmation prompts (for automation)").action(createRoute2);
93379
+ routes.command("update").description("Update a notification route").requiredOption("--id <id>", "Route ID").option("-n, --name <name>", "New route name").option("--min-severity <severity>", `Minimum severity: ${SEVERITIES.join(", ")}`).option("--max-severity <severity>", `Maximum severity: ${SEVERITIES.join(", ")}`).option("--provider-ids <ids>", "Comma-separated notification provider IDs (replaces the current set)").option("--enabled <enabled>", "Enable or disable (true/false)").option("--json", "Output in JSON format").action(updateRoute2);
93380
+ routes.command("remove").alias("rm").description("Remove a notification route").requiredOption("--id <id>", "Route ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(removeRoute);
93135
93381
  }
93136
93382
  async function listProviders2(options) {
93137
93383
  await requireAuth();
@@ -93630,6 +93876,216 @@ async function testProviderAction(options) {
93630
93876
  success2("Test notification sent successfully!");
93631
93877
  info2("Check your notification channel for the test message");
93632
93878
  }
93879
+ function routeColumns() {
93880
+ return [
93881
+ { header: "ID", key: "id", width: 6 },
93882
+ { header: "Name", key: "name", color: (v) => colors.bold(v) },
93883
+ { header: "Range", accessor: (r) => `${r.min_severity} → ${r.max_severity}` },
93884
+ { header: "Providers", accessor: (r) => r.provider_ids.join(", ") || "(none)" },
93885
+ { header: "Status", accessor: (r) => r.enabled ? "enabled" : "disabled", color: (v) => statusBadge(v === "enabled" ? "active" : "inactive") }
93886
+ ];
93887
+ }
93888
+ async function listRoutes2(options) {
93889
+ await requireAuth();
93890
+ await setupClient();
93891
+ const routesPage = await withSpinner("Fetching notification routes...", async () => {
93892
+ const { data, error: error3 } = await listNotificationRoutes({ client, query: { page: 1, page_size: 100 } });
93893
+ if (error3) {
93894
+ throw new Error(getErrorMessage(error3));
93895
+ }
93896
+ return data;
93897
+ });
93898
+ const items = routesPage?.items ?? [];
93899
+ if (options.json) {
93900
+ json(items);
93901
+ return;
93902
+ }
93903
+ newline();
93904
+ header(`${icons.info} Notification Routes (${items.length})`);
93905
+ if (items.length === 0) {
93906
+ info2("No notification routes configured");
93907
+ info2('Run: temps notifications routes create --name "Critical alerts" --min-severity critical --max-severity emergency --provider-ids <id> -y');
93908
+ newline();
93909
+ return;
93910
+ }
93911
+ printTable(items, routeColumns(), { style: "minimal" });
93912
+ newline();
93913
+ }
93914
+ async function showRoute(options) {
93915
+ await requireAuth();
93916
+ await setupClient();
93917
+ const id = parseInt(options.id, 10);
93918
+ if (isNaN(id)) {
93919
+ warning2("Invalid route ID");
93920
+ return;
93921
+ }
93922
+ const route = await withSpinner("Fetching route...", async () => {
93923
+ const { data, error: error3 } = await getNotificationRoute({ client, path: { id } });
93924
+ if (error3 || !data) {
93925
+ throw new Error(getErrorMessage(error3) ?? `Route ${options.id} not found`);
93926
+ }
93927
+ return data;
93928
+ });
93929
+ if (options.json) {
93930
+ json(route);
93931
+ return;
93932
+ }
93933
+ newline();
93934
+ header(`${icons.info} ${route.name}`);
93935
+ keyValue("ID", route.id);
93936
+ keyValue("Severity range", `${route.min_severity} → ${route.max_severity}`);
93937
+ keyValue("Providers", route.provider_ids.join(", ") || "(none)");
93938
+ keyValue("Status", route.enabled ? colors.success("enabled") : colors.muted("disabled"));
93939
+ keyValue("Created", new Date(route.created_at * 1000).toLocaleString());
93940
+ keyValue("Updated", new Date(route.updated_at * 1000).toLocaleString());
93941
+ newline();
93942
+ }
93943
+ async function resolveProviderIds(options) {
93944
+ if (options.providerIds) {
93945
+ return parseProviderIds(options.providerIds);
93946
+ }
93947
+ if (options.yes) {
93948
+ throw new Error("--provider-ids is required with -y/--yes");
93949
+ }
93950
+ const { data: providers, error: error3 } = await listNotificationProviders({ client });
93951
+ if (error3) {
93952
+ throw new Error(getErrorMessage(error3));
93953
+ }
93954
+ if (!providers || providers.length === 0) {
93955
+ throw new Error("No notification providers configured. Run: temps notifications add");
93956
+ }
93957
+ const selected = await promptCheckbox({
93958
+ message: "Providers to deliver to this route",
93959
+ choices: providers.map((p) => ({
93960
+ name: `${p.name} (${p.provider_type}, ${p.enabled ? "enabled" : "disabled"})`,
93961
+ value: p.id
93962
+ })),
93963
+ required: true
93964
+ });
93965
+ return selected;
93966
+ }
93967
+ async function createRoute2(options) {
93968
+ await requireAuth();
93969
+ await setupClient();
93970
+ const isAutomation = options.yes && options.name && options.minSeverity && options.maxSeverity && options.providerIds;
93971
+ const name = options.name || await promptText({
93972
+ message: "Route name",
93973
+ required: true
93974
+ });
93975
+ const minSeverity = options.minSeverity || (isAutomation ? undefined : await promptSelect({
93976
+ message: "Minimum severity",
93977
+ choices: SEVERITIES.map((s) => ({ name: s, value: s })),
93978
+ default: "debug"
93979
+ }));
93980
+ if (!minSeverity) {
93981
+ warning2("--min-severity is required with -y/--yes");
93982
+ return;
93983
+ }
93984
+ const maxSeverity = options.maxSeverity || (isAutomation ? undefined : await promptSelect({
93985
+ message: "Maximum severity",
93986
+ choices: SEVERITIES.map((s) => ({ name: s, value: s })),
93987
+ default: "emergency"
93988
+ }));
93989
+ if (!maxSeverity) {
93990
+ warning2("--max-severity is required with -y/--yes");
93991
+ return;
93992
+ }
93993
+ const providerIds = await resolveProviderIds(options);
93994
+ const parsedEnabled = parseEnabledFlag(options.enabled);
93995
+ if (parsedEnabled === "invalid") {
93996
+ warning2('Invalid value for --enabled. Use "true" or "false"');
93997
+ return;
93998
+ }
93999
+ const created = await withSpinner("Creating notification route...", async () => {
94000
+ const { data, error: error3 } = await createNotificationRoute({
94001
+ client,
94002
+ body: {
94003
+ name,
94004
+ min_severity: minSeverity,
94005
+ max_severity: maxSeverity,
94006
+ provider_ids: providerIds,
94007
+ enabled: parsedEnabled ?? true
94008
+ }
94009
+ });
94010
+ if (error3) {
94011
+ throw new Error(getErrorMessage(error3));
94012
+ }
94013
+ return data;
94014
+ });
94015
+ if (options.json && created) {
94016
+ json(created);
94017
+ return;
94018
+ }
94019
+ success2(`Notification route "${created?.name ?? name}" created successfully`);
94020
+ }
94021
+ async function updateRoute2(options) {
94022
+ await requireAuth();
94023
+ await setupClient();
94024
+ const id = parseInt(options.id, 10);
94025
+ if (isNaN(id)) {
94026
+ warning2("Invalid route ID");
94027
+ return;
94028
+ }
94029
+ const parsedEnabled = parseEnabledFlag(options.enabled);
94030
+ if (parsedEnabled === "invalid") {
94031
+ warning2('Invalid value for --enabled. Use "true" or "false"');
94032
+ return;
94033
+ }
94034
+ const updated = await withSpinner("Updating notification route...", async () => {
94035
+ const { data, error: error3 } = await updateNotificationRoute({
94036
+ client,
94037
+ path: { id },
94038
+ body: {
94039
+ name: options.name ?? undefined,
94040
+ min_severity: options.minSeverity ?? undefined,
94041
+ max_severity: options.maxSeverity ?? undefined,
94042
+ provider_ids: options.providerIds ? parseProviderIds(options.providerIds) : undefined,
94043
+ enabled: parsedEnabled ?? undefined
94044
+ }
94045
+ });
94046
+ if (error3) {
94047
+ throw new Error(getErrorMessage(error3));
94048
+ }
94049
+ return data;
94050
+ });
94051
+ if (options.json && updated) {
94052
+ json(updated);
94053
+ return;
94054
+ }
94055
+ success2(`Notification route "${updated?.name ?? options.id}" updated successfully`);
94056
+ }
94057
+ async function removeRoute(options) {
94058
+ await requireAuth();
94059
+ await setupClient();
94060
+ const id = parseInt(options.id, 10);
94061
+ if (isNaN(id)) {
94062
+ warning2("Invalid route ID");
94063
+ return;
94064
+ }
94065
+ const { data: route, error: getError } = await getNotificationRoute({ client, path: { id } });
94066
+ if (getError || !route) {
94067
+ warning2(`Route ${options.id} not found`);
94068
+ return;
94069
+ }
94070
+ const skipConfirmation = options.force || options.yes;
94071
+ if (!skipConfirmation) {
94072
+ const confirmed = await promptConfirm({
94073
+ message: `Remove notification route "${route.name}"?`,
94074
+ default: false
94075
+ });
94076
+ if (!confirmed) {
94077
+ info2("Cancelled");
94078
+ return;
94079
+ }
94080
+ }
94081
+ await withSpinner("Removing route...", async () => {
94082
+ const { error: error3 } = await deleteNotificationRoute({ client, path: { id } });
94083
+ if (error3) {
94084
+ throw new Error(getErrorMessage(error3));
94085
+ }
94086
+ });
94087
+ success2("Notification route removed");
94088
+ }
93633
94089
 
93634
94090
  // src/commands/dns/index.ts
93635
94091
  init_sdk_gen();
@@ -95573,6 +96029,23 @@ function buildAutomationSettingsUpdate(options, currentSettings) {
95573
96029
  max_requests_per_minute: options.rateLimitingRpm ? parseInt(options.rateLimitingRpm, 10) : currentSettings?.rate_limiting?.max_requests_per_minute || 60
95574
96030
  };
95575
96031
  }
96032
+ if (options.consoleForceHttps !== undefined) {
96033
+ switch (options.consoleForceHttps) {
96034
+ case "auto":
96035
+ updates.console_force_https = null;
96036
+ break;
96037
+ case "always":
96038
+ updates.console_force_https = true;
96039
+ break;
96040
+ case "never":
96041
+ updates.console_force_https = false;
96042
+ break;
96043
+ default:
96044
+ return {
96045
+ error: `--console-force-https must be auto, always or never, got "${options.consoleForceHttps}"`
96046
+ };
96047
+ }
96048
+ }
95576
96049
  if (options.screenshotsEnabled !== undefined) {
95577
96050
  const enabled = options.screenshotsEnabled === "true";
95578
96051
  updates.screenshots = {
@@ -95606,6 +96079,37 @@ function buildAutomationSettingsUpdate(options, currentSettings) {
95606
96079
  default_websocket_idle_timeout_seconds: parsed[3]
95607
96080
  };
95608
96081
  }
96082
+ if (options.maxMemoryLimitMb !== undefined || options.maxConcurrentConnectionsCeiling !== undefined || options.allowUnlimitedTimeouts !== undefined) {
96083
+ const current = currentSettings?.tenant_resource_ceilings;
96084
+ const numeric = [
96085
+ ["--max-memory-limit-mb", options.maxMemoryLimitMb, current?.max_memory_limit_mb ?? 0],
96086
+ ["--max-concurrent-connections-ceiling", options.maxConcurrentConnectionsCeiling, current?.max_concurrent_connections ?? 0]
96087
+ ];
96088
+ const parsed = [];
96089
+ for (const [flag, raw, fallback] of numeric) {
96090
+ if (raw === undefined) {
96091
+ parsed.push(fallback);
96092
+ continue;
96093
+ }
96094
+ const value = parseInt(raw, 10);
96095
+ if (Number.isNaN(value) || value < 0) {
96096
+ return { error: `${flag} must be a non-negative number (0 = no ceiling), got "${raw}"` };
96097
+ }
96098
+ parsed.push(value);
96099
+ }
96100
+ let allowUnlimited = current?.allow_unlimited_request_timeouts ?? true;
96101
+ if (options.allowUnlimitedTimeouts !== undefined) {
96102
+ if (options.allowUnlimitedTimeouts !== "true" && options.allowUnlimitedTimeouts !== "false") {
96103
+ return { error: `--allow-unlimited-timeouts must be true or false, got "${options.allowUnlimitedTimeouts}"` };
96104
+ }
96105
+ allowUnlimited = options.allowUnlimitedTimeouts === "true";
96106
+ }
96107
+ updates.tenant_resource_ceilings = {
96108
+ max_memory_limit_mb: parsed[0],
96109
+ max_concurrent_connections: parsed[1],
96110
+ allow_unlimited_request_timeouts: allowUnlimited
96111
+ };
96112
+ }
95609
96113
  if (options.setting && options.value) {
95610
96114
  switch (options.setting) {
95611
96115
  case "external_url":
@@ -95626,7 +96130,7 @@ function buildAutomationSettingsUpdate(options, currentSettings) {
95626
96130
  function registerSettingsCommands(program2) {
95627
96131
  const settings = program2.command("settings").description("Manage platform settings");
95628
96132
  settings.command("show").alias("get").description("Show current platform settings").option("--json", "Output in JSON format").action(showSettings);
95629
- settings.command("update").alias("set").description("Update platform settings").option("-s, --setting <setting>", "Setting to update (external_url, preview_domain, letsencrypt, rate_limiting, security_headers, screenshots)").option("-v, --value <value>", "Value for the setting").option("--external-url <url>", "External URL for the platform").option("--preview-domain <domain>", "Preview domain pattern").option("--letsencrypt-email <email>", "Let's Encrypt email").option("--letsencrypt-mode <mode>", "Let's Encrypt mode (staging, production)").option("--rate-limiting-enabled <enabled>", "Enable rate limiting (true/false)").option("--rate-limiting-rpm <rpm>", "Requests per minute").option("--screenshots-enabled <enabled>", "Enable screenshots (true/false)").option("--max-request-timeout <seconds>", "Hard ceiling for all upstream request/idle timeouts, in seconds").option("--default-http-timeout <seconds>", "Default timeout for regular HTTP requests, in seconds").option("--default-sse-idle-timeout <seconds>", "Default idle timeout for SSE streams, in seconds").option("--default-websocket-idle-timeout <seconds>", "Default idle timeout for WebSocket connections, in seconds").option("-y, --yes", "Skip confirmation prompts (for automation)").action(updateSettingsAction2);
96133
+ settings.command("update").alias("set").description("Update platform settings").option("-s, --setting <setting>", "Setting to update (external_url, preview_domain, letsencrypt, rate_limiting, security_headers, screenshots)").option("-v, --value <value>", "Value for the setting").option("--external-url <url>", "External URL for the platform").option("--preview-domain <domain>", "Preview domain pattern").option("--letsencrypt-email <email>", "Let's Encrypt email").option("--letsencrypt-mode <mode>", "Let's Encrypt mode (staging, production)").option("--rate-limiting-enabled <enabled>", "Enable rate limiting (true/false)").option("--rate-limiting-rpm <rpm>", "Requests per minute").option("--screenshots-enabled <enabled>", "Enable screenshots (true/false)").option("--max-request-timeout <seconds>", "Hard ceiling for all upstream request/idle timeouts, in seconds").option("--default-http-timeout <seconds>", "Default timeout for regular HTTP requests, in seconds").option("--default-sse-idle-timeout <seconds>", "Default idle timeout for SSE streams, in seconds").option("--default-websocket-idle-timeout <seconds>", "Default idle timeout for WebSocket connections, in seconds").option("--max-memory-limit-mb <mb>", "Ceiling on a project/environment memory limit override, in MB (0 = no ceiling)").option("--max-concurrent-connections-ceiling <count>", "Ceiling on a project/environment concurrent-connection override (0 = no ceiling)").option("--allow-unlimited-timeouts <enabled>", "Whether projects may set a timeout of 0, i.e. no timeout (true/false)").option("--console-force-https <mode>", "Redirect the console host to HTTPS: auto (once a cert exists), always, or never").option("-y, --yes", "Skip confirmation prompts (for automation)").action(updateSettingsAction2);
95630
96134
  settings.command("set-external-url").description("Set the external URL for the platform").requiredOption("--url <url>", "External URL").action(setExternalUrl);
95631
96135
  settings.command("set-preview-domain").description("Set the preview domain pattern").requiredOption("--domain <domain>", "Preview domain pattern").action(setPreviewDomain);
95632
96136
  }
@@ -95651,6 +96155,7 @@ async function showSettings(options) {
95651
96155
  newline();
95652
96156
  header(`${icons.info} Platform Settings`);
95653
96157
  keyValue("External URL", appSettings.external_url || colors.muted("Not set"));
96158
+ keyValue("Console HTTPS Redirect", appSettings.console_force_https === true ? "Always" : appSettings.console_force_https === false ? colors.muted("Never") : colors.muted("Automatic (once a certificate exists)"));
95654
96159
  keyValue("Preview Domain", appSettings.preview_domain || colors.muted("Not set"));
95655
96160
  newline();
95656
96161
  header("Let's Encrypt");
@@ -95705,6 +96210,12 @@ async function showSettings(options) {
95705
96210
  info2("Not configured");
95706
96211
  }
95707
96212
  newline();
96213
+ header("Project Override Ceilings");
96214
+ const ceilings = appSettings.tenant_resource_ceilings;
96215
+ keyValue("Max Memory Limit", ceilings?.max_memory_limit_mb ? `${ceilings.max_memory_limit_mb} MB` : colors.muted("No ceiling"));
96216
+ keyValue("Max Concurrent Connections", ceilings?.max_concurrent_connections ? ceilings.max_concurrent_connections.toString() : colors.muted("No ceiling"));
96217
+ keyValue("Projects May Disable Timeouts", ceilings?.allow_unlimited_request_timeouts === false ? colors.muted("No") : colors.success("Yes"));
96218
+ newline();
95708
96219
  }
95709
96220
  async function updateSettingsAction2(options) {
95710
96221
  await requireAuth();
@@ -95714,7 +96225,7 @@ async function updateSettingsAction2(options) {
95714
96225
  throw new Error(getErrorMessage(getError));
95715
96226
  }
95716
96227
  const updates = {};
95717
- const isAutomation = options.yes && (options.externalUrl || options.previewDomain || options.letsencryptEmail || options.letsencryptMode || options.rateLimitingEnabled || options.screenshotsEnabled || options.maxRequestTimeout || options.defaultHttpTimeout || options.defaultSseIdleTimeout || options.defaultWebsocketIdleTimeout || options.setting && options.value);
96228
+ const isAutomation = options.yes && (options.externalUrl || options.previewDomain || options.letsencryptEmail || options.letsencryptMode || options.rateLimitingEnabled || options.screenshotsEnabled || options.maxRequestTimeout || options.defaultHttpTimeout || options.defaultSseIdleTimeout || options.defaultWebsocketIdleTimeout || options.maxMemoryLimitMb || options.maxConcurrentConnectionsCeiling || options.allowUnlimitedTimeouts || options.consoleForceHttps || options.setting && options.value);
95718
96229
  if (isAutomation) {
95719
96230
  const result2 = buildAutomationSettingsUpdate(options, currentSettings ?? undefined);
95720
96231
  if ("error" in result2) {
@@ -97796,6 +98307,7 @@ function registerContainersCommands(program2) {
97796
98307
  containers.command("start").description("Start a stopped container").requiredOption("-p, --project-id <id>", "Project ID").requiredOption("-e, --environment-id <id>", "Environment ID").requiredOption("-c, --container-id <id>", "Container ID").action(startContainerAction);
97797
98308
  containers.command("stop").description("Stop a running container").requiredOption("-p, --project-id <id>", "Project ID").requiredOption("-e, --environment-id <id>", "Environment ID").requiredOption("-c, --container-id <id>", "Container ID").option("-f, --force", "Skip confirmation").action(stopContainerAction);
97798
98309
  containers.command("restart").description("Restart a container").requiredOption("-p, --project-id <id>", "Project ID").requiredOption("-e, --environment-id <id>", "Environment ID").requiredOption("-c, --container-id <id>", "Container ID").action(restartContainerAction);
98310
+ containers.command("history").description("List every container that has ever run in an environment, including ones replaced by a later redeploy").requiredOption("-p, --project-id <id>", "Project ID").requiredOption("-e, --environment-id <id>", "Environment ID").option("--json", "Output in JSON format").action(listContainerHistoryAction);
97799
98311
  containers.command("metrics").description("Get container resource metrics (all containers if no container ID specified)").requiredOption("-p, --project-id <id>", "Project ID").requiredOption("-e, --environment-id <id>", "Environment ID").option("-c, --container-id <id>", "Container ID (optional - shows all if not specified)").option("--json", "Output in JSON format").option("-w, --watch", "Watch mode - continuously update metrics").option("-i, --interval <seconds>", "Refresh interval in seconds (default: 2)", "2").action(getContainerMetricsAction);
97800
98312
  }
97801
98313
  async function listContainersAction(options) {
@@ -97874,6 +98386,53 @@ async function listContainersAction(options) {
97874
98386
  printTable(all, baseColumns, { style: "minimal" });
97875
98387
  newline();
97876
98388
  }
98389
+ async function listContainerHistoryAction(options) {
98390
+ await requireAuth();
98391
+ await setupClient();
98392
+ const projId = parseInt(options.projectId, 10);
98393
+ const envId = parseInt(options.environmentId, 10);
98394
+ if (isNaN(projId) || isNaN(envId)) {
98395
+ warning2("Invalid project or environment ID");
98396
+ return;
98397
+ }
98398
+ const containers = await withSpinner("Fetching container history...", async () => {
98399
+ const { data, error: error3 } = await listContainerHistory({
98400
+ client,
98401
+ path: { project_id: projId, environment_id: envId }
98402
+ });
98403
+ if (error3)
98404
+ throw new Error(getErrorMessage(error3));
98405
+ return data?.containers ?? [];
98406
+ });
98407
+ if (options.json) {
98408
+ json(containers);
98409
+ return;
98410
+ }
98411
+ newline();
98412
+ header(`${icons.info} Container history (${containers.length})`);
98413
+ if (containers.length === 0) {
98414
+ info2("No containers have ever run in this environment");
98415
+ newline();
98416
+ return;
98417
+ }
98418
+ const columns = [
98419
+ { header: "ID", key: "container_id", width: 16, color: (v) => colors.muted(v.slice(0, 12) + "...") },
98420
+ { header: "Name", key: "container_name", color: (v) => colors.bold(v) },
98421
+ {
98422
+ header: "Status",
98423
+ accessor: (c) => c.is_current ? "current" : "replaced",
98424
+ color: (v) => statusBadge(v === "current" ? "active" : "inactive")
98425
+ },
98426
+ { header: "Deployed", key: "deployed_at", color: (v) => colors.muted(new Date(v).toLocaleString()) },
98427
+ {
98428
+ header: "Removed",
98429
+ accessor: (c) => c.deleted_at ? new Date(c.deleted_at).toLocaleString() : "—",
98430
+ color: (v) => colors.muted(v)
98431
+ }
98432
+ ];
98433
+ printTable(containers, columns, { style: "minimal" });
98434
+ newline();
98435
+ }
97877
98436
  async function showContainer(options) {
97878
98437
  await requireAuth();
97879
98438
  await setupClient();
@@ -98302,8 +98861,94 @@ async function watchMetrics(projectId, environmentId, containerIds, intervalMs)
98302
98861
  console.log("\x1B[?25h");
98303
98862
  }
98304
98863
 
98864
+ // src/commands/cluster/index.ts
98865
+ init_spinner();
98866
+ init_output();
98867
+ var STALE_SYNC_THRESHOLD_SECONDS = 120;
98868
+ function classifyNodeDnsHealth(entry) {
98869
+ if (entry.dns_resolver_running === null)
98870
+ return "unknown";
98871
+ if (!entry.dns_resolver_running)
98872
+ return "disabled";
98873
+ if (entry.dns_resolver_tasks_alive === false)
98874
+ return "unhealthy";
98875
+ if (entry.dns_resolver_consecutive_failures > 0)
98876
+ return "degraded";
98877
+ if (entry.seconds_since_last_sync !== null && entry.seconds_since_last_sync > STALE_SYNC_THRESHOLD_SECONDS) {
98878
+ return "degraded";
98879
+ }
98880
+ return "healthy";
98881
+ }
98882
+ function formatSyncAge(entry) {
98883
+ if (entry.dns_resolver_last_sync_at === null)
98884
+ return "never";
98885
+ return formatRelativeTime(entry.dns_resolver_last_sync_at);
98886
+ }
98887
+ function registerClusterCommands(program2) {
98888
+ const cluster = program2.command("cluster").description("Cluster-wide multi-node operations");
98889
+ const dns = cluster.command("dns").description("Cluster DNS resolver (ADR-024) operations");
98890
+ dns.command("status").description("Show whether cluster DNS is healthy across every node — resolver status, last sync, and " + "errors — without SSHing into a node to read logs").option("--json", "Output in JSON format").action(dnsStatusAction);
98891
+ }
98892
+ async function dnsStatusAction(options) {
98893
+ await requireAuth();
98894
+ await setupClient();
98895
+ const result2 = await withSpinner("Fetching cluster DNS status...", async () => {
98896
+ const { data, error: error3 } = await client.get({
98897
+ url: "cluster/dns/status"
98898
+ });
98899
+ if (error3 || !data) {
98900
+ throw new Error(getErrorMessage(error3));
98901
+ }
98902
+ return data;
98903
+ });
98904
+ if (options.json) {
98905
+ json(result2);
98906
+ return;
98907
+ }
98908
+ newline();
98909
+ header(`${icons.globe} Cluster DNS Status`);
98910
+ keyValue("Cluster DNS enabled", result2.cluster_dns_enabled ? colors.success("yes") : colors.muted("no"));
98911
+ keyValue("Total DNS records", result2.total_record_count);
98912
+ if (result2.nodes.length === 0) {
98913
+ newline();
98914
+ console.log(colors.muted(" No nodes registered"));
98915
+ newline();
98916
+ return;
98917
+ }
98918
+ newline();
98919
+ const columns = [
98920
+ { header: "Node", key: "node_name", color: (v) => colors.bold(v) },
98921
+ { header: "Node Status", accessor: (n) => n.node_status, color: (v) => statusBadge(v) },
98922
+ {
98923
+ header: "Resolver",
98924
+ accessor: (n) => classifyNodeDnsHealth(n),
98925
+ color: (v) => statusBadge(v)
98926
+ },
98927
+ { header: "Last Sync", accessor: (n) => formatSyncAge(n) },
98928
+ {
98929
+ header: "Failures",
98930
+ accessor: (n) => n.dns_resolver_consecutive_failures.toString(),
98931
+ color: (v) => parseInt(v, 10) > 0 ? colors.error(v) : colors.muted(v)
98932
+ },
98933
+ {
98934
+ header: "Records",
98935
+ accessor: (n) => n.dns_resolver_record_count === null ? "-" : n.dns_resolver_record_count.toString()
98936
+ }
98937
+ ];
98938
+ printTable(result2.nodes, columns, { style: "minimal" });
98939
+ const withErrors = result2.nodes.filter((n) => n.dns_resolver_last_error);
98940
+ if (withErrors.length > 0) {
98941
+ newline();
98942
+ console.log(colors.muted(" Last errors:"));
98943
+ for (const node of withErrors) {
98944
+ console.log(` ${colors.bold(node.node_name)}: ${colors.error(node.dns_resolver_last_error ?? "")}`);
98945
+ }
98946
+ }
98947
+ newline();
98948
+ }
98949
+
98305
98950
  // src/commands/docs.ts
98306
- import { writeFile as writeFile6 } from "node:fs/promises";
98951
+ import { writeFile as writeFile7 } from "node:fs/promises";
98307
98952
 
98308
98953
  // src/cli.ts
98309
98954
  init_source();
@@ -98646,7 +99291,7 @@ function registerErrorsCommands(program2) {
98646
99291
  errors8.command("events").description("List events in an error group").requiredOption("--project-id <id>", "Project ID").requiredOption("--group-id <id>", "Error group ID").option("--page <page>", "Page number").option("--page-size <size>", "Page size").option("--json", "Output in JSON format").action(listErrorEventsAction);
98647
99292
  errors8.command("event").description("Show a specific error event").requiredOption("--project-id <id>", "Project ID").requiredOption("--group-id <id>", "Error group ID").requiredOption("--event-id <id>", "Error event ID").option("--json", "Output in JSON format").action(showErrorEvent);
98648
99293
  errors8.command("stats").description("Get error statistics for a project").requiredOption("--project-id <id>", "Project ID").option("--json", "Output in JSON format").action(getErrorStatsAction);
98649
- errors8.command("timeline").description("Get error time series data").requiredOption("--project-id <id>", "Project ID").option("--days <days>", "Number of days to show", "7").option("--bucket <bucket>", 'Time bucket size (e.g., "1h", "15m", "1d")', "1h").option("--json", "Output in JSON format").action(getErrorTimelineAction);
99294
+ errors8.command("timeline").description("Get error time series data").requiredOption("--project-id <id>", "Project ID").option("--days <days>", "Number of days to show", "7").option("--bucket <bucket>", 'Time bucket size (e.g., "1h", "15m", "1d")', "1h").option("--environment-id <id>", "Filter chart data to a specific environment ID").option("--json", "Output in JSON format").action(getErrorTimelineAction);
98650
99295
  errors8.command("dashboard").description("Get error dashboard statistics").requiredOption("--project-id <id>", "Project ID").option("--days <days>", "Number of days to show", "7").option("--compare", "Compare to previous period").option("--json", "Output in JSON format").action(getErrorDashboardAction);
98651
99296
  const sourcemaps = errors8.command("sourcemaps").alias("sm").description("Manage source maps for error symbolication");
98652
99297
  sourcemaps.command("upload").description("Upload a source map file for a release").requiredOption("--project-id <id>", "Project ID").requiredOption("--release <version>", "Release version (e.g. commit SHA)").requiredOption("--file <path>", "Path to the .map file").option("--file-path <urlpath>", "URL path in stack traces (e.g. ~/assets/main.js)").option("--dist <dist>", "Distribution identifier").action(uploadSourceMap2);
@@ -98931,6 +99576,7 @@ async function getErrorTimelineAction(options) {
98931
99576
  const endTime = new Date;
98932
99577
  const startTime = new Date;
98933
99578
  startTime.setDate(startTime.getDate() - days);
99579
+ const environmentId = options.environmentId ? parseInt(options.environmentId, 10) : undefined;
98934
99580
  const timeSeries = await withSpinner("Fetching error timeline...", async () => {
98935
99581
  const { data, error: error3 } = await getErrorTimeSeries({
98936
99582
  client,
@@ -98938,7 +99584,8 @@ async function getErrorTimelineAction(options) {
98938
99584
  query: {
98939
99585
  start_time: startTime.toISOString(),
98940
99586
  end_time: endTime.toISOString(),
98941
- bucket: options.bucket
99587
+ bucket: options.bucket,
99588
+ ...environmentId && { environment_id: environmentId }
98942
99589
  }
98943
99590
  });
98944
99591
  if (error3) {
@@ -100710,6 +101357,178 @@ async function testInstanceDefaultAction(id, options) {
100710
101357
  newline();
100711
101358
  }
100712
101359
 
101360
+ // src/commands/otel/ingest-errors.ts
101361
+ init_sdk_gen();
101362
+ init_spinner();
101363
+ init_output();
101364
+ var ERROR_CLASS_WORDS = {
101365
+ clickhouse: "ClickHouse",
101366
+ postgres: "Postgres",
101367
+ conn: "connection",
101368
+ s3: "S3",
101369
+ io: "I/O"
101370
+ };
101371
+ function humanizeErrorClass(errorClass) {
101372
+ const words2 = errorClass.split("_").map((w) => ERROR_CLASS_WORDS[w] ?? w).join(" ");
101373
+ return words2.charAt(0).toUpperCase() + words2.slice(1);
101374
+ }
101375
+ async function otelIngestErrors(options) {
101376
+ await requireAuth();
101377
+ await setupClient();
101378
+ const limit = options.limit ? parseInt(options.limit, 10) : undefined;
101379
+ if (limit !== undefined && (Number.isNaN(limit) || limit < 1)) {
101380
+ throw new Error(`Invalid --limit "${options.limit}". Must be a positive integer.`);
101381
+ }
101382
+ const data = await withSpinner("Fetching ingest errors...", async () => {
101383
+ const { data: data2, error: error3 } = await getIngestErrors({
101384
+ client,
101385
+ query: limit === undefined ? {} : { limit }
101386
+ });
101387
+ if (error3)
101388
+ throw new Error(getErrorMessage(error3));
101389
+ return data2;
101390
+ });
101391
+ const errors8 = data?.errors ?? [];
101392
+ if (options.json) {
101393
+ json({ count: errors8.length, errors: errors8 });
101394
+ return;
101395
+ }
101396
+ header("OTel ingest errors");
101397
+ if (errors8.length === 0) {
101398
+ newline();
101399
+ console.log(colors.muted(" No ingest errors recorded in the last 7 days."));
101400
+ console.log(colors.muted(" Entries appear here only when a storage write fails after all retries."));
101401
+ newline();
101402
+ return;
101403
+ }
101404
+ const columns = [
101405
+ { header: "Signal", accessor: (e) => e.signal_type, align: "left" },
101406
+ {
101407
+ header: "Reason",
101408
+ accessor: (e) => humanizeErrorClass(e.error_class),
101409
+ align: "left"
101410
+ },
101411
+ { header: "Count", accessor: (e) => e.count, align: "right" },
101412
+ {
101413
+ header: "Last seen",
101414
+ accessor: (e) => formatRelativeTime(e.last_seen),
101415
+ align: "right"
101416
+ },
101417
+ {
101418
+ header: "Sample message",
101419
+ accessor: (e) => truncate(e.sample_message, 60),
101420
+ align: "left"
101421
+ }
101422
+ ];
101423
+ printTable(errors8, columns, { style: "minimal" });
101424
+ newline();
101425
+ console.log(colors.muted(` ${errors8.length} failure group(s). Each entry means data was dropped after retries were exhausted.`));
101426
+ newline();
101427
+ }
101428
+
101429
+ // src/commands/otel/pipeline-history.ts
101430
+ init_sdk_gen();
101431
+ init_spinner();
101432
+ init_output();
101433
+ var SERVER_PRESETS = new Set(["1h", "6h", "24h", "7d"]);
101434
+ function summarize(series) {
101435
+ const values2 = series.points.map((p) => p.value);
101436
+ if (values2.length === 0) {
101437
+ return { name: series.name, buckets: 0, peak: 0, mean: 0, last: 0 };
101438
+ }
101439
+ const sum2 = values2.reduce((a, b) => a + b, 0);
101440
+ return {
101441
+ name: series.name,
101442
+ buckets: values2.length,
101443
+ peak: Math.max(...values2),
101444
+ mean: sum2 / values2.length,
101445
+ last: values2[values2.length - 1] ?? 0
101446
+ };
101447
+ }
101448
+ function formatValue(v) {
101449
+ return Number.isInteger(v) ? String(v) : v.toFixed(2);
101450
+ }
101451
+ async function otelPipelineHistory(options) {
101452
+ await requireAuth();
101453
+ await setupClient();
101454
+ const query = {};
101455
+ let periodLabel;
101456
+ if (options.startTime || options.endTime) {
101457
+ if (!options.startTime || !options.endTime) {
101458
+ throw new Error("--start-time and --end-time must be provided together (or use --period).");
101459
+ }
101460
+ query.start_time = options.startTime;
101461
+ query.end_time = options.endTime;
101462
+ periodLabel = "custom range";
101463
+ } else {
101464
+ const period = options.period ?? "24h";
101465
+ if (SERVER_PRESETS.has(period)) {
101466
+ query.range = period;
101467
+ periodLabel = period;
101468
+ } else {
101469
+ const parsed = parsePeriod(period);
101470
+ query.start_time = parsed.startDate;
101471
+ query.end_time = parsed.endDate;
101472
+ periodLabel = parsed.label;
101473
+ }
101474
+ }
101475
+ const data = await withSpinner("Fetching pipeline history...", async () => {
101476
+ const { data: data2, error: error3 } = await getPipelineHistory({ client, query });
101477
+ if (error3)
101478
+ throw new Error(getErrorMessage(error3));
101479
+ return data2;
101480
+ });
101481
+ if (options.json) {
101482
+ json(data);
101483
+ return;
101484
+ }
101485
+ const series = data?.series ?? [];
101486
+ const interval = data?.sample_interval_seconds ?? 60;
101487
+ header(`OTel pipeline history (${periodLabel})`);
101488
+ if (series.length === 0 || series.every((s) => s.points.length === 0)) {
101489
+ newline();
101490
+ console.log(colors.muted(" No samples recorded in this window."));
101491
+ console.log(colors.muted(` The pipeline sampler writes every ${interval}s, so a server started recently has no history yet.`));
101492
+ newline();
101493
+ return;
101494
+ }
101495
+ const summaries = series.map(summarize);
101496
+ const columns = [
101497
+ { header: "Metric", accessor: (s) => s.name, align: "left" },
101498
+ { header: "Peak", accessor: (s) => formatValue(s.peak), align: "right" },
101499
+ { header: "Avg", accessor: (s) => formatValue(s.mean), align: "right" },
101500
+ { header: "Last", accessor: (s) => formatValue(s.last), align: "right" },
101501
+ { header: "Buckets", accessor: (s) => s.buckets, align: "right" }
101502
+ ];
101503
+ printTable(summaries, columns, { style: "minimal" });
101504
+ newline();
101505
+ console.log(colors.muted(` Window ${data?.start_time} to ${data?.end_time}, ${data?.step_seconds}s buckets.`));
101506
+ console.log(colors.muted(` Values are counts per ${interval}s sample, not window totals. Use --json for every bucket.`));
101507
+ newline();
101508
+ }
101509
+
101510
+ // src/commands/otel/index.ts
101511
+ function registerOtelCommands(program2) {
101512
+ const otel = program2.command("otel").description('Inspect the OTLP ingest pipeline itself — throughput, drops and failure reasons (server-wide, not project-scoped; see "temps metrics" to query ingested application metrics)');
101513
+ otel.command("ingest-errors").description("Show why ingest batches were dropped, grouped by signal and failure reason").option("--limit <n>", "Max failure groups to return (default: 20, server cap: 100)").option("--json", "Output in JSON format").action(otelIngestErrors);
101514
+ otel.command("pipeline-history").description("Show pipeline counter trends over time (received/stored/dropped per signal)").option("--period <period>", "Time period: 1h, 6h, 24h, 7d (server presets), or today/<n>h/<n>d resolved locally", "24h").option("--start-time <iso>", "Explicit window start (RFC 3339) — overrides --period").option("--end-time <iso>", "Explicit window end (RFC 3339) — overrides --period").option("--json", "Output in JSON format").action(otelPipelineHistory);
101515
+ otel.addHelpText("after", `
101516
+ Triage workflow — a drop counter moved, now find out why:
101517
+ $ temps otel pipeline-history --period 24h # when did it happen?
101518
+ $ temps otel ingest-errors # what failed, and how often?
101519
+
101520
+ Examples:
101521
+ $ temps otel ingest-errors --limit 50
101522
+ $ temps otel ingest-errors --json
101523
+ $ temps otel pipeline-history --period 7d
101524
+ $ temps otel pipeline-history \\
101525
+ --start-time 2026-08-24T00:00:00Z --end-time 2026-08-25T00:00:00Z --json
101526
+
101527
+ Notes:
101528
+ Ingest errors are recorded only after a storage write exhausts its retries,
101529
+ so any entry means data was actually lost. Windows are capped at 7 days.`);
101530
+ }
101531
+
100713
101532
  // src/commands/kv/index.ts
100714
101533
  init_output();
100715
101534
  function registerKvCommands(program2) {
@@ -100818,7 +101637,7 @@ function assertValueType(raw) {
100818
101637
  }
100819
101638
  throw new Error(`Invalid type "${raw}". Must be one of: bool, string, number, json`);
100820
101639
  }
100821
- function formatValue(value) {
101640
+ function formatValue2(value) {
100822
101641
  if (value === null || value === undefined)
100823
101642
  return colors.dim("(inherits default)");
100824
101643
  return typeof value === "string" ? value : JSON.stringify(value);
@@ -100826,14 +101645,14 @@ function formatValue(value) {
100826
101645
  function effectiveValue(flag, environmentId) {
100827
101646
  const override = flag.environments?.find((e) => e.environment_id === environmentId);
100828
101647
  if (!override)
100829
- return `${formatValue(flag.default_value)} ${colors.dim("(default)")}`;
101648
+ return `${formatValue2(flag.default_value)} ${colors.dim("(default)")}`;
100830
101649
  if (!override.enabled) {
100831
- return `${formatValue(flag.default_value)} ${colors.warning("(disabled)")}`;
101650
+ return `${formatValue2(flag.default_value)} ${colors.warning("(disabled)")}`;
100832
101651
  }
100833
101652
  if (override.value === null || override.value === undefined) {
100834
- return `${formatValue(flag.default_value)} ${colors.dim("(default)")}`;
101653
+ return `${formatValue2(flag.default_value)} ${colors.dim("(default)")}`;
100835
101654
  }
100836
- return formatValue(override.value);
101655
+ return formatValue2(override.value);
100837
101656
  }
100838
101657
  async function listFlagsCmd(options) {
100839
101658
  await requireAuth();
@@ -100870,7 +101689,7 @@ async function listFlagsCmd(options) {
100870
101689
  const columns = [
100871
101690
  { header: "Key", key: "key", color: (v) => colors.bold(v) },
100872
101691
  { header: "Type", key: "value_type" },
100873
- environmentId !== undefined ? { header: options.environment, accessor: (f) => effectiveValue(f, environmentId) } : { header: "Default", accessor: (f) => formatValue(f.default_value) },
101692
+ environmentId !== undefined ? { header: options.environment, accessor: (f) => effectiveValue(f, environmentId) } : { header: "Default", accessor: (f) => formatValue2(f.default_value) },
100874
101693
  { header: "Client", accessor: (f) => f.client_visible ? "yes" : "no" },
100875
101694
  { header: "Status", accessor: (f) => f.archived_at ? "archived" : "active", color: (value, f) => f.archived_at ? colors.dim(value) : value }
100876
101695
  ];
@@ -100901,7 +101720,7 @@ async function getFlagCmd(key, options) {
100901
101720
  newline();
100902
101721
  header(`${icons.folder} ${flag.key}`);
100903
101722
  keyValue("Type", flag.value_type);
100904
- keyValue("Default", formatValue(flag.default_value));
101723
+ keyValue("Default", formatValue2(flag.default_value));
100905
101724
  keyValue("Description", flag.description ?? "-");
100906
101725
  keyValue("Client visible", flag.client_visible ? "yes" : "no");
100907
101726
  keyValue("Last evaluated by an app", flag.last_evaluated_at ?? colors.dim("never"));
@@ -100915,7 +101734,7 @@ async function getFlagCmd(key, options) {
100915
101734
  printTable(flag.environments, [
100916
101735
  { header: "Environment ID", accessor: (e) => String(e.environment_id) },
100917
101736
  { header: "Enabled", accessor: (e) => e.enabled ? "yes" : "no (kill switch)", color: (value, e) => e.enabled ? value : colors.warning(value) },
100918
- { header: "Value", accessor: (e) => formatValue(e.value) }
101737
+ { header: "Value", accessor: (e) => formatValue2(e.value) }
100919
101738
  ], { style: "minimal" });
100920
101739
  }
100921
101740
  newline();
@@ -100949,7 +101768,7 @@ async function createFlagCmd(key, options) {
100949
101768
  return;
100950
101769
  }
100951
101770
  newline();
100952
- success2(`Created flag ${colors.bold(flag.key)} (${flag.value_type}, default ${formatValue(flag.default_value)})`);
101771
+ success2(`Created flag ${colors.bold(flag.key)} (${flag.value_type}, default ${formatValue2(flag.default_value)})`);
100953
101772
  if (!flag.client_visible) {
100954
101773
  info2("Server-only. Pass --client-visible to expose it to browsers.");
100955
101774
  }
@@ -103191,7 +104010,7 @@ function resolveIpAccessAction(rawAction) {
103191
104010
  function registerIpAccessCommands(program2) {
103192
104011
  const ipAccess = program2.command("ip-access").alias("ipa").description("Manage IP access control rules");
103193
104012
  ipAccess.command("list").alias("ls").description("List all IP access control rules").option("--json", "Output in JSON format").action(listIpAccessAction);
103194
- ipAccess.command("create").alias("add").description("Create a new IP access control rule").option("--ip <ip_or_cidr>", 'IP address or CIDR range (e.g., "192.168.1.1" or "10.0.0.0/24")').option("--action <action>", 'Action to take: "allow" or "deny"').option("--description <desc>", "Optional description/reason for the rule").option("-y, --yes", "Skip confirmation prompts (for automation)").action(createIpAccessAction);
104013
+ ipAccess.command("create").alias("add").description("Create a new IP access control rule").option("--ip <ip_or_cidr>", 'IPv4 or IPv6 address or CIDR range (e.g., "192.168.1.1", "10.0.0.0/24", or "2001:db8::/32")').option("--action <action>", 'Action to take: "allow" or "deny"').option("--description <desc>", "Optional description/reason for the rule").option("-y, --yes", "Skip confirmation prompts (for automation)").action(createIpAccessAction);
103195
104014
  ipAccess.command("show").description("Show IP access control rule details").requiredOption("--id <id>", "Rule ID").option("--json", "Output in JSON format").action(showIpAccessAction);
103196
104015
  ipAccess.command("update").description("Update an IP access control rule").requiredOption("--id <id>", "Rule ID").option("--ip <ip>", "New IP address or CIDR range").option("--action <action>", 'New action: "allow" or "deny"').option("--description <desc>", "New description/reason").action(updateIpAccessAction);
103197
104016
  ipAccess.command("remove").alias("rm").description("Delete an IP access control rule").requiredOption("--id <id>", "Rule ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(removeIpAccessAction);
@@ -103863,7 +104682,19 @@ function printProxyLogDetail(log) {
103863
104682
  header("Error");
103864
104683
  console.log(` ${colors.error(log.error_message)}`);
103865
104684
  }
104685
+ printHeaderSection("Request Headers", log.request_headers);
104686
+ printHeaderSection("Response Headers", log.response_headers);
104687
+ newline();
104688
+ }
104689
+ function printHeaderSection(title, headers) {
104690
+ const entries = Object.entries(headers ?? {});
104691
+ if (entries.length === 0)
104692
+ return;
103866
104693
  newline();
104694
+ header(title);
104695
+ for (const [name, value] of entries) {
104696
+ keyValue(name, value === "[REDACTED]" ? colors.dim(value) : value);
104697
+ }
103867
104698
  }
103868
104699
  function formatBytes6(bytes) {
103869
104700
  if (bytes === 0)
@@ -103889,6 +104720,100 @@ function registerEmailDomainsCommands(program2) {
103889
104720
  emailDomains.command("dns-records").description("Get DNS records for an email domain").requiredOption("--id <id>", "Email domain ID").option("--json", "Output in JSON format").action(dnsRecordsAction);
103890
104721
  emailDomains.command("setup-dns").description("Setup DNS records using a configured DNS provider").requiredOption("--id <id>", "Email domain ID").option("--dns-provider-id <id>", "DNS provider ID to use").action(setupDnsAction);
103891
104722
  emailDomains.command("verify").description("Verify an email domain DNS configuration").requiredOption("--id <id>", "Email domain ID").action(verifyDomainAction);
104723
+ emailDomains.command("projects").description("List projects authorized to send through an email domain").requiredOption("--id <id>", "Email domain ID").option("--json", "Output in JSON format").action(listAuthorizedProjectsAction);
104724
+ emailDomains.command("authorize-project").description("Authorize a project to send through an email domain").requiredOption("--id <id>", "Email domain ID").requiredOption("--project-id <id>", "Project ID").action(authorizeProjectAction);
104725
+ emailDomains.command("revoke-project").description("Revoke a project's permission to send through an email domain").requiredOption("--id <id>", "Email domain ID").requiredOption("--project-id <id>", "Project ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(revokeProjectAction);
104726
+ }
104727
+ function parseAuthorizationIds(options) {
104728
+ const domainId = parsePositiveSafeInteger(options.id);
104729
+ const projectId = parsePositiveSafeInteger(options.projectId);
104730
+ if (domainId === undefined || projectId === undefined) {
104731
+ warning2("Domain ID and project ID must both be positive integers");
104732
+ return;
104733
+ }
104734
+ return { domainId, projectId };
104735
+ }
104736
+ function parsePositiveSafeInteger(value) {
104737
+ if (!/^[1-9]\d*$/.test(value))
104738
+ return;
104739
+ const parsed = Number(value);
104740
+ return Number.isSafeInteger(parsed) ? parsed : undefined;
104741
+ }
104742
+ async function listAuthorizedProjectsAction(options) {
104743
+ await requireAuth();
104744
+ await setupClient();
104745
+ const domainId = parsePositiveSafeInteger(options.id);
104746
+ if (domainId === undefined) {
104747
+ warning2("Domain ID must be a positive integer");
104748
+ return;
104749
+ }
104750
+ const projects = await withSpinner("Fetching authorized projects...", async () => {
104751
+ const { data, error: error3 } = await listEmailDomainProjects({ client, path: { id: domainId } });
104752
+ if (error3)
104753
+ throw new Error(getErrorMessage(error3));
104754
+ return data ?? [];
104755
+ });
104756
+ if (options.json) {
104757
+ json(projects);
104758
+ return;
104759
+ }
104760
+ newline();
104761
+ header(`${icons.key} Authorized Projects (${projects.length})`);
104762
+ if (projects.length === 0) {
104763
+ info2("No projects can send through this email domain yet");
104764
+ info2(`Run: temps email-domains authorize-project --id ${domainId} --project-id <id>`);
104765
+ newline();
104766
+ return;
104767
+ }
104768
+ const columns = [
104769
+ { header: "ID", key: "id", width: 6 },
104770
+ { header: "Project", key: "name", color: (value) => colors.bold(value) },
104771
+ { header: "Slug", key: "slug", color: (value) => colors.muted(value) }
104772
+ ];
104773
+ printTable(projects, columns, { style: "minimal" });
104774
+ newline();
104775
+ }
104776
+ async function authorizeProjectAction(options) {
104777
+ await requireAuth();
104778
+ await setupClient();
104779
+ const ids = parseAuthorizationIds(options);
104780
+ if (!ids)
104781
+ return;
104782
+ await withSpinner("Authorizing project...", async () => {
104783
+ const { error: error3 } = await authorizeEmailDomainProject({
104784
+ client,
104785
+ path: { id: ids.domainId, project_id: ids.projectId }
104786
+ });
104787
+ if (error3)
104788
+ throw new Error(getErrorMessage(error3));
104789
+ });
104790
+ success2(`Project ${ids.projectId} can now send through email domain ${ids.domainId}`);
104791
+ }
104792
+ async function revokeProjectAction(options) {
104793
+ await requireAuth();
104794
+ await setupClient();
104795
+ const ids = parseAuthorizationIds(options);
104796
+ if (!ids)
104797
+ return;
104798
+ if (!options.force && !options.yes) {
104799
+ const confirmed = await promptConfirm({
104800
+ message: `Revoke project ${ids.projectId} from email domain ${ids.domainId}?`,
104801
+ default: false
104802
+ });
104803
+ if (!confirmed) {
104804
+ info2("Cancelled");
104805
+ return;
104806
+ }
104807
+ }
104808
+ await withSpinner("Revoking project authorization...", async () => {
104809
+ const { error: error3 } = await revokeEmailDomainProject({
104810
+ client,
104811
+ path: { id: ids.domainId, project_id: ids.projectId }
104812
+ });
104813
+ if (error3)
104814
+ throw new Error(getErrorMessage(error3));
104815
+ });
104816
+ success2(`Project ${ids.projectId} can no longer send through email domain ${ids.domainId}`);
103892
104817
  }
103893
104818
  async function listDomainsAction(options) {
103894
104819
  await requireAuth();
@@ -105220,9 +106145,9 @@ function registerLoadBalancerCommands(program2) {
105220
106145
  const lb = program2.command("load-balancer").alias("lb").description("Manage load balancer routes");
105221
106146
  lb.command("list").alias("ls").description("List load balancer routes").option("--json", "Output in JSON format").action(listRoutesAction);
105222
106147
  lb.command("create").alias("add").description("Create a load balancer route").option("-d, --domain <domain>", "Domain for the route").option("-t, --target <target>", "Target upstream URL").option("-y, --yes", "Skip confirmation prompts (for automation)").action(createRouteAction);
105223
- lb.command("show").description("Show route details").requiredOption("-d, --domain <domain>", "Domain of the route").option("--json", "Output in JSON format").action(showRoute);
106148
+ lb.command("show").description("Show route details").requiredOption("-d, --domain <domain>", "Domain of the route").option("--json", "Output in JSON format").action(showRoute2);
105224
106149
  lb.command("update").description("Update a load balancer route").requiredOption("-d, --domain <domain>", "Domain of the route").option("-t, --target <target>", "New target upstream URL").action(updateRouteAction);
105225
- lb.command("remove").alias("rm").description("Delete a load balancer route").requiredOption("-d, --domain <domain>", "Domain of the route").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(removeRoute);
106150
+ lb.command("remove").alias("rm").description("Delete a load balancer route").requiredOption("-d, --domain <domain>", "Domain of the route").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(removeRoute2);
105226
106151
  }
105227
106152
  async function listRoutesAction(options) {
105228
106153
  await requireAuth();
@@ -105306,7 +106231,7 @@ async function createRouteAction(options) {
105306
106231
  success2(`Route created for ${domain2}`);
105307
106232
  info2(`Target: ${target}`);
105308
106233
  }
105309
- async function showRoute(options) {
106234
+ async function showRoute2(options) {
105310
106235
  await requireAuth();
105311
106236
  await setupClient();
105312
106237
  const domain2 = options.domain;
@@ -105380,7 +106305,7 @@ async function updateRouteAction(options) {
105380
106305
  success2(`Route updated for ${domain2}`);
105381
106306
  info2(`New target: ${target}`);
105382
106307
  }
105383
- async function removeRoute(options) {
106308
+ async function removeRoute2(options) {
105384
106309
  await requireAuth();
105385
106310
  await setupClient();
105386
106311
  const domain2 = options.domain;
@@ -107765,6 +108690,119 @@ function formatPresetPort(port) {
107765
108690
 
107766
108691
  // src/commands/platform/index.ts
107767
108692
  init_sdk_gen();
108693
+
108694
+ // src/commands/platform/alert-rules.ts
108695
+ init_sdk_gen();
108696
+ init_spinner();
108697
+ init_output();
108698
+ var CONTROL_PLANE_NODE_ID = 0;
108699
+ function parseNodeId(raw) {
108700
+ if (raw === undefined)
108701
+ return CONTROL_PLANE_NODE_ID;
108702
+ const id = Number(raw);
108703
+ if (!Number.isInteger(id) || id < 0) {
108704
+ throw new Error(`Invalid --node "${raw}": expected a non-negative integer node ID`);
108705
+ }
108706
+ return id;
108707
+ }
108708
+ async function platformAlertRulesList(options) {
108709
+ await requireAuth();
108710
+ await setupClient();
108711
+ const nodeId = parseNodeId(options.node);
108712
+ const rules = await withSpinner("Fetching node alert rules...", async () => {
108713
+ const { data, error: error3 } = await nodeMetricsGetAlertRules({ client, path: { id: nodeId } });
108714
+ if (error3)
108715
+ throw new Error(getErrorMessage(error3));
108716
+ return data ?? [];
108717
+ });
108718
+ if (options.json) {
108719
+ json({ node_id: nodeId, rules });
108720
+ return;
108721
+ }
108722
+ header(`Platform Alert Rules — node ${nodeId}`);
108723
+ newline();
108724
+ if (rules.length === 0) {
108725
+ console.log(colors.muted(" No alert rules on this node. The control-plane defaults are seeded on server startup."));
108726
+ newline();
108727
+ return;
108728
+ }
108729
+ for (const rule of rules) {
108730
+ const state = rule.enabled ? colors.success("enabled") : colors.muted("disabled");
108731
+ console.log(` ${colors.bold(String(rule.id))} ${rule.name} ${state}`);
108732
+ console.log(colors.muted(` ${rule.metric_name} ${rule.comparator} ${rule.threshold} ` + `for ${rule.for_duration_secs}s → ${rule.severity}`));
108733
+ if (rule.silenced_until) {
108734
+ console.log(colors.muted(` silenced until ${rule.silenced_until}`));
108735
+ }
108736
+ }
108737
+ newline();
108738
+ console.log(colors.muted(` ${rules.length} rule(s). Retune one with: ` + `temps platform alert-rules set <rule-id> --threshold <n>`));
108739
+ newline();
108740
+ }
108741
+ async function platformAlertRulesSet(ruleId, options) {
108742
+ await requireAuth();
108743
+ await setupClient();
108744
+ const nodeId = parseNodeId(options.node);
108745
+ const id = Number(ruleId);
108746
+ if (!Number.isInteger(id) || id <= 0) {
108747
+ throw new Error(`Invalid rule ID "${ruleId}": expected a positive integer`);
108748
+ }
108749
+ if (options.enable && options.disable) {
108750
+ throw new Error("--enable and --disable are mutually exclusive");
108751
+ }
108752
+ const body = {};
108753
+ if (options.threshold !== undefined) {
108754
+ const threshold = Number(options.threshold);
108755
+ if (!Number.isFinite(threshold)) {
108756
+ throw new Error(`Invalid --threshold "${options.threshold}": expected a number`);
108757
+ }
108758
+ body.threshold = threshold;
108759
+ }
108760
+ if (options.comparator !== undefined)
108761
+ body.comparator = options.comparator;
108762
+ if (options.severity !== undefined)
108763
+ body.severity = options.severity;
108764
+ if (options.forDuration !== undefined) {
108765
+ const forDuration = Number(options.forDuration);
108766
+ if (!Number.isInteger(forDuration) || forDuration < 0) {
108767
+ throw new Error(`Invalid --for-duration "${options.forDuration}": expected a non-negative integer (seconds)`);
108768
+ }
108769
+ body.for_duration_secs = forDuration;
108770
+ }
108771
+ if (options.enable)
108772
+ body.enabled = true;
108773
+ if (options.disable)
108774
+ body.enabled = false;
108775
+ if (Object.keys(body).length === 0) {
108776
+ throw new Error("Nothing to update. Pass at least one of --threshold, --comparator, --severity, " + "--for-duration, --enable, --disable");
108777
+ }
108778
+ const updated = await withSpinner(`Updating alert rule ${id}...`, async () => {
108779
+ const { data, error: error3 } = await nodeMetricsUpdateAlertRule({
108780
+ client,
108781
+ path: { id: nodeId, rule_id: id },
108782
+ body
108783
+ });
108784
+ if (error3)
108785
+ throw new Error(getErrorMessage(error3));
108786
+ if (!data)
108787
+ throw new Error(`Alert rule ${id} not found on node ${nodeId}`);
108788
+ return data;
108789
+ });
108790
+ if (options.json) {
108791
+ json(updated);
108792
+ return;
108793
+ }
108794
+ success2(`Alert rule ${updated.id} updated`);
108795
+ newline();
108796
+ keyValue("Name", updated.name);
108797
+ keyValue("Metric", updated.metric_name);
108798
+ keyValue("Condition", `${updated.comparator} ${updated.threshold}`);
108799
+ keyValue("For", `${updated.for_duration_secs}s`);
108800
+ keyValue("Severity", updated.severity);
108801
+ keyValue("Enabled", updated.enabled);
108802
+ newline();
108803
+ }
108804
+
108805
+ // src/commands/platform/index.ts
107768
108806
  init_spinner();
107769
108807
  init_prompts();
107770
108808
  init_output();
@@ -107779,6 +108817,17 @@ function registerPlatformCommands(program2) {
107779
108817
  update2.command("check").description("Ask the release API for the newest version on this channel now").option("--json", "Output in JSON format").action(updateCheckAction);
107780
108818
  update2.command("channel [channel]").description('Show or set the release channel: stable, beta, nightly, or "auto" to follow the installed version').option("--json", "Output in JSON format").action(updateChannelAction);
107781
108819
  update2.command("apply").description("Install a release on the server and restart it").option("--version <version>", "Release tag to install (default: newest on this channel)").option("-y, --yes", "Skip the confirmation prompt").option("--json", "Output in JSON format").action(updateApplyAction);
108820
+ const alertRules = platform3.command("alert-rules").description("Inspect and retune the control-plane's own monitoring alert rules");
108821
+ alertRules.command("list").description("List the alert rules watching this node (proxy health, socket exhaustion)").option("--node <id>", "Node ID (default: 0, the control plane)").option("--json", "Output in JSON format").action(platformAlertRulesList);
108822
+ alertRules.command("set <rule-id>").description("Retune, enable, or disable an alert rule on this node").option("--node <id>", "Node ID (default: 0, the control plane)").option("--threshold <n>", "Value the metric must cross to fire").option("--comparator <op>", "Comparison operator: >, >=, <, <=").option("--severity <level>", "Alert severity: warning or critical").option("--for-duration <secs>", "Seconds the condition must hold before firing").option("--enable", "Enable the rule").option("--disable", "Disable the rule (survives the startup re-seed; deleting does not)").option("--json", "Output in JSON format").action(platformAlertRulesSet);
108823
+ alertRules.addHelpText("after", `
108824
+ These rules are seeded automatically on server startup and are update-only:
108825
+ a deleted rule reappears on the next restart, so use --disable to stop one.
108826
+
108827
+ Examples:
108828
+ $ temps platform alert-rules list
108829
+ $ temps platform alert-rules set 39 --threshold 80
108830
+ $ temps platform alert-rules set 39 --disable`);
107782
108831
  }
107783
108832
  async function platformInfoAction(options) {
107784
108833
  await requireAuth();
@@ -109491,6 +110540,9 @@ async function apiPath(path7, options) {
109491
110540
  "last_seen"
109492
110541
  ], [{ dimension: "path", operator: "eq", values: [path7] }], options.sortBy ?? "requests", options.order, `IPs calling ${path7}:`);
109493
110542
  }
110543
+ function resolveApiQueryFilters(options) {
110544
+ return (options.filter ?? []).map(parseFilter);
110545
+ }
109494
110546
  async function apiQuery(options) {
109495
110547
  const dimensions = parseCsv(options.groupBy ?? "", TRAFFIC_DIMENSIONS, "dimension", true);
109496
110548
  const metrics = parseCsv(options.metrics, TRAFFIC_METRICS, "metric");
@@ -109498,7 +110550,7 @@ async function apiQuery(options) {
109498
110550
  const sortBy2 = options.sortBy ? [...TRAFFIC_DIMENSIONS, ...TRAFFIC_METRICS].includes(options.sortBy) ? options.sortBy : (() => {
109499
110551
  throw new Error(`Unknown sort field "${options.sortBy}"`);
109500
110552
  })() : defaultSort;
109501
- await runTrafficAggregation(options, dimensions, metrics, (options.filters ?? []).map(parseFilter), sortBy2, options.order, "API traffic query:");
110553
+ await runTrafficAggregation(options, dimensions, metrics, resolveApiQueryFilters(options), sortBy2, options.order, "API traffic query:");
109502
110554
  }
109503
110555
  async function apiSummary(options) {
109504
110556
  await requireAuth();
@@ -110864,7 +111916,7 @@ async function resolveProjectId7(projectSlug) {
110864
111916
  throw new Error(`Project '${projectSlug}' not found`);
110865
111917
  }
110866
111918
  function registerMcpServersCommands(program2) {
110867
- const mcp = program2.command("mcp-servers").alias("mcp").description("Manage MCP server definitions (global or project-scoped)");
111919
+ const mcp = program2.command("mcp-servers").description("Manage MCP server definitions (global or project-scoped)");
110868
111920
  mcp.command("list").alias("ls").description("List MCP server definitions").option("--global", "List global (platform-wide) MCP servers").option("--project <slug>", "List MCP servers for a specific project").option("--json", "Output in JSON format").action(listAction5);
110869
111921
  mcp.command("create").alias("add").description("Create a new MCP server definition").requiredOption("-n, --name <name>", "MCP server name").requiredOption("-s, --slug <slug>", "MCP server slug (URL-safe identifier)").requiredOption("-c, --config <config>", "MCP server config (JSON). Prefix with @ to read from file (e.g. @./mcp.json)").option("-d, --description <description>", "MCP server description").option("--global", "Create as global (platform-wide) MCP server").option("--project <slug>", "Create MCP server for a specific project").action(createAction4);
110870
111922
  mcp.command("update").description("Update an existing MCP server definition").argument("<slug>", "Slug of the MCP server to update").option("-n, --name <name>", "New name").option("-c, --config <config>", "New config (JSON). Prefix with @ to read from file").option("-d, --description <description>", "New description").option("--global", "Update a global MCP server").option("--project <slug>", "Update a project-scoped MCP server").action(updateAction4);
@@ -111015,6 +112067,2176 @@ async function deleteAction3(slug, options) {
111015
112067
  success2(`MCP server "${slug}" deleted`);
111016
112068
  }
111017
112069
 
112070
+ // src/commands/mcp/index.ts
112071
+ init_sdk_gen();
112072
+ init_output();
112073
+ init_prompts();
112074
+ init_spinner();
112075
+
112076
+ // src/commands/mcp/clients/claude-code.ts
112077
+ import * as fs6 from "node:fs";
112078
+ import * as os5 from "node:os";
112079
+ import * as path8 from "node:path";
112080
+ import { execFileSync as execFileSync3 } from "node:child_process";
112081
+
112082
+ // src/commands/mcp/clients/base.ts
112083
+ import * as fs5 from "node:fs";
112084
+ import * as path7 from "node:path";
112085
+
112086
+ // node_modules/jsonc-parser/lib/esm/impl/scanner.js
112087
+ function createScanner(text, ignoreTrivia = false) {
112088
+ const len = text.length;
112089
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
112090
+ function scanHexDigits(count, exact) {
112091
+ let digits = 0;
112092
+ let value2 = 0;
112093
+ while (digits < count || !exact) {
112094
+ let ch = text.charCodeAt(pos);
112095
+ if (ch >= 48 && ch <= 57) {
112096
+ value2 = value2 * 16 + ch - 48;
112097
+ } else if (ch >= 65 && ch <= 70) {
112098
+ value2 = value2 * 16 + ch - 65 + 10;
112099
+ } else if (ch >= 97 && ch <= 102) {
112100
+ value2 = value2 * 16 + ch - 97 + 10;
112101
+ } else {
112102
+ break;
112103
+ }
112104
+ pos++;
112105
+ digits++;
112106
+ }
112107
+ if (digits < count) {
112108
+ value2 = -1;
112109
+ }
112110
+ return value2;
112111
+ }
112112
+ function setPosition(newPosition) {
112113
+ pos = newPosition;
112114
+ value = "";
112115
+ tokenOffset = 0;
112116
+ token = 16;
112117
+ scanError = 0;
112118
+ }
112119
+ function scanNumber() {
112120
+ let start = pos;
112121
+ if (text.charCodeAt(pos) === 48) {
112122
+ pos++;
112123
+ } else {
112124
+ pos++;
112125
+ while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
112126
+ pos++;
112127
+ }
112128
+ }
112129
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
112130
+ pos++;
112131
+ if (pos < text.length && isDigit2(text.charCodeAt(pos))) {
112132
+ pos++;
112133
+ while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
112134
+ pos++;
112135
+ }
112136
+ } else {
112137
+ scanError = 3;
112138
+ return text.substring(start, pos);
112139
+ }
112140
+ }
112141
+ let end = pos;
112142
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
112143
+ pos++;
112144
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
112145
+ pos++;
112146
+ }
112147
+ if (pos < text.length && isDigit2(text.charCodeAt(pos))) {
112148
+ pos++;
112149
+ while (pos < text.length && isDigit2(text.charCodeAt(pos))) {
112150
+ pos++;
112151
+ }
112152
+ end = pos;
112153
+ } else {
112154
+ scanError = 3;
112155
+ }
112156
+ }
112157
+ return text.substring(start, end);
112158
+ }
112159
+ function scanString() {
112160
+ let result2 = "", start = pos;
112161
+ while (true) {
112162
+ if (pos >= len) {
112163
+ result2 += text.substring(start, pos);
112164
+ scanError = 2;
112165
+ break;
112166
+ }
112167
+ const ch = text.charCodeAt(pos);
112168
+ if (ch === 34) {
112169
+ result2 += text.substring(start, pos);
112170
+ pos++;
112171
+ break;
112172
+ }
112173
+ if (ch === 92) {
112174
+ result2 += text.substring(start, pos);
112175
+ pos++;
112176
+ if (pos >= len) {
112177
+ scanError = 2;
112178
+ break;
112179
+ }
112180
+ const ch2 = text.charCodeAt(pos++);
112181
+ switch (ch2) {
112182
+ case 34:
112183
+ result2 += '"';
112184
+ break;
112185
+ case 92:
112186
+ result2 += "\\";
112187
+ break;
112188
+ case 47:
112189
+ result2 += "/";
112190
+ break;
112191
+ case 98:
112192
+ result2 += "\b";
112193
+ break;
112194
+ case 102:
112195
+ result2 += "\f";
112196
+ break;
112197
+ case 110:
112198
+ result2 += `
112199
+ `;
112200
+ break;
112201
+ case 114:
112202
+ result2 += "\r";
112203
+ break;
112204
+ case 116:
112205
+ result2 += "\t";
112206
+ break;
112207
+ case 117:
112208
+ const ch3 = scanHexDigits(4, true);
112209
+ if (ch3 >= 0) {
112210
+ result2 += String.fromCharCode(ch3);
112211
+ } else {
112212
+ scanError = 4;
112213
+ }
112214
+ break;
112215
+ default:
112216
+ scanError = 5;
112217
+ }
112218
+ start = pos;
112219
+ continue;
112220
+ }
112221
+ if (ch >= 0 && ch <= 31) {
112222
+ if (isLineBreak(ch)) {
112223
+ result2 += text.substring(start, pos);
112224
+ scanError = 2;
112225
+ break;
112226
+ } else {
112227
+ scanError = 6;
112228
+ }
112229
+ }
112230
+ pos++;
112231
+ }
112232
+ return result2;
112233
+ }
112234
+ function scanNext() {
112235
+ value = "";
112236
+ scanError = 0;
112237
+ tokenOffset = pos;
112238
+ lineStartOffset = lineNumber;
112239
+ prevTokenLineStartOffset = tokenLineStartOffset;
112240
+ if (pos >= len) {
112241
+ tokenOffset = len;
112242
+ return token = 17;
112243
+ }
112244
+ let code = text.charCodeAt(pos);
112245
+ if (isWhiteSpace(code)) {
112246
+ do {
112247
+ pos++;
112248
+ value += String.fromCharCode(code);
112249
+ code = text.charCodeAt(pos);
112250
+ } while (isWhiteSpace(code));
112251
+ return token = 15;
112252
+ }
112253
+ if (isLineBreak(code)) {
112254
+ pos++;
112255
+ value += String.fromCharCode(code);
112256
+ if (code === 13 && text.charCodeAt(pos) === 10) {
112257
+ pos++;
112258
+ value += `
112259
+ `;
112260
+ }
112261
+ lineNumber++;
112262
+ tokenLineStartOffset = pos;
112263
+ return token = 14;
112264
+ }
112265
+ switch (code) {
112266
+ case 123:
112267
+ pos++;
112268
+ return token = 1;
112269
+ case 125:
112270
+ pos++;
112271
+ return token = 2;
112272
+ case 91:
112273
+ pos++;
112274
+ return token = 3;
112275
+ case 93:
112276
+ pos++;
112277
+ return token = 4;
112278
+ case 58:
112279
+ pos++;
112280
+ return token = 6;
112281
+ case 44:
112282
+ pos++;
112283
+ return token = 5;
112284
+ case 34:
112285
+ pos++;
112286
+ value = scanString();
112287
+ return token = 10;
112288
+ case 47:
112289
+ const start = pos - 1;
112290
+ if (text.charCodeAt(pos + 1) === 47) {
112291
+ pos += 2;
112292
+ while (pos < len) {
112293
+ if (isLineBreak(text.charCodeAt(pos))) {
112294
+ break;
112295
+ }
112296
+ pos++;
112297
+ }
112298
+ value = text.substring(start, pos);
112299
+ return token = 12;
112300
+ }
112301
+ if (text.charCodeAt(pos + 1) === 42) {
112302
+ pos += 2;
112303
+ const safeLength = len - 1;
112304
+ let commentClosed = false;
112305
+ while (pos < safeLength) {
112306
+ const ch = text.charCodeAt(pos);
112307
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
112308
+ pos += 2;
112309
+ commentClosed = true;
112310
+ break;
112311
+ }
112312
+ pos++;
112313
+ if (isLineBreak(ch)) {
112314
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
112315
+ pos++;
112316
+ }
112317
+ lineNumber++;
112318
+ tokenLineStartOffset = pos;
112319
+ }
112320
+ }
112321
+ if (!commentClosed) {
112322
+ pos++;
112323
+ scanError = 1;
112324
+ }
112325
+ value = text.substring(start, pos);
112326
+ return token = 13;
112327
+ }
112328
+ value += String.fromCharCode(code);
112329
+ pos++;
112330
+ return token = 16;
112331
+ case 45:
112332
+ value += String.fromCharCode(code);
112333
+ pos++;
112334
+ if (pos === len || !isDigit2(text.charCodeAt(pos))) {
112335
+ return token = 16;
112336
+ }
112337
+ case 48:
112338
+ case 49:
112339
+ case 50:
112340
+ case 51:
112341
+ case 52:
112342
+ case 53:
112343
+ case 54:
112344
+ case 55:
112345
+ case 56:
112346
+ case 57:
112347
+ value += scanNumber();
112348
+ return token = 11;
112349
+ default:
112350
+ while (pos < len && isUnknownContentCharacter(code)) {
112351
+ pos++;
112352
+ code = text.charCodeAt(pos);
112353
+ }
112354
+ if (tokenOffset !== pos) {
112355
+ value = text.substring(tokenOffset, pos);
112356
+ switch (value) {
112357
+ case "true":
112358
+ return token = 8;
112359
+ case "false":
112360
+ return token = 9;
112361
+ case "null":
112362
+ return token = 7;
112363
+ }
112364
+ return token = 16;
112365
+ }
112366
+ value += String.fromCharCode(code);
112367
+ pos++;
112368
+ return token = 16;
112369
+ }
112370
+ }
112371
+ function isUnknownContentCharacter(code) {
112372
+ if (isWhiteSpace(code) || isLineBreak(code)) {
112373
+ return false;
112374
+ }
112375
+ switch (code) {
112376
+ case 125:
112377
+ case 93:
112378
+ case 123:
112379
+ case 91:
112380
+ case 34:
112381
+ case 58:
112382
+ case 44:
112383
+ case 47:
112384
+ return false;
112385
+ }
112386
+ return true;
112387
+ }
112388
+ function scanNextNonTrivia() {
112389
+ let result2;
112390
+ do {
112391
+ result2 = scanNext();
112392
+ } while (result2 >= 12 && result2 <= 15);
112393
+ return result2;
112394
+ }
112395
+ return {
112396
+ setPosition,
112397
+ getPosition: () => pos,
112398
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
112399
+ getToken: () => token,
112400
+ getTokenValue: () => value,
112401
+ getTokenOffset: () => tokenOffset,
112402
+ getTokenLength: () => pos - tokenOffset,
112403
+ getTokenStartLine: () => lineStartOffset,
112404
+ getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
112405
+ getTokenError: () => scanError
112406
+ };
112407
+ }
112408
+ function isWhiteSpace(ch) {
112409
+ return ch === 32 || ch === 9;
112410
+ }
112411
+ function isLineBreak(ch) {
112412
+ return ch === 10 || ch === 13;
112413
+ }
112414
+ function isDigit2(ch) {
112415
+ return ch >= 48 && ch <= 57;
112416
+ }
112417
+ var CharacterCodes;
112418
+ (function(CharacterCodes2) {
112419
+ CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
112420
+ CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
112421
+ CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
112422
+ CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
112423
+ CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
112424
+ CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
112425
+ CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
112426
+ CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
112427
+ CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
112428
+ CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
112429
+ CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
112430
+ CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
112431
+ CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
112432
+ CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
112433
+ CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
112434
+ CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
112435
+ CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
112436
+ CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
112437
+ CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
112438
+ CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
112439
+ CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
112440
+ CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
112441
+ CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
112442
+ CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
112443
+ CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
112444
+ CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
112445
+ CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
112446
+ CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
112447
+ CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
112448
+ CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
112449
+ CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
112450
+ CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
112451
+ CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
112452
+ CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
112453
+ CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
112454
+ CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
112455
+ CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
112456
+ CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
112457
+ CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
112458
+ CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
112459
+ CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
112460
+ CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
112461
+ CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
112462
+ CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
112463
+ CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
112464
+ CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
112465
+ CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
112466
+ CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
112467
+ CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
112468
+ CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
112469
+ CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
112470
+ CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
112471
+ CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
112472
+ CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
112473
+ CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
112474
+ CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
112475
+ CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
112476
+ CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
112477
+ CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
112478
+ CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
112479
+ CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
112480
+ CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
112481
+ CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
112482
+ CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
112483
+ CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
112484
+ CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
112485
+ CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
112486
+ CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
112487
+ CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
112488
+ CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
112489
+ CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
112490
+ CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
112491
+ CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
112492
+ CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
112493
+ CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
112494
+ CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
112495
+ CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
112496
+ CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
112497
+ CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
112498
+ CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
112499
+ })(CharacterCodes || (CharacterCodes = {}));
112500
+
112501
+ // node_modules/jsonc-parser/lib/esm/impl/string-intern.js
112502
+ var cachedSpaces = new Array(20).fill(0).map((_, index) => {
112503
+ return " ".repeat(index);
112504
+ });
112505
+ var maxCachedValues = 200;
112506
+ var cachedBreakLinesWithSpaces = {
112507
+ " ": {
112508
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
112509
+ return `
112510
+ ` + " ".repeat(index);
112511
+ }),
112512
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
112513
+ return "\r" + " ".repeat(index);
112514
+ }),
112515
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
112516
+ return `\r
112517
+ ` + " ".repeat(index);
112518
+ })
112519
+ },
112520
+ "\t": {
112521
+ "\n": new Array(maxCachedValues).fill(0).map((_, index) => {
112522
+ return `
112523
+ ` + "\t".repeat(index);
112524
+ }),
112525
+ "\r": new Array(maxCachedValues).fill(0).map((_, index) => {
112526
+ return "\r" + "\t".repeat(index);
112527
+ }),
112528
+ "\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
112529
+ return `\r
112530
+ ` + "\t".repeat(index);
112531
+ })
112532
+ }
112533
+ };
112534
+ var supportedEols = [`
112535
+ `, "\r", `\r
112536
+ `];
112537
+
112538
+ // node_modules/jsonc-parser/lib/esm/impl/format.js
112539
+ function format2(documentText, range2, options) {
112540
+ let initialIndentLevel;
112541
+ let formatText;
112542
+ let formatTextStart;
112543
+ let rangeStart;
112544
+ let rangeEnd;
112545
+ if (range2) {
112546
+ rangeStart = range2.offset;
112547
+ rangeEnd = rangeStart + range2.length;
112548
+ formatTextStart = rangeStart;
112549
+ while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
112550
+ formatTextStart--;
112551
+ }
112552
+ let endOffset = rangeEnd;
112553
+ while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
112554
+ endOffset++;
112555
+ }
112556
+ formatText = documentText.substring(formatTextStart, endOffset);
112557
+ initialIndentLevel = computeIndentLevel(formatText, options);
112558
+ } else {
112559
+ formatText = documentText;
112560
+ initialIndentLevel = 0;
112561
+ formatTextStart = 0;
112562
+ rangeStart = 0;
112563
+ rangeEnd = documentText.length;
112564
+ }
112565
+ const eol = getEOL(options, documentText);
112566
+ const eolFastPathSupported = supportedEols.includes(eol);
112567
+ let numberLineBreaks = 0;
112568
+ let indentLevel = 0;
112569
+ let indentValue;
112570
+ if (options.insertSpaces) {
112571
+ indentValue = cachedSpaces[options.tabSize || 4] ?? repeat2(cachedSpaces[1], options.tabSize || 4);
112572
+ } else {
112573
+ indentValue = "\t";
112574
+ }
112575
+ const indentType = indentValue === "\t" ? "\t" : " ";
112576
+ let scanner = createScanner(formatText, false);
112577
+ let hasError = false;
112578
+ function newLinesAndIndent() {
112579
+ if (numberLineBreaks > 1) {
112580
+ return repeat2(eol, numberLineBreaks) + repeat2(indentValue, initialIndentLevel + indentLevel);
112581
+ }
112582
+ const amountOfSpaces = indentValue.length * (initialIndentLevel + indentLevel);
112583
+ if (!eolFastPathSupported || amountOfSpaces > cachedBreakLinesWithSpaces[indentType][eol].length) {
112584
+ return eol + repeat2(indentValue, initialIndentLevel + indentLevel);
112585
+ }
112586
+ if (amountOfSpaces <= 0) {
112587
+ return eol;
112588
+ }
112589
+ return cachedBreakLinesWithSpaces[indentType][eol][amountOfSpaces];
112590
+ }
112591
+ function scanNext() {
112592
+ let token = scanner.scan();
112593
+ numberLineBreaks = 0;
112594
+ while (token === 15 || token === 14) {
112595
+ if (token === 14 && options.keepLines) {
112596
+ numberLineBreaks += 1;
112597
+ } else if (token === 14) {
112598
+ numberLineBreaks = 1;
112599
+ }
112600
+ token = scanner.scan();
112601
+ }
112602
+ hasError = token === 16 || scanner.getTokenError() !== 0;
112603
+ return token;
112604
+ }
112605
+ const editOperations = [];
112606
+ function addEdit(text, startOffset, endOffset) {
112607
+ if (!hasError && (!range2 || startOffset < rangeEnd && endOffset > rangeStart) && documentText.substring(startOffset, endOffset) !== text) {
112608
+ editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
112609
+ }
112610
+ }
112611
+ let firstToken = scanNext();
112612
+ if (options.keepLines && numberLineBreaks > 0) {
112613
+ addEdit(repeat2(eol, numberLineBreaks), 0, 0);
112614
+ }
112615
+ if (firstToken !== 17) {
112616
+ let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
112617
+ let initialIndent = indentValue.length * initialIndentLevel < 20 && options.insertSpaces ? cachedSpaces[indentValue.length * initialIndentLevel] : repeat2(indentValue, initialIndentLevel);
112618
+ addEdit(initialIndent, formatTextStart, firstTokenStart);
112619
+ }
112620
+ while (firstToken !== 17) {
112621
+ let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
112622
+ let secondToken = scanNext();
112623
+ let replaceContent = "";
112624
+ let needsLineBreak = false;
112625
+ while (numberLineBreaks === 0 && (secondToken === 12 || secondToken === 13)) {
112626
+ let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
112627
+ addEdit(cachedSpaces[1], firstTokenEnd, commentTokenStart);
112628
+ firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
112629
+ needsLineBreak = secondToken === 12;
112630
+ replaceContent = needsLineBreak ? newLinesAndIndent() : "";
112631
+ secondToken = scanNext();
112632
+ }
112633
+ if (secondToken === 2) {
112634
+ if (firstToken !== 1) {
112635
+ indentLevel--;
112636
+ }
112637
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 1) {
112638
+ replaceContent = newLinesAndIndent();
112639
+ } else if (options.keepLines) {
112640
+ replaceContent = cachedSpaces[1];
112641
+ }
112642
+ } else if (secondToken === 4) {
112643
+ if (firstToken !== 3) {
112644
+ indentLevel--;
112645
+ }
112646
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines && firstToken !== 3) {
112647
+ replaceContent = newLinesAndIndent();
112648
+ } else if (options.keepLines) {
112649
+ replaceContent = cachedSpaces[1];
112650
+ }
112651
+ } else {
112652
+ switch (firstToken) {
112653
+ case 3:
112654
+ case 1:
112655
+ indentLevel++;
112656
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
112657
+ replaceContent = newLinesAndIndent();
112658
+ } else {
112659
+ replaceContent = cachedSpaces[1];
112660
+ }
112661
+ break;
112662
+ case 5:
112663
+ if (options.keepLines && numberLineBreaks > 0 || !options.keepLines) {
112664
+ replaceContent = newLinesAndIndent();
112665
+ } else {
112666
+ replaceContent = cachedSpaces[1];
112667
+ }
112668
+ break;
112669
+ case 12:
112670
+ replaceContent = newLinesAndIndent();
112671
+ break;
112672
+ case 13:
112673
+ if (numberLineBreaks > 0) {
112674
+ replaceContent = newLinesAndIndent();
112675
+ } else if (!needsLineBreak) {
112676
+ replaceContent = cachedSpaces[1];
112677
+ }
112678
+ break;
112679
+ case 6:
112680
+ if (options.keepLines && numberLineBreaks > 0) {
112681
+ replaceContent = newLinesAndIndent();
112682
+ } else if (!needsLineBreak) {
112683
+ replaceContent = cachedSpaces[1];
112684
+ }
112685
+ break;
112686
+ case 10:
112687
+ if (options.keepLines && numberLineBreaks > 0) {
112688
+ replaceContent = newLinesAndIndent();
112689
+ } else if (secondToken === 6 && !needsLineBreak) {
112690
+ replaceContent = "";
112691
+ }
112692
+ break;
112693
+ case 7:
112694
+ case 8:
112695
+ case 9:
112696
+ case 11:
112697
+ case 2:
112698
+ case 4:
112699
+ if (options.keepLines && numberLineBreaks > 0) {
112700
+ replaceContent = newLinesAndIndent();
112701
+ } else {
112702
+ if ((secondToken === 12 || secondToken === 13) && !needsLineBreak) {
112703
+ replaceContent = cachedSpaces[1];
112704
+ } else if (secondToken !== 5 && secondToken !== 17) {
112705
+ hasError = true;
112706
+ }
112707
+ }
112708
+ break;
112709
+ case 16:
112710
+ hasError = true;
112711
+ break;
112712
+ }
112713
+ if (numberLineBreaks > 0 && (secondToken === 12 || secondToken === 13)) {
112714
+ replaceContent = newLinesAndIndent();
112715
+ }
112716
+ }
112717
+ if (secondToken === 17) {
112718
+ if (options.keepLines && numberLineBreaks > 0) {
112719
+ replaceContent = newLinesAndIndent();
112720
+ } else {
112721
+ replaceContent = options.insertFinalNewline ? eol : "";
112722
+ }
112723
+ }
112724
+ const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
112725
+ addEdit(replaceContent, firstTokenEnd, secondTokenStart);
112726
+ firstToken = secondToken;
112727
+ }
112728
+ return editOperations;
112729
+ }
112730
+ function repeat2(s, count) {
112731
+ let result2 = "";
112732
+ for (let i = 0;i < count; i++) {
112733
+ result2 += s;
112734
+ }
112735
+ return result2;
112736
+ }
112737
+ function computeIndentLevel(content, options) {
112738
+ let i = 0;
112739
+ let nChars = 0;
112740
+ const tabSize = options.tabSize || 4;
112741
+ while (i < content.length) {
112742
+ let ch = content.charAt(i);
112743
+ if (ch === cachedSpaces[1]) {
112744
+ nChars++;
112745
+ } else if (ch === "\t") {
112746
+ nChars += tabSize;
112747
+ } else {
112748
+ break;
112749
+ }
112750
+ i++;
112751
+ }
112752
+ return Math.floor(nChars / tabSize);
112753
+ }
112754
+ function getEOL(options, text) {
112755
+ for (let i = 0;i < text.length; i++) {
112756
+ const ch = text.charAt(i);
112757
+ if (ch === "\r") {
112758
+ if (i + 1 < text.length && text.charAt(i + 1) === `
112759
+ `) {
112760
+ return `\r
112761
+ `;
112762
+ }
112763
+ return "\r";
112764
+ } else if (ch === `
112765
+ `) {
112766
+ return `
112767
+ `;
112768
+ }
112769
+ }
112770
+ return options && options.eol || `
112771
+ `;
112772
+ }
112773
+ function isEOL(text, offset) {
112774
+ return `\r
112775
+ `.indexOf(text.charAt(offset)) !== -1;
112776
+ }
112777
+
112778
+ // node_modules/jsonc-parser/lib/esm/impl/parser.js
112779
+ var ParseOptions;
112780
+ (function(ParseOptions2) {
112781
+ ParseOptions2.DEFAULT = {
112782
+ allowTrailingComma: false
112783
+ };
112784
+ })(ParseOptions || (ParseOptions = {}));
112785
+ function parse(text, errors8 = [], options = ParseOptions.DEFAULT) {
112786
+ let currentProperty = null;
112787
+ let currentParent = [];
112788
+ const previousParents = [];
112789
+ function onValue(value) {
112790
+ if (Array.isArray(currentParent)) {
112791
+ currentParent.push(value);
112792
+ } else if (currentProperty !== null) {
112793
+ currentParent[currentProperty] = value;
112794
+ }
112795
+ }
112796
+ const visitor = {
112797
+ onObjectBegin: () => {
112798
+ const object = {};
112799
+ onValue(object);
112800
+ previousParents.push(currentParent);
112801
+ currentParent = object;
112802
+ currentProperty = null;
112803
+ },
112804
+ onObjectProperty: (name) => {
112805
+ currentProperty = name;
112806
+ },
112807
+ onObjectEnd: () => {
112808
+ currentParent = previousParents.pop();
112809
+ },
112810
+ onArrayBegin: () => {
112811
+ const array = [];
112812
+ onValue(array);
112813
+ previousParents.push(currentParent);
112814
+ currentParent = array;
112815
+ currentProperty = null;
112816
+ },
112817
+ onArrayEnd: () => {
112818
+ currentParent = previousParents.pop();
112819
+ },
112820
+ onLiteralValue: onValue,
112821
+ onError: (error3, offset, length) => {
112822
+ errors8.push({ error: error3, offset, length });
112823
+ }
112824
+ };
112825
+ visit(text, visitor, options);
112826
+ return currentParent[0];
112827
+ }
112828
+ function parseTree(text, errors8 = [], options = ParseOptions.DEFAULT) {
112829
+ let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
112830
+ function ensurePropertyComplete(endOffset) {
112831
+ if (currentParent.type === "property") {
112832
+ currentParent.length = endOffset - currentParent.offset;
112833
+ currentParent = currentParent.parent;
112834
+ }
112835
+ }
112836
+ function onValue(valueNode) {
112837
+ currentParent.children.push(valueNode);
112838
+ return valueNode;
112839
+ }
112840
+ const visitor = {
112841
+ onObjectBegin: (offset) => {
112842
+ currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
112843
+ },
112844
+ onObjectProperty: (name, offset, length) => {
112845
+ currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
112846
+ currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
112847
+ },
112848
+ onObjectEnd: (offset, length) => {
112849
+ ensurePropertyComplete(offset + length);
112850
+ currentParent.length = offset + length - currentParent.offset;
112851
+ currentParent = currentParent.parent;
112852
+ ensurePropertyComplete(offset + length);
112853
+ },
112854
+ onArrayBegin: (offset, length) => {
112855
+ currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
112856
+ },
112857
+ onArrayEnd: (offset, length) => {
112858
+ currentParent.length = offset + length - currentParent.offset;
112859
+ currentParent = currentParent.parent;
112860
+ ensurePropertyComplete(offset + length);
112861
+ },
112862
+ onLiteralValue: (value, offset, length) => {
112863
+ onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
112864
+ ensurePropertyComplete(offset + length);
112865
+ },
112866
+ onSeparator: (sep, offset, length) => {
112867
+ if (currentParent.type === "property") {
112868
+ if (sep === ":") {
112869
+ currentParent.colonOffset = offset;
112870
+ } else if (sep === ",") {
112871
+ ensurePropertyComplete(offset);
112872
+ }
112873
+ }
112874
+ },
112875
+ onError: (error3, offset, length) => {
112876
+ errors8.push({ error: error3, offset, length });
112877
+ }
112878
+ };
112879
+ visit(text, visitor, options);
112880
+ const result2 = currentParent.children[0];
112881
+ if (result2) {
112882
+ delete result2.parent;
112883
+ }
112884
+ return result2;
112885
+ }
112886
+ function findNodeAtLocation(root, path7) {
112887
+ if (!root) {
112888
+ return;
112889
+ }
112890
+ let node = root;
112891
+ for (let segment of path7) {
112892
+ if (typeof segment === "string") {
112893
+ if (node.type !== "object" || !Array.isArray(node.children)) {
112894
+ return;
112895
+ }
112896
+ let found = false;
112897
+ for (const propertyNode of node.children) {
112898
+ if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
112899
+ node = propertyNode.children[1];
112900
+ found = true;
112901
+ break;
112902
+ }
112903
+ }
112904
+ if (!found) {
112905
+ return;
112906
+ }
112907
+ } else {
112908
+ const index = segment;
112909
+ if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
112910
+ return;
112911
+ }
112912
+ node = node.children[index];
112913
+ }
112914
+ }
112915
+ return node;
112916
+ }
112917
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
112918
+ const _scanner = createScanner(text, false);
112919
+ const _jsonPath = [];
112920
+ let suppressedCallbacks = 0;
112921
+ function toNoArgVisit(visitFunction) {
112922
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
112923
+ }
112924
+ function toOneArgVisit(visitFunction) {
112925
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
112926
+ }
112927
+ function toOneArgVisitWithPath(visitFunction) {
112928
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
112929
+ }
112930
+ function toBeginVisit(visitFunction) {
112931
+ return visitFunction ? () => {
112932
+ if (suppressedCallbacks > 0) {
112933
+ suppressedCallbacks++;
112934
+ } else {
112935
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
112936
+ if (cbReturn === false) {
112937
+ suppressedCallbacks = 1;
112938
+ }
112939
+ }
112940
+ } : () => true;
112941
+ }
112942
+ function toEndVisit(visitFunction) {
112943
+ return visitFunction ? () => {
112944
+ if (suppressedCallbacks > 0) {
112945
+ suppressedCallbacks--;
112946
+ }
112947
+ if (suppressedCallbacks === 0) {
112948
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
112949
+ }
112950
+ } : () => true;
112951
+ }
112952
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
112953
+ const disallowComments = options && options.disallowComments;
112954
+ const allowTrailingComma = options && options.allowTrailingComma;
112955
+ function scanNext() {
112956
+ while (true) {
112957
+ const token = _scanner.scan();
112958
+ switch (_scanner.getTokenError()) {
112959
+ case 4:
112960
+ handleError2(14);
112961
+ break;
112962
+ case 5:
112963
+ handleError2(15);
112964
+ break;
112965
+ case 3:
112966
+ handleError2(13);
112967
+ break;
112968
+ case 1:
112969
+ if (!disallowComments) {
112970
+ handleError2(11);
112971
+ }
112972
+ break;
112973
+ case 2:
112974
+ handleError2(12);
112975
+ break;
112976
+ case 6:
112977
+ handleError2(16);
112978
+ break;
112979
+ }
112980
+ switch (token) {
112981
+ case 12:
112982
+ case 13:
112983
+ if (disallowComments) {
112984
+ handleError2(10);
112985
+ } else {
112986
+ onComment();
112987
+ }
112988
+ break;
112989
+ case 16:
112990
+ handleError2(1);
112991
+ break;
112992
+ case 15:
112993
+ case 14:
112994
+ break;
112995
+ default:
112996
+ return token;
112997
+ }
112998
+ }
112999
+ }
113000
+ function handleError2(error3, skipUntilAfter = [], skipUntil = []) {
113001
+ onError(error3);
113002
+ if (skipUntilAfter.length + skipUntil.length > 0) {
113003
+ let token = _scanner.getToken();
113004
+ while (token !== 17) {
113005
+ if (skipUntilAfter.indexOf(token) !== -1) {
113006
+ scanNext();
113007
+ break;
113008
+ } else if (skipUntil.indexOf(token) !== -1) {
113009
+ break;
113010
+ }
113011
+ token = scanNext();
113012
+ }
113013
+ }
113014
+ }
113015
+ function parseString(isValue) {
113016
+ const value = _scanner.getTokenValue();
113017
+ if (isValue) {
113018
+ onLiteralValue(value);
113019
+ } else {
113020
+ onObjectProperty(value);
113021
+ _jsonPath.push(value);
113022
+ }
113023
+ scanNext();
113024
+ return true;
113025
+ }
113026
+ function parseLiteral() {
113027
+ switch (_scanner.getToken()) {
113028
+ case 11:
113029
+ const tokenValue = _scanner.getTokenValue();
113030
+ let value = Number(tokenValue);
113031
+ if (isNaN(value)) {
113032
+ handleError2(2);
113033
+ value = 0;
113034
+ }
113035
+ onLiteralValue(value);
113036
+ break;
113037
+ case 7:
113038
+ onLiteralValue(null);
113039
+ break;
113040
+ case 8:
113041
+ onLiteralValue(true);
113042
+ break;
113043
+ case 9:
113044
+ onLiteralValue(false);
113045
+ break;
113046
+ default:
113047
+ return false;
113048
+ }
113049
+ scanNext();
113050
+ return true;
113051
+ }
113052
+ function parseProperty() {
113053
+ if (_scanner.getToken() !== 10) {
113054
+ handleError2(3, [], [2, 5]);
113055
+ return false;
113056
+ }
113057
+ parseString(false);
113058
+ if (_scanner.getToken() === 6) {
113059
+ onSeparator(":");
113060
+ scanNext();
113061
+ if (!parseValue2()) {
113062
+ handleError2(4, [], [2, 5]);
113063
+ }
113064
+ } else {
113065
+ handleError2(5, [], [2, 5]);
113066
+ }
113067
+ _jsonPath.pop();
113068
+ return true;
113069
+ }
113070
+ function parseObject() {
113071
+ onObjectBegin();
113072
+ scanNext();
113073
+ let needsComma = false;
113074
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
113075
+ if (_scanner.getToken() === 5) {
113076
+ if (!needsComma) {
113077
+ handleError2(4, [], []);
113078
+ }
113079
+ onSeparator(",");
113080
+ scanNext();
113081
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
113082
+ break;
113083
+ }
113084
+ } else if (needsComma) {
113085
+ handleError2(6, [], []);
113086
+ }
113087
+ if (!parseProperty()) {
113088
+ handleError2(4, [], [2, 5]);
113089
+ }
113090
+ needsComma = true;
113091
+ }
113092
+ onObjectEnd();
113093
+ if (_scanner.getToken() !== 2) {
113094
+ handleError2(7, [2], []);
113095
+ } else {
113096
+ scanNext();
113097
+ }
113098
+ return true;
113099
+ }
113100
+ function parseArray() {
113101
+ onArrayBegin();
113102
+ scanNext();
113103
+ let isFirstElement = true;
113104
+ let needsComma = false;
113105
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
113106
+ if (_scanner.getToken() === 5) {
113107
+ if (!needsComma) {
113108
+ handleError2(4, [], []);
113109
+ }
113110
+ onSeparator(",");
113111
+ scanNext();
113112
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
113113
+ break;
113114
+ }
113115
+ } else if (needsComma) {
113116
+ handleError2(6, [], []);
113117
+ }
113118
+ if (isFirstElement) {
113119
+ _jsonPath.push(0);
113120
+ isFirstElement = false;
113121
+ } else {
113122
+ _jsonPath[_jsonPath.length - 1]++;
113123
+ }
113124
+ if (!parseValue2()) {
113125
+ handleError2(4, [], [4, 5]);
113126
+ }
113127
+ needsComma = true;
113128
+ }
113129
+ onArrayEnd();
113130
+ if (!isFirstElement) {
113131
+ _jsonPath.pop();
113132
+ }
113133
+ if (_scanner.getToken() !== 4) {
113134
+ handleError2(8, [4], []);
113135
+ } else {
113136
+ scanNext();
113137
+ }
113138
+ return true;
113139
+ }
113140
+ function parseValue2() {
113141
+ switch (_scanner.getToken()) {
113142
+ case 3:
113143
+ return parseArray();
113144
+ case 1:
113145
+ return parseObject();
113146
+ case 10:
113147
+ return parseString(true);
113148
+ default:
113149
+ return parseLiteral();
113150
+ }
113151
+ }
113152
+ scanNext();
113153
+ if (_scanner.getToken() === 17) {
113154
+ if (options.allowEmptyContent) {
113155
+ return true;
113156
+ }
113157
+ handleError2(4, [], []);
113158
+ return false;
113159
+ }
113160
+ if (!parseValue2()) {
113161
+ handleError2(4, [], []);
113162
+ return false;
113163
+ }
113164
+ if (_scanner.getToken() !== 17) {
113165
+ handleError2(9, [], []);
113166
+ }
113167
+ return true;
113168
+ }
113169
+ function getNodeType(value) {
113170
+ switch (typeof value) {
113171
+ case "boolean":
113172
+ return "boolean";
113173
+ case "number":
113174
+ return "number";
113175
+ case "string":
113176
+ return "string";
113177
+ case "object": {
113178
+ if (!value) {
113179
+ return "null";
113180
+ } else if (Array.isArray(value)) {
113181
+ return "array";
113182
+ }
113183
+ return "object";
113184
+ }
113185
+ default:
113186
+ return "null";
113187
+ }
113188
+ }
113189
+
113190
+ // node_modules/jsonc-parser/lib/esm/impl/edit.js
113191
+ function setProperty2(text, originalPath, value, options) {
113192
+ const path7 = originalPath.slice();
113193
+ const errors8 = [];
113194
+ const root = parseTree(text, errors8);
113195
+ let parent = undefined;
113196
+ let lastSegment = undefined;
113197
+ while (path7.length > 0) {
113198
+ lastSegment = path7.pop();
113199
+ parent = findNodeAtLocation(root, path7);
113200
+ if (parent === undefined && value !== undefined) {
113201
+ if (typeof lastSegment === "string") {
113202
+ value = { [lastSegment]: value };
113203
+ } else {
113204
+ value = [value];
113205
+ }
113206
+ } else {
113207
+ break;
113208
+ }
113209
+ }
113210
+ if (!parent) {
113211
+ if (value === undefined) {
113212
+ throw new Error("Can not delete in empty document");
113213
+ }
113214
+ return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, options);
113215
+ } else if (parent.type === "object" && typeof lastSegment === "string" && Array.isArray(parent.children)) {
113216
+ const existing = findNodeAtLocation(parent, [lastSegment]);
113217
+ if (existing !== undefined) {
113218
+ if (value === undefined) {
113219
+ if (!existing.parent) {
113220
+ throw new Error("Malformed AST");
113221
+ }
113222
+ const propertyIndex = parent.children.indexOf(existing.parent);
113223
+ let removeBegin;
113224
+ let removeEnd = existing.parent.offset + existing.parent.length;
113225
+ if (propertyIndex > 0) {
113226
+ let previous = parent.children[propertyIndex - 1];
113227
+ removeBegin = previous.offset + previous.length;
113228
+ } else {
113229
+ removeBegin = parent.offset + 1;
113230
+ if (parent.children.length > 1) {
113231
+ let next = parent.children[1];
113232
+ removeEnd = next.offset;
113233
+ }
113234
+ }
113235
+ return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: "" }, options);
113236
+ } else {
113237
+ return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, options);
113238
+ }
113239
+ } else {
113240
+ if (value === undefined) {
113241
+ return [];
113242
+ }
113243
+ const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
113244
+ const index = options.getInsertionIndex ? options.getInsertionIndex(parent.children.map((p) => p.children[0].value)) : parent.children.length;
113245
+ let edit;
113246
+ if (index > 0) {
113247
+ let previous = parent.children[index - 1];
113248
+ edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
113249
+ } else if (parent.children.length === 0) {
113250
+ edit = { offset: parent.offset + 1, length: 0, content: newProperty };
113251
+ } else {
113252
+ edit = { offset: parent.offset + 1, length: 0, content: newProperty + "," };
113253
+ }
113254
+ return withFormatting(text, edit, options);
113255
+ }
113256
+ } else if (parent.type === "array" && typeof lastSegment === "number" && Array.isArray(parent.children)) {
113257
+ const insertIndex = lastSegment;
113258
+ if (insertIndex === -1) {
113259
+ const newProperty = `${JSON.stringify(value)}`;
113260
+ let edit;
113261
+ if (parent.children.length === 0) {
113262
+ edit = { offset: parent.offset + 1, length: 0, content: newProperty };
113263
+ } else {
113264
+ const previous = parent.children[parent.children.length - 1];
113265
+ edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
113266
+ }
113267
+ return withFormatting(text, edit, options);
113268
+ } else if (value === undefined && parent.children.length >= 0) {
113269
+ const removalIndex = lastSegment;
113270
+ const toRemove = parent.children[removalIndex];
113271
+ let edit;
113272
+ if (parent.children.length === 1) {
113273
+ edit = { offset: parent.offset + 1, length: parent.length - 2, content: "" };
113274
+ } else if (parent.children.length - 1 === removalIndex) {
113275
+ let previous = parent.children[removalIndex - 1];
113276
+ let offset = previous.offset + previous.length;
113277
+ let parentEndOffset = parent.offset + parent.length;
113278
+ edit = { offset, length: parentEndOffset - 2 - offset, content: "" };
113279
+ } else {
113280
+ edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: "" };
113281
+ }
113282
+ return withFormatting(text, edit, options);
113283
+ } else if (value !== undefined) {
113284
+ let edit;
113285
+ const newProperty = `${JSON.stringify(value)}`;
113286
+ if (!options.isArrayInsertion && parent.children.length > lastSegment) {
113287
+ const toModify = parent.children[lastSegment];
113288
+ edit = { offset: toModify.offset, length: toModify.length, content: newProperty };
113289
+ } else if (parent.children.length === 0 || lastSegment === 0) {
113290
+ edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + "," };
113291
+ } else {
113292
+ const index = lastSegment > parent.children.length ? parent.children.length : lastSegment;
113293
+ const previous = parent.children[index - 1];
113294
+ edit = { offset: previous.offset + previous.length, length: 0, content: "," + newProperty };
113295
+ }
113296
+ return withFormatting(text, edit, options);
113297
+ } else {
113298
+ throw new Error(`Can not ${value === undefined ? "remove" : options.isArrayInsertion ? "insert" : "modify"} Array index ${insertIndex} as length is not sufficient`);
113299
+ }
113300
+ } else {
113301
+ throw new Error(`Can not add ${typeof lastSegment !== "number" ? "index" : "property"} to parent of type ${parent.type}`);
113302
+ }
113303
+ }
113304
+ function withFormatting(text, edit, options) {
113305
+ if (!options.formattingOptions) {
113306
+ return [edit];
113307
+ }
113308
+ let newText = applyEdit(text, edit);
113309
+ let begin = edit.offset;
113310
+ let end = edit.offset + edit.content.length;
113311
+ if (edit.length === 0 || edit.content.length === 0) {
113312
+ while (begin > 0 && !isEOL(newText, begin - 1)) {
113313
+ begin--;
113314
+ }
113315
+ while (end < newText.length && !isEOL(newText, end)) {
113316
+ end++;
113317
+ }
113318
+ }
113319
+ const edits = format2(newText, { offset: begin, length: end - begin }, { ...options.formattingOptions, keepLines: false });
113320
+ for (let i = edits.length - 1;i >= 0; i--) {
113321
+ const edit2 = edits[i];
113322
+ newText = applyEdit(newText, edit2);
113323
+ begin = Math.min(begin, edit2.offset);
113324
+ end = Math.max(end, edit2.offset + edit2.length);
113325
+ end += edit2.content.length - edit2.length;
113326
+ }
113327
+ const editLength = text.length - (newText.length - end) - begin;
113328
+ return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
113329
+ }
113330
+ function applyEdit(text, edit) {
113331
+ return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
113332
+ }
113333
+
113334
+ // node_modules/jsonc-parser/lib/esm/main.js
113335
+ var ScanError;
113336
+ (function(ScanError2) {
113337
+ ScanError2[ScanError2["None"] = 0] = "None";
113338
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
113339
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
113340
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
113341
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
113342
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
113343
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
113344
+ })(ScanError || (ScanError = {}));
113345
+ var SyntaxKind;
113346
+ (function(SyntaxKind2) {
113347
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
113348
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
113349
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
113350
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
113351
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
113352
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
113353
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
113354
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
113355
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
113356
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
113357
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
113358
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
113359
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
113360
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
113361
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
113362
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
113363
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
113364
+ })(SyntaxKind || (SyntaxKind = {}));
113365
+ var parse2 = parse;
113366
+ var ParseErrorCode;
113367
+ (function(ParseErrorCode2) {
113368
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
113369
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
113370
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
113371
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
113372
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
113373
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
113374
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
113375
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
113376
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
113377
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
113378
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
113379
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
113380
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
113381
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
113382
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
113383
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
113384
+ })(ParseErrorCode || (ParseErrorCode = {}));
113385
+ function modify(text, path7, value, options) {
113386
+ return setProperty2(text, path7, value, options);
113387
+ }
113388
+ function applyEdits(text, edits) {
113389
+ let sortedEdits = edits.slice(0).sort((a, b) => {
113390
+ const diff2 = a.offset - b.offset;
113391
+ if (diff2 === 0) {
113392
+ return a.length - b.length;
113393
+ }
113394
+ return diff2;
113395
+ });
113396
+ let lastModifiedOffset = text.length;
113397
+ for (let i = sortedEdits.length - 1;i >= 0; i--) {
113398
+ let e = sortedEdits[i];
113399
+ if (e.offset + e.length <= lastModifiedOffset) {
113400
+ text = applyEdit(text, e);
113401
+ } else {
113402
+ throw new Error("Overlapping edit");
113403
+ }
113404
+ lastModifiedOffset = e.offset;
113405
+ }
113406
+ return text;
113407
+ }
113408
+
113409
+ // src/commands/mcp/clients/base.ts
113410
+ var MCP_SERVER_NAME = "temps";
113411
+ function redactSecrets(text) {
113412
+ return text.replace(/Bearer\s+\S+/gi, "Bearer ***").replace(/Authorization:\s*\S+(\s+\S+)?/gi, "Authorization: ***");
113413
+ }
113414
+
113415
+ class JsonConfigMcpClientAdapter {
113416
+ async isClientSupported() {
113417
+ return true;
113418
+ }
113419
+ async readServerConfig() {
113420
+ const configPath = this.getConfigPath();
113421
+ if (!fs5.existsSync(configPath))
113422
+ return null;
113423
+ try {
113424
+ const content = await fs5.promises.readFile(configPath, "utf8");
113425
+ const config2 = parse2(content);
113426
+ const prop = this.getServerPropertyName();
113427
+ return config2?.[prop]?.[MCP_SERVER_NAME] ?? null;
113428
+ } catch {
113429
+ return null;
113430
+ }
113431
+ }
113432
+ async isServerInstalled() {
113433
+ return await this.readServerConfig() !== null;
113434
+ }
113435
+ async getServerUrl() {
113436
+ const serverConfig = await this.readServerConfig();
113437
+ return serverConfig ? this.extractUrl(serverConfig) : null;
113438
+ }
113439
+ async addServer(entry) {
113440
+ const configPath = this.getConfigPath();
113441
+ try {
113442
+ await fs5.promises.mkdir(path7.dirname(configPath), { recursive: true });
113443
+ let content = "";
113444
+ if (fs5.existsSync(configPath)) {
113445
+ await fs5.promises.chmod(configPath, 384);
113446
+ content = await fs5.promises.readFile(configPath, "utf8");
113447
+ }
113448
+ const prop = this.getServerPropertyName();
113449
+ const existing = parse2(content || "{}") ?? {};
113450
+ const newEntry = this.buildServerConfig(entry);
113451
+ const currentEntry = existing?.[prop]?.[MCP_SERVER_NAME];
113452
+ if (currentEntry !== undefined && JSON.stringify(currentEntry) === JSON.stringify(newEntry)) {
113453
+ return { success: true, alreadyInstalled: true };
113454
+ }
113455
+ const edits = modify(content, [prop, MCP_SERVER_NAME], newEntry, {
113456
+ formattingOptions: { tabSize: 2, insertSpaces: true }
113457
+ });
113458
+ const updated = applyEdits(content, edits);
113459
+ await fs5.promises.writeFile(configPath, updated, { encoding: "utf8", mode: 384 });
113460
+ await fs5.promises.chmod(configPath, 384);
113461
+ return { success: true };
113462
+ } catch (error3) {
113463
+ return { success: false, reason: redactSecrets(error3 instanceof Error ? error3.message : String(error3)) };
113464
+ }
113465
+ }
113466
+ async removeServer() {
113467
+ const configPath = this.getConfigPath();
113468
+ try {
113469
+ if (!fs5.existsSync(configPath))
113470
+ return { success: true, alreadyInstalled: true };
113471
+ await fs5.promises.chmod(configPath, 384);
113472
+ const content = await fs5.promises.readFile(configPath, "utf8");
113473
+ const prop = this.getServerPropertyName();
113474
+ const existing = parse2(content);
113475
+ if (!existing?.[prop]?.[MCP_SERVER_NAME]) {
113476
+ return { success: true, alreadyInstalled: true };
113477
+ }
113478
+ const edits = modify(content, [prop, MCP_SERVER_NAME], undefined, {
113479
+ formattingOptions: { tabSize: 2, insertSpaces: true }
113480
+ });
113481
+ const updated = applyEdits(content, edits);
113482
+ await fs5.promises.writeFile(configPath, updated, { encoding: "utf8", mode: 384 });
113483
+ await fs5.promises.chmod(configPath, 384);
113484
+ return { success: true };
113485
+ } catch (error3) {
113486
+ return { success: false, reason: redactSecrets(error3 instanceof Error ? error3.message : String(error3)) };
113487
+ }
113488
+ }
113489
+ async describeTarget() {
113490
+ return `${this.getConfigPath()} (${this.getServerPropertyName()}.${MCP_SERVER_NAME})`;
113491
+ }
113492
+ }
113493
+
113494
+ // src/commands/mcp/clients/exec-utils.ts
113495
+ import { execFileSync as execFileSync2 } from "node:child_process";
113496
+ function resolveOnPath(bin) {
113497
+ try {
113498
+ const finder = process.platform === "win32" ? "where" : "which";
113499
+ const out = execFileSync2(finder, [bin], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
113500
+ return out.split(/\r?\n/)[0] || null;
113501
+ } catch {
113502
+ return null;
113503
+ }
113504
+ }
113505
+ function execErrorMessage(error3) {
113506
+ if (error3 && typeof error3 === "object" && "stderr" in error3) {
113507
+ const stderr = error3.stderr;
113508
+ if (stderr)
113509
+ return Buffer.isBuffer(stderr) ? stderr.toString() : String(stderr);
113510
+ }
113511
+ return error3 instanceof Error ? error3.message : String(error3);
113512
+ }
113513
+
113514
+ // src/commands/mcp/clients/claude-code.ts
113515
+ function parseClaudeCodeMcpGetOutput(output) {
113516
+ const match = output.match(/^\s*URL:\s*(\S+)/m);
113517
+ return match?.[1] ?? null;
113518
+ }
113519
+
113520
+ class ClaudeCodeAdapter {
113521
+ id = "claude-code";
113522
+ label = "Claude Code";
113523
+ binary;
113524
+ findBinary() {
113525
+ if (this.binary !== undefined)
113526
+ return this.binary;
113527
+ const candidates = [
113528
+ path8.join(os5.homedir(), ".claude", "local", "claude"),
113529
+ "/usr/local/bin/claude",
113530
+ "/opt/homebrew/bin/claude"
113531
+ ];
113532
+ for (const candidate of candidates) {
113533
+ if (fs6.existsSync(candidate)) {
113534
+ this.binary = candidate;
113535
+ return candidate;
113536
+ }
113537
+ }
113538
+ this.binary = resolveOnPath("claude");
113539
+ return this.binary;
113540
+ }
113541
+ async isClientSupported() {
113542
+ return this.findBinary() !== null;
113543
+ }
113544
+ getServerEntry(binary) {
113545
+ try {
113546
+ return execFileSync3(binary, ["mcp", "get", MCP_SERVER_NAME], { stdio: ["ignore", "pipe", "pipe"] }).toString();
113547
+ } catch {
113548
+ return null;
113549
+ }
113550
+ }
113551
+ async isServerInstalled() {
113552
+ const binary = this.findBinary();
113553
+ if (!binary)
113554
+ return false;
113555
+ return this.getServerEntry(binary) !== null;
113556
+ }
113557
+ async getServerUrl() {
113558
+ const binary = this.findBinary();
113559
+ if (!binary)
113560
+ return null;
113561
+ const entry = this.getServerEntry(binary);
113562
+ if (!entry)
113563
+ return null;
113564
+ return parseClaudeCodeMcpGetOutput(entry);
113565
+ }
113566
+ async addServer(entry) {
113567
+ const binary = this.findBinary();
113568
+ if (!binary)
113569
+ return { success: false, reason: "The claude CLI was not found on PATH." };
113570
+ try {
113571
+ execFileSync3(binary, [
113572
+ "mcp",
113573
+ "add",
113574
+ "--transport",
113575
+ "http",
113576
+ "--scope",
113577
+ "user",
113578
+ MCP_SERVER_NAME,
113579
+ entry.url,
113580
+ "--header",
113581
+ `Authorization: Bearer ${entry.apiKey}`
113582
+ ], { stdio: ["ignore", "pipe", "pipe"] });
113583
+ return { success: true };
113584
+ } catch (error3) {
113585
+ const reason = redactSecrets(execErrorMessage(error3));
113586
+ if (/already exists/i.test(reason))
113587
+ return { success: true, alreadyInstalled: true };
113588
+ return { success: false, reason };
113589
+ }
113590
+ }
113591
+ async removeServer() {
113592
+ const binary = this.findBinary();
113593
+ if (!binary)
113594
+ return { success: false, reason: "The claude CLI was not found on PATH." };
113595
+ try {
113596
+ execFileSync3(binary, ["mcp", "remove", "--scope", "user", MCP_SERVER_NAME], {
113597
+ stdio: ["ignore", "pipe", "pipe"]
113598
+ });
113599
+ return { success: true };
113600
+ } catch (error3) {
113601
+ const reason = redactSecrets(execErrorMessage(error3));
113602
+ if (/no such|not found/i.test(reason))
113603
+ return { success: true, alreadyInstalled: true };
113604
+ return { success: false, reason };
113605
+ }
113606
+ }
113607
+ async describeTarget() {
113608
+ return `claude mcp add --transport http --scope user ${MCP_SERVER_NAME} <url>`;
113609
+ }
113610
+ }
113611
+
113612
+ // src/commands/mcp/clients/claude-desktop.ts
113613
+ import * as os6 from "node:os";
113614
+ import * as path9 from "node:path";
113615
+ class ClaudeDesktopAdapter extends JsonConfigMcpClientAdapter {
113616
+ id = "claude-desktop";
113617
+ label = "Claude Desktop";
113618
+ getConfigPath() {
113619
+ const home = os6.homedir();
113620
+ if (process.platform === "darwin") {
113621
+ return path9.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
113622
+ }
113623
+ if (process.platform === "win32") {
113624
+ return path9.join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json");
113625
+ }
113626
+ throw new Error("Claude Desktop is only available on macOS and Windows");
113627
+ }
113628
+ getServerPropertyName() {
113629
+ return "mcpServers";
113630
+ }
113631
+ buildServerConfig(entry) {
113632
+ return {
113633
+ command: "npx",
113634
+ args: ["-y", "mcp-remote@latest", entry.url, "--header", "Authorization:${AUTH_HEADER}"],
113635
+ env: { AUTH_HEADER: `Bearer ${entry.apiKey}` }
113636
+ };
113637
+ }
113638
+ extractUrl(serverConfig) {
113639
+ const args = serverConfig.args;
113640
+ if (!Array.isArray(args))
113641
+ return null;
113642
+ const url = args.find((arg) => typeof arg === "string" && /^https?:\/\//.test(arg));
113643
+ return typeof url === "string" ? url : null;
113644
+ }
113645
+ async isClientSupported() {
113646
+ return process.platform === "darwin" || process.platform === "win32";
113647
+ }
113648
+ }
113649
+
113650
+ // src/commands/mcp/clients/codex.ts
113651
+ import { execFileSync as execFileSync4 } from "node:child_process";
113652
+ var TOKEN_ENV_VAR = "TEMPS_MCP_AUTH_HEADER";
113653
+ function parseCodexMcpGetOutput(output) {
113654
+ const match = output.match(/^\s*url:\s*(\S+)/m);
113655
+ return match?.[1] ?? null;
113656
+ }
113657
+
113658
+ class CodexAdapter {
113659
+ id = "codex";
113660
+ label = "Codex";
113661
+ binary;
113662
+ findBinary() {
113663
+ if (this.binary !== undefined)
113664
+ return this.binary;
113665
+ this.binary = resolveOnPath("codex");
113666
+ return this.binary;
113667
+ }
113668
+ async isClientSupported() {
113669
+ return this.findBinary() !== null;
113670
+ }
113671
+ getServerEntry(binary) {
113672
+ try {
113673
+ return execFileSync4(binary, ["mcp", "get", MCP_SERVER_NAME], { stdio: ["ignore", "pipe", "pipe"] }).toString();
113674
+ } catch {
113675
+ return null;
113676
+ }
113677
+ }
113678
+ async isServerInstalled() {
113679
+ const binary = this.findBinary();
113680
+ if (!binary)
113681
+ return false;
113682
+ return this.getServerEntry(binary) !== null;
113683
+ }
113684
+ async getServerUrl() {
113685
+ const binary = this.findBinary();
113686
+ if (!binary)
113687
+ return null;
113688
+ const entry = this.getServerEntry(binary);
113689
+ if (!entry)
113690
+ return null;
113691
+ return parseCodexMcpGetOutput(entry);
113692
+ }
113693
+ async addServer(entry) {
113694
+ const binary = this.findBinary();
113695
+ if (!binary)
113696
+ return { success: false, reason: "The codex CLI was not found on PATH." };
113697
+ try {
113698
+ execFileSync4(binary, ["mcp", "add", MCP_SERVER_NAME, "--url", entry.url, "--bearer-token-env-var", TOKEN_ENV_VAR], {
113699
+ stdio: ["ignore", "pipe", "pipe"],
113700
+ env: { ...process.env, [TOKEN_ENV_VAR]: `Bearer ${entry.apiKey}` }
113701
+ });
113702
+ return { success: true };
113703
+ } catch (error3) {
113704
+ const reason = redactSecrets(execErrorMessage(error3));
113705
+ if (/already (installed|exists|added|registered)/i.test(reason)) {
113706
+ return { success: true, alreadyInstalled: true };
113707
+ }
113708
+ return { success: false, reason };
113709
+ }
113710
+ }
113711
+ async removeServer() {
113712
+ const binary = this.findBinary();
113713
+ if (!binary)
113714
+ return { success: false, reason: "The codex CLI was not found on PATH." };
113715
+ try {
113716
+ execFileSync4(binary, ["mcp", "remove", MCP_SERVER_NAME], { stdio: ["ignore", "pipe", "pipe"] });
113717
+ return { success: true };
113718
+ } catch (error3) {
113719
+ const reason = redactSecrets(execErrorMessage(error3));
113720
+ if (/not found|no such/i.test(reason))
113721
+ return { success: true, alreadyInstalled: true };
113722
+ return { success: false, reason };
113723
+ }
113724
+ }
113725
+ async describeTarget() {
113726
+ return `codex mcp add ${MCP_SERVER_NAME} --url <url> --bearer-token-env-var ${TOKEN_ENV_VAR}`;
113727
+ }
113728
+ }
113729
+
113730
+ // src/commands/mcp/clients/cursor.ts
113731
+ import * as os7 from "node:os";
113732
+ import * as path10 from "node:path";
113733
+ class CursorAdapter extends JsonConfigMcpClientAdapter {
113734
+ id = "cursor";
113735
+ label = "Cursor";
113736
+ getConfigPath() {
113737
+ return path10.join(os7.homedir(), ".cursor", "mcp.json");
113738
+ }
113739
+ getServerPropertyName() {
113740
+ return "mcpServers";
113741
+ }
113742
+ buildServerConfig(entry) {
113743
+ return { url: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
113744
+ }
113745
+ extractUrl(serverConfig) {
113746
+ return typeof serverConfig.url === "string" ? serverConfig.url : null;
113747
+ }
113748
+ async isClientSupported() {
113749
+ return process.platform === "darwin" || process.platform === "win32" || process.platform === "linux";
113750
+ }
113751
+ }
113752
+
113753
+ // src/commands/mcp/clients/vscode.ts
113754
+ import * as os8 from "node:os";
113755
+ import * as path11 from "node:path";
113756
+ class VsCodeAdapter extends JsonConfigMcpClientAdapter {
113757
+ id = "vscode";
113758
+ label = "VS Code";
113759
+ getConfigPath() {
113760
+ const home = os8.homedir();
113761
+ if (process.platform === "darwin") {
113762
+ return path11.join(home, "Library", "Application Support", "Code", "User", "mcp.json");
113763
+ }
113764
+ if (process.platform === "win32") {
113765
+ return path11.join(process.env.APPDATA || "", "Code", "User", "mcp.json");
113766
+ }
113767
+ return path11.join(home, ".config", "Code", "User", "mcp.json");
113768
+ }
113769
+ getServerPropertyName() {
113770
+ return "servers";
113771
+ }
113772
+ buildServerConfig(entry) {
113773
+ return { type: "http", url: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
113774
+ }
113775
+ extractUrl(serverConfig) {
113776
+ return typeof serverConfig.url === "string" ? serverConfig.url : null;
113777
+ }
113778
+ async isClientSupported() {
113779
+ return process.platform === "darwin" || process.platform === "win32" || process.platform === "linux";
113780
+ }
113781
+ }
113782
+
113783
+ // src/commands/mcp/clients/windsurf.ts
113784
+ import * as os9 from "node:os";
113785
+ import * as path12 from "node:path";
113786
+ class WindsurfAdapter extends JsonConfigMcpClientAdapter {
113787
+ id = "windsurf";
113788
+ label = "Windsurf";
113789
+ getConfigPath() {
113790
+ return path12.join(os9.homedir(), ".codeium", "windsurf", "mcp_config.json");
113791
+ }
113792
+ getServerPropertyName() {
113793
+ return "mcpServers";
113794
+ }
113795
+ buildServerConfig(entry) {
113796
+ return { serverUrl: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
113797
+ }
113798
+ extractUrl(serverConfig) {
113799
+ return typeof serverConfig.serverUrl === "string" ? serverConfig.serverUrl : null;
113800
+ }
113801
+ async isClientSupported() {
113802
+ return process.platform === "darwin" || process.platform === "win32" || process.platform === "linux";
113803
+ }
113804
+ }
113805
+
113806
+ // src/commands/mcp/clients/zed.ts
113807
+ import * as os10 from "node:os";
113808
+ import * as path13 from "node:path";
113809
+ class ZedAdapter extends JsonConfigMcpClientAdapter {
113810
+ id = "zed";
113811
+ label = "Zed";
113812
+ getConfigPath() {
113813
+ const home = os10.homedir();
113814
+ const xdgConfigHome = process.env.XDG_CONFIG_HOME;
113815
+ if (process.platform === "linux" && xdgConfigHome) {
113816
+ return path13.join(xdgConfigHome, "zed", "settings.json");
113817
+ }
113818
+ return path13.join(home, ".config", "zed", "settings.json");
113819
+ }
113820
+ getServerPropertyName() {
113821
+ return "context_servers";
113822
+ }
113823
+ buildServerConfig(entry) {
113824
+ return { enabled: true, url: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
113825
+ }
113826
+ extractUrl(serverConfig) {
113827
+ return typeof serverConfig.url === "string" ? serverConfig.url : null;
113828
+ }
113829
+ async isClientSupported() {
113830
+ return process.platform === "darwin" || process.platform === "linux";
113831
+ }
113832
+ }
113833
+
113834
+ // src/commands/mcp/clients/index.ts
113835
+ var CLIENT_ADAPTERS = [
113836
+ new ClaudeCodeAdapter,
113837
+ new ClaudeDesktopAdapter,
113838
+ new CodexAdapter,
113839
+ new CursorAdapter,
113840
+ new VsCodeAdapter,
113841
+ new WindsurfAdapter,
113842
+ new ZedAdapter
113843
+ ];
113844
+ function getClientAdapter(id) {
113845
+ return CLIENT_ADAPTERS.find((c) => c.id === id);
113846
+ }
113847
+ function listClientIds() {
113848
+ return CLIENT_ADAPTERS.map((c) => c.id);
113849
+ }
113850
+
113851
+ // src/commands/mcp/groups.ts
113852
+ var TOOL_GROUPS = [
113853
+ {
113854
+ key: "deployments",
113855
+ label: "Deployments & Projects",
113856
+ categories: ["projects", "deployments", "environments", "presets"]
113857
+ },
113858
+ {
113859
+ key: "infrastructure",
113860
+ label: "Infrastructure",
113861
+ categories: ["services", "containers", "load-balancer", "scans"]
113862
+ },
113863
+ {
113864
+ key: "networking",
113865
+ label: "Networking & Domains",
113866
+ categories: ["domains", "custom-domains", "dns-providers", "ip-access"]
113867
+ },
113868
+ {
113869
+ key: "data",
113870
+ label: "Databases & Backups",
113871
+ categories: ["backups", "dsn"]
113872
+ },
113873
+ {
113874
+ key: "observability",
113875
+ label: "Observability",
113876
+ categories: ["monitors", "incidents", "errors", "proxy-logs", "funnels", "analytics"]
113877
+ },
113878
+ {
113879
+ key: "notifications",
113880
+ label: "Notifications",
113881
+ categories: ["notifications", "notification-prefs", "webhooks", "email-domains", "email-providers"]
113882
+ },
113883
+ {
113884
+ key: "platform",
113885
+ label: "Platform & Access",
113886
+ categories: ["users", "settings", "api-keys", "audit", "tokens", "platform"]
113887
+ }
113888
+ ];
113889
+ function isValidGroupKey(key) {
113890
+ return TOOL_GROUPS.some((g) => g.key === key);
113891
+ }
113892
+ function buildMcpUrl(apiUrl, groups, write) {
113893
+ const base3 = apiUrl.replace(/\/+$/, "");
113894
+ const url = new URL(`${base3}/mcp`);
113895
+ if (groups.length > 0 && groups.length < TOOL_GROUPS.length) {
113896
+ url.searchParams.set("groups", groups.join(","));
113897
+ }
113898
+ if (write) {
113899
+ url.searchParams.set("write", "1");
113900
+ }
113901
+ return url.toString();
113902
+ }
113903
+ function parseMcpUrl(url) {
113904
+ let parsed;
113905
+ try {
113906
+ parsed = new URL(url);
113907
+ } catch {
113908
+ return null;
113909
+ }
113910
+ const groupsParam = parsed.searchParams.get("groups");
113911
+ const groups = groupsParam ? groupsParam.split(",").filter(isValidGroupKey) : TOOL_GROUPS.map((g) => g.key);
113912
+ return { groups, write: parsed.searchParams.get("write") === "1" };
113913
+ }
113914
+
113915
+ // src/commands/mcp/probe.ts
113916
+ async function probeMcpEndpoint(apiUrl, timeoutMs = 5000) {
113917
+ const base3 = apiUrl.replace(/\/+$/, "");
113918
+ const controller = new AbortController;
113919
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
113920
+ try {
113921
+ const res = await fetch(`${base3}/mcp/tools`, { signal: controller.signal });
113922
+ if (res.status === 404) {
113923
+ return { supported: false, reason: "no /mcp/tools route -- this instance predates MCP support or the feature flag is off" };
113924
+ }
113925
+ if (!res.ok) {
113926
+ return { supported: false, reason: `unexpected status ${res.status}` };
113927
+ }
113928
+ const body = await res.json();
113929
+ return { supported: true, groups: body.groups };
113930
+ } catch (error3) {
113931
+ const message = error3 instanceof Error ? error3.message : String(error3);
113932
+ return { supported: false, reason: message };
113933
+ } finally {
113934
+ clearTimeout(timer);
113935
+ }
113936
+ }
113937
+
113938
+ // src/commands/mcp/index.ts
113939
+ function originOf(url) {
113940
+ try {
113941
+ return new URL(url).origin;
113942
+ } catch {
113943
+ return null;
113944
+ }
113945
+ }
113946
+ async function findContextByUrl(url) {
113947
+ const target = originOf(url);
113948
+ if (!target)
113949
+ return null;
113950
+ const contexts = await listContexts();
113951
+ return contexts.find((c) => originOf(c.url) === target) ?? null;
113952
+ }
113953
+ async function ensureMcpAuth(opts = {}) {
113954
+ if (opts.urlOverride) {
113955
+ const matched = await findContextByUrl(opts.urlOverride);
113956
+ if (matched) {
113957
+ return matched.apiKey;
113958
+ }
113959
+ if (opts.yes) {
113960
+ console.error(`Not authenticated to ${opts.urlOverride} and no --api-key provided. ` + "Refusing to reuse a credential from a different Temps instance.");
113961
+ process.exit(1);
113962
+ }
113963
+ warning2(`No saved login is bound to ${opts.urlOverride}.`);
113964
+ info2("Your active session's key belongs to a different server and will not be reused for it.");
113965
+ const wantsLogin2 = await promptConfirm({
113966
+ message: `Log in to ${opts.urlOverride} now?`,
113967
+ default: true
113968
+ });
113969
+ if (!wantsLogin2) {
113970
+ console.error(`Not authenticated to ${opts.urlOverride}. Please run: temps login --url ${opts.urlOverride}`);
113971
+ process.exit(1);
113972
+ }
113973
+ await loginWithDevice({ url: opts.urlOverride });
113974
+ const ctx = await findContextByUrl(opts.urlOverride);
113975
+ if (ctx)
113976
+ return ctx.apiKey;
113977
+ console.error(`Login to ${opts.urlOverride} did not produce a usable session.`);
113978
+ process.exit(1);
113979
+ }
113980
+ if (await credentials.isAuthenticated()) {
113981
+ return requireAuth();
113982
+ }
113983
+ if (opts.yes) {
113984
+ return requireAuth();
113985
+ }
113986
+ warning2("Not logged in to the Temps CLI yet.");
113987
+ const wantsLogin = await promptConfirm({
113988
+ message: "Log in now?",
113989
+ default: true
113990
+ });
113991
+ if (!wantsLogin) {
113992
+ return requireAuth();
113993
+ }
113994
+ const url = await promptText({
113995
+ message: "Temps server URL (leave blank to use the default)",
113996
+ default: getApiUrl()
113997
+ });
113998
+ await loginWithDevice({ url: url || undefined });
113999
+ return requireAuth();
114000
+ }
114001
+ function resolveWebUrl(urlOverride) {
114002
+ if (!urlOverride)
114003
+ return getWebUrl();
114004
+ return urlOverride.replace(/\/+$/, "").replace(/\/api$/, "");
114005
+ }
114006
+ var URL_OPTION_DESCRIPTION = "Target this Temps instance directly (e.g. copied from the Settings UI), without needing a saved CLI context or changing the active one. Defaults to the current context/login when omitted.";
114007
+ var CUSTOM_TARGET = "__custom_url__";
114008
+ async function selectMcpTarget(options) {
114009
+ if (options.url || options.yes)
114010
+ return { url: options.url };
114011
+ const contexts = await listContexts();
114012
+ if (contexts.length === 0)
114013
+ return {};
114014
+ const active = await getActiveContext();
114015
+ const ordered = active ? [active, ...contexts.filter((c) => c.name !== active.name)] : contexts;
114016
+ const selected = await promptSearch({
114017
+ message: "Which Temps instance do you want to configure? (type to search)",
114018
+ choices: [
114019
+ ...ordered.map((c) => ({
114020
+ name: `${c.name}${active?.name === c.name ? " [current]" : ""}`,
114021
+ value: c.name,
114022
+ description: c.url
114023
+ })),
114024
+ { name: "Enter a different URL...", value: CUSTOM_TARGET, alwaysShow: true }
114025
+ ]
114026
+ });
114027
+ if (selected === CUSTOM_TARGET) {
114028
+ const url = await promptText({ message: "Temps server URL" });
114029
+ if (!url)
114030
+ return {};
114031
+ const matched = await findContextByUrl(url);
114032
+ return matched ? { url, apiKey: matched.apiKey } : { url };
114033
+ }
114034
+ const ctx = await getContext(selected);
114035
+ return ctx ? { url: ctx.url, apiKey: ctx.apiKey } : {};
114036
+ }
114037
+ function registerMcpCommands(program2) {
114038
+ const mcp = program2.command("mcp").description("Configure this Temps instance as an MCP server for AI clients (Claude Code, Claude Desktop, Codex, Cursor, VS Code, Windsurf, Zed)");
114039
+ mcp.command("enable").description("Enable the Temps MCP server on this instance (admin, one-time per instance)").option("-u, --url <url>", URL_OPTION_DESCRIPTION).action(enableAction);
114040
+ mcp.command("disable").description("Disable the Temps MCP server on this instance (admin)").option("-u, --url <url>", URL_OPTION_DESCRIPTION).action(disableAction);
114041
+ mcp.command("add [client]").description(`Configure an AI client to connect to this Temps instance over MCP. Clients: ${listClientIds().join(", ")}`).option("-g, --groups <groups>", "Comma-separated tool groups to enable (default: all)").option("-w, --write", "Enable write tools (deploy, delete, restart, etc). Default: read-only").option("-k, --api-key <key>", "Use this API key instead of creating or prompting for one").option("-u, --url <url>", URL_OPTION_DESCRIPTION).option("-y, --yes", "Skip prompts and confirmation (uses defaults; requires --api-key or an existing login)").action(addAction);
114042
+ mcp.command("remove [client]").description("Remove the Temps MCP server from an AI client").action(removeAction3);
114043
+ mcp.command("status").description("Show whether this instance has MCP enabled and which AI clients are configured").option("-u, --url <url>", URL_OPTION_DESCRIPTION).action(statusAction2);
114044
+ }
114045
+ async function setMcpServerEnabled(enabled, urlOverride) {
114046
+ const apiKey = await ensureMcpAuth({ urlOverride });
114047
+ await setupClient(urlOverride, apiKey);
114048
+ await withSpinner(enabled ? "Enabling the Temps MCP server..." : "Disabling the Temps MCP server...", async () => {
114049
+ const { data: currentSettings, error: getError } = await getSettings({ client });
114050
+ if (getError)
114051
+ throw new Error(getErrorMessage(getError));
114052
+ const { error: error3 } = await updateSettings({
114053
+ client,
114054
+ body: { ...currentSettings, mcp_server: { enabled } }
114055
+ });
114056
+ if (error3)
114057
+ throw new Error(getErrorMessage(error3));
114058
+ });
114059
+ }
114060
+ async function enableAction(options) {
114061
+ await setMcpServerEnabled(true, options.url);
114062
+ success2("MCP server enabled.");
114063
+ info2("Run `bunx @temps-sdk/cli mcp add <client>` to connect an AI client (Claude Code, Claude Desktop, Codex, Cursor, VS Code, Windsurf, Zed).");
114064
+ }
114065
+ async function disableAction(options) {
114066
+ await setMcpServerEnabled(false, options.url);
114067
+ success2("MCP server disabled.");
114068
+ info2("AI clients configured with `mcp add` will stop working until this is enabled again.");
114069
+ }
114070
+ async function addAction(clientArg, options) {
114071
+ const target = await selectMcpTarget({ url: options.url, yes: options.yes });
114072
+ const authenticatedApiKey = await ensureMcpAuth({ yes: options.yes, urlOverride: target.url });
114073
+ await setupClient(target.url, target.apiKey ?? authenticatedApiKey);
114074
+ const clientId = clientArg || await promptSelect({
114075
+ message: "Which AI client do you want to configure?",
114076
+ choices: CLIENT_ADAPTERS.map((c) => ({ name: c.label, value: c.id }))
114077
+ });
114078
+ const adapter = getClientAdapter(clientId);
114079
+ if (!adapter) {
114080
+ warning2(`Unknown client "${clientId}". Available: ${listClientIds().join(", ")}`);
114081
+ return;
114082
+ }
114083
+ const mcpBaseUrl = resolveWebUrl(target.url);
114084
+ const probe = await withSpinner("Checking for Temps MCP support...", () => probeMcpEndpoint(mcpBaseUrl));
114085
+ if (!probe.supported) {
114086
+ warning2(`This Temps instance does not expose an MCP endpoint (${probe.reason}).`);
114087
+ info2("Run `bunx @temps-sdk/cli mcp enable` as an admin to turn it on (or this instance may predate MCP support).");
114088
+ return;
114089
+ }
114090
+ const clientSupported = await adapter.isClientSupported();
114091
+ if (!clientSupported) {
114092
+ warning2(`${adapter.label} was not detected on this machine -- continuing anyway.`);
114093
+ }
114094
+ let groups;
114095
+ if (options.groups) {
114096
+ groups = options.groups.split(",").map((g) => g.trim()).filter(Boolean);
114097
+ const invalid = groups.filter((g) => !isValidGroupKey(g));
114098
+ if (invalid.length > 0) {
114099
+ warning2(`Unknown tool group(s): ${invalid.join(", ")}. Available: ${TOOL_GROUPS.map((g) => g.key).join(", ")}`);
114100
+ return;
114101
+ }
114102
+ } else if (options.yes) {
114103
+ groups = TOOL_GROUPS.map((g) => g.key);
114104
+ } else {
114105
+ groups = await promptCheckbox({
114106
+ message: "Which tool groups should be available?",
114107
+ choices: TOOL_GROUPS.map((g) => ({
114108
+ name: `${g.label} (${g.categories.length} categories)`,
114109
+ value: g.key
114110
+ }))
114111
+ });
114112
+ if (groups.length === 0)
114113
+ groups = TOOL_GROUPS.map((g) => g.key);
114114
+ }
114115
+ const write = options.write ?? (options.yes ? false : await promptConfirm({
114116
+ message: "Allow write tools (deploy, delete, restart, etc)? A Temps instance controls real infrastructure -- " + "even with this on, every write requires an explicit confirmation in the AI client before it executes.",
114117
+ default: false
114118
+ }));
114119
+ let apiKey = options.apiKey;
114120
+ if (!apiKey) {
114121
+ const wantsNewKey = options.yes ? false : await promptConfirm({
114122
+ message: "Create a new dedicated API key scoped for MCP access? (recommended over reusing an existing key)",
114123
+ default: true
114124
+ });
114125
+ if (wantsNewKey) {
114126
+ const created = await withSpinner("Creating a scoped API key...", async () => {
114127
+ const { data, error: error3 } = await createApiKey({
114128
+ client,
114129
+ body: {
114130
+ name: `mcp-${adapter.id}-${new Date().toISOString().slice(0, 10)}`,
114131
+ role_type: write ? "user" : "reader",
114132
+ expires_at: null,
114133
+ permissions: null
114134
+ }
114135
+ });
114136
+ if (error3)
114137
+ throw new Error(getErrorMessage(error3));
114138
+ if (!data)
114139
+ throw new Error("No response data from create API key");
114140
+ return data;
114141
+ });
114142
+ apiKey = created.api_key;
114143
+ newline();
114144
+ success2(`Created API key "${created.name}" (${created.key_prefix}...)`);
114145
+ } else {
114146
+ apiKey = target.apiKey ?? authenticatedApiKey;
114147
+ }
114148
+ }
114149
+ const url = buildMcpUrl(mcpBaseUrl, groups, write);
114150
+ newline();
114151
+ header(`Configure ${adapter.label}`);
114152
+ keyValue("Target", await adapter.describeTarget());
114153
+ keyValue("URL", url);
114154
+ keyValue("Groups", groups.length === TOOL_GROUPS.length ? "all" : groups.join(", "));
114155
+ keyValue("Write tools", write ? "enabled" : "disabled (read-only)");
114156
+ newline();
114157
+ if (!options.yes) {
114158
+ const proceed = await promptConfirm({ message: "Apply this configuration?", default: true });
114159
+ if (!proceed) {
114160
+ info2("Cancelled -- no changes made.");
114161
+ return;
114162
+ }
114163
+ }
114164
+ const result2 = await adapter.addServer({ url, apiKey });
114165
+ if (!result2.success) {
114166
+ warning2(`Failed to configure ${adapter.label}: ${result2.reason}`);
114167
+ return;
114168
+ }
114169
+ if (result2.alreadyInstalled) {
114170
+ info2(`${adapter.label} is already configured with this exact setup.`);
114171
+ } else {
114172
+ success2(`${adapter.label} configured.`);
114173
+ }
114174
+ info2(`Restart ${adapter.label} to pick up the change.`);
114175
+ if (adapter.id === "codex") {
114176
+ newline();
114177
+ warning2(`Codex reads its bearer token from the ${TOKEN_ENV_VAR} environment variable at connect time -- export it in your shell profile, or every codex session will fail to authenticate to Temps:`);
114178
+ info2(` export ${TOKEN_ENV_VAR}='Bearer ${apiKey}'`);
114179
+ }
114180
+ }
114181
+ async function removeAction3(clientArg) {
114182
+ const clientId = clientArg || await promptSelect({
114183
+ message: "Which AI client do you want to remove the Temps MCP server from?",
114184
+ choices: CLIENT_ADAPTERS.map((c) => ({ name: c.label, value: c.id }))
114185
+ });
114186
+ const adapter = getClientAdapter(clientId);
114187
+ if (!adapter) {
114188
+ warning2(`Unknown client "${clientId}". Available: ${listClientIds().join(", ")}`);
114189
+ return;
114190
+ }
114191
+ const result2 = await adapter.removeServer();
114192
+ if (!result2.success) {
114193
+ warning2(`Failed to remove from ${adapter.label}: ${result2.reason}`);
114194
+ return;
114195
+ }
114196
+ if (result2.alreadyInstalled) {
114197
+ info2(`${adapter.label} had no Temps MCP server configured.`);
114198
+ } else {
114199
+ success2(`Removed the Temps MCP server from ${adapter.label}.`);
114200
+ }
114201
+ }
114202
+ function formatGroups(url) {
114203
+ if (!url)
114204
+ return "-";
114205
+ const parsed = parseMcpUrl(url);
114206
+ if (!parsed)
114207
+ return "-";
114208
+ const label = parsed.groups.length === TOOL_GROUPS.length ? "All" : `${parsed.groups.length}/${TOOL_GROUPS.length}`;
114209
+ return parsed.write ? `${label} (write)` : label;
114210
+ }
114211
+ async function statusAction2(options) {
114212
+ const mcpBaseUrl = resolveWebUrl(options.url);
114213
+ const probe = await withSpinner("Checking this instance...", () => probeMcpEndpoint(mcpBaseUrl));
114214
+ header("Temps MCP status");
114215
+ newline();
114216
+ keyValue("This instance", probe.supported ? `${icons.success} enabled (${mcpBaseUrl})` : `${icons.bullet} disabled (${mcpBaseUrl})`);
114217
+ if (!probe.supported) {
114218
+ info2("Run `bunx @temps-sdk/cli mcp enable` as an admin to turn it on.");
114219
+ }
114220
+ newline();
114221
+ const rows = await Promise.all(CLIENT_ADAPTERS.map(async (adapter) => {
114222
+ const [detected, installed] = await Promise.all([adapter.isClientSupported(), adapter.isServerInstalled()]);
114223
+ const url = installed ? await adapter.getServerUrl() : null;
114224
+ return {
114225
+ label: adapter.label,
114226
+ detected: detected ? `${icons.success} detected` : `${icons.bullet} not detected`,
114227
+ installed: installed ? `${icons.success} configured` : `${icons.bullet} not configured`,
114228
+ groups: formatGroups(url)
114229
+ };
114230
+ }));
114231
+ const columns = [
114232
+ { header: "Client", key: "label" },
114233
+ { header: "On this machine", key: "detected" },
114234
+ { header: "Temps MCP server", key: "installed" },
114235
+ { header: "Tool groups", key: "groups" }
114236
+ ];
114237
+ printTable(rows, columns);
114238
+ }
114239
+
111018
114240
  // src/commands/secrets/index.ts
111019
114241
  import { readFileSync as readFileSync10 } from "node:fs";
111020
114242
  init_spinner();
@@ -111201,6 +114423,7 @@ async function deleteAction4(name, options) {
111201
114423
  }
111202
114424
 
111203
114425
  // src/commands/sandbox/index.ts
114426
+ import { writeFile as writeFile5, readFile as readFile9 } from "node:fs/promises";
111204
114427
  init_spinner();
111205
114428
  init_prompts();
111206
114429
  init_output();
@@ -111209,10 +114432,10 @@ init_output();
111209
114432
  init_sdk_gen();
111210
114433
 
111211
114434
  // src/lib/detect-project.ts
111212
- import { existsSync as existsSync13 } from "node:fs";
114435
+ import { existsSync as existsSync15 } from "node:fs";
111213
114436
  import { readFile as readFile8 } from "node:fs/promises";
111214
114437
  import { execSync as execSync2 } from "node:child_process";
111215
- import { join as join7, basename as basename5 } from "node:path";
114438
+ import { join as join13, basename as basename5 } from "node:path";
111216
114439
  var PRESET_RULES = [
111217
114440
  {
111218
114441
  files: ["next.config.js", "next.config.ts", "next.config.mjs"],
@@ -111288,7 +114511,7 @@ var PRESET_RULES = [
111288
114511
  function detectPreset(dir) {
111289
114512
  const projectDir = dir ?? process.cwd();
111290
114513
  for (const rule of PRESET_RULES) {
111291
- const matched = rule.files.some((file) => existsSync13(join7(projectDir, file)));
114514
+ const matched = rule.files.some((file) => existsSync15(join13(projectDir, file)));
111292
114515
  if (matched) {
111293
114516
  return {
111294
114517
  slug: rule.slug,
@@ -111297,14 +114520,14 @@ function detectPreset(dir) {
111297
114520
  };
111298
114521
  }
111299
114522
  }
111300
- if (existsSync13(join7(projectDir, "package.json"))) {
114523
+ if (existsSync15(join13(projectDir, "package.json"))) {
111301
114524
  return {
111302
114525
  slug: "nodejs",
111303
114526
  label: "Node.js",
111304
114527
  confidence: "low"
111305
114528
  };
111306
114529
  }
111307
- if (existsSync13(join7(projectDir, "index.html"))) {
114530
+ if (existsSync15(join13(projectDir, "index.html"))) {
111308
114531
  return {
111309
114532
  slug: "static",
111310
114533
  label: "Static Site",
@@ -111315,8 +114538,8 @@ function detectPreset(dir) {
111315
114538
  }
111316
114539
  async function refinePythonPreset(dir) {
111317
114540
  const projectDir = dir ?? process.cwd();
111318
- const reqPath = join7(projectDir, "requirements.txt");
111319
- if (existsSync13(reqPath)) {
114541
+ const reqPath = join13(projectDir, "requirements.txt");
114542
+ if (existsSync15(reqPath)) {
111320
114543
  try {
111321
114544
  const content = await readFile8(reqPath, "utf-8");
111322
114545
  const lower = content.toLowerCase();
@@ -111328,8 +114551,8 @@ async function refinePythonPreset(dir) {
111328
114551
  return { slug: "flask", label: "Flask", confidence: "high" };
111329
114552
  } catch {}
111330
114553
  }
111331
- const pyprojectPath = join7(projectDir, "pyproject.toml");
111332
- if (existsSync13(pyprojectPath)) {
114554
+ const pyprojectPath = join13(projectDir, "pyproject.toml");
114555
+ if (existsSync15(pyprojectPath)) {
111333
114556
  try {
111334
114557
  const content = await readFile8(pyprojectPath, "utf-8");
111335
114558
  const lower = content.toLowerCase();
@@ -111347,16 +114570,16 @@ var STATIC_DIR_CANDIDATES = ["dist", "build", "out", "public", "_site", "output"
111347
114570
  function detectStaticDir(dir) {
111348
114571
  const projectDir = dir ?? process.cwd();
111349
114572
  for (const candidate of STATIC_DIR_CANDIDATES) {
111350
- if (existsSync13(join7(projectDir, candidate, "index.html"))) {
114573
+ if (existsSync15(join13(projectDir, candidate, "index.html"))) {
111351
114574
  return candidate;
111352
114575
  }
111353
114576
  }
111354
114577
  for (const candidate of STATIC_DIR_CANDIDATES) {
111355
- if (existsSync13(join7(projectDir, candidate))) {
114578
+ if (existsSync15(join13(projectDir, candidate))) {
111356
114579
  return candidate;
111357
114580
  }
111358
114581
  }
111359
- if (existsSync13(join7(projectDir, "index.html"))) {
114582
+ if (existsSync15(join13(projectDir, "index.html"))) {
111360
114583
  return ".";
111361
114584
  }
111362
114585
  return null;
@@ -111424,8 +114647,8 @@ async function detectServiceHints(dir) {
111424
114647
  const hints = new Set;
111425
114648
  const envFiles = [".env", ".env.example", ".env.local", ".env.development"];
111426
114649
  for (const envFile of envFiles) {
111427
- const envPath = join7(projectDir, envFile);
111428
- if (existsSync13(envPath)) {
114650
+ const envPath = join13(projectDir, envFile);
114651
+ if (existsSync15(envPath)) {
111429
114652
  try {
111430
114653
  const content = await readFile8(envPath, "utf-8");
111431
114654
  const upper = content.toUpperCase();
@@ -111444,8 +114667,8 @@ async function detectServiceHints(dir) {
111444
114667
  } catch {}
111445
114668
  }
111446
114669
  }
111447
- const prismaPath = join7(projectDir, "prisma", "schema.prisma");
111448
- if (existsSync13(prismaPath)) {
114670
+ const prismaPath = join13(projectDir, "prisma", "schema.prisma");
114671
+ if (existsSync15(prismaPath)) {
111449
114672
  try {
111450
114673
  const content = await readFile8(prismaPath, "utf-8");
111451
114674
  if (content.includes("postgresql") || content.includes("postgres")) {
@@ -111458,7 +114681,7 @@ async function detectServiceHints(dir) {
111458
114681
  }
111459
114682
  const drizzleFiles = ["drizzle.config.ts", "drizzle.config.js"];
111460
114683
  for (const drizzleFile of drizzleFiles) {
111461
- if (existsSync13(join7(projectDir, drizzleFile))) {
114684
+ if (existsSync15(join13(projectDir, drizzleFile))) {
111462
114685
  hints.add("postgres");
111463
114686
  break;
111464
114687
  }
@@ -111467,8 +114690,8 @@ async function detectServiceHints(dir) {
111467
114690
  }
111468
114691
  async function suggestProjectName(dir) {
111469
114692
  const projectDir = dir ?? process.cwd();
111470
- const pkgPath = join7(projectDir, "package.json");
111471
- if (existsSync13(pkgPath)) {
114693
+ const pkgPath = join13(projectDir, "package.json");
114694
+ if (existsSync15(pkgPath)) {
111472
114695
  try {
111473
114696
  const content = await readFile8(pkgPath, "utf-8");
111474
114697
  const pkg = JSON.parse(content);
@@ -111850,16 +115073,16 @@ async function auth() {
111850
115073
  const baseUrl = normalizeApiUrl(config.get("apiUrl"));
111851
115074
  return { baseUrl, apiKey };
111852
115075
  }
111853
- function sandboxUrl(baseUrl, path7) {
111854
- return `${baseUrl.replace(/\/+$/, "")}/v1/sandboxes${path7}`;
115076
+ function sandboxUrl(baseUrl, path14) {
115077
+ return `${baseUrl.replace(/\/+$/, "")}/v1/sandboxes${path14}`;
111855
115078
  }
111856
- async function apiRequest(api, path7, init = {}) {
115079
+ async function apiRequest(api, path14, init = {}) {
111857
115080
  const headers = new Headers(init.headers);
111858
115081
  headers.set("Authorization", `Bearer ${api.apiKey}`);
111859
115082
  if (init.body && !headers.has("Content-Type")) {
111860
115083
  headers.set("Content-Type", "application/json");
111861
115084
  }
111862
- const response = await fetch(sandboxUrl(api.baseUrl, path7), { ...init, headers });
115085
+ const response = await fetch(sandboxUrl(api.baseUrl, path14), { ...init, headers });
111863
115086
  if (!response.ok) {
111864
115087
  throw await readApiError(response);
111865
115088
  }
@@ -111939,11 +115162,11 @@ function registerSandboxCommands(program2) {
111939
115162
  sandbox.command("logs <id> <jobId>").description("Stream logs from a detached job (SSE)").action(logsAction);
111940
115163
  sandbox.command("domain <id>").description("Resolve the preview URL for a port inside a sandbox").requiredOption("--port <port>", "Port inside the sandbox (1..=65535)").action(domainAction);
111941
115164
  sandbox.command("password <id>").description("Generate, rotate, or clear the preview-URL password for a sandbox").option("--rotate", "Generate a new random password and set it (default when no flag is given)").option("--length <n>", "Length of the generated password (8..=256, default 24)").option("--clear", "Remove the preview password — preview URLs become open again").action(passwordAction);
111942
- const fs5 = sandbox.command("fs").description("Filesystem operations inside a sandbox");
111943
- fs5.command("read <id>").description("Read a file from the sandbox").requiredOption("--path <path>", "Absolute file path inside the sandbox").option("--out <localPath>", "Write to this local file (stdout when omitted)").action(fsReadAction);
111944
- fs5.command("write <id>").description("Write a file to the sandbox").requiredOption("--path <path>", "Absolute target path inside the sandbox").option("--file <localPath>", "Local source file to upload (mutually exclusive with --content)").option("--content <string>", "Inline string content to write").option("--mode <octal>", "Unix permission mask (default: 0644)").action(fsWriteAction);
111945
- fs5.command("stat <id>").description("Stat a path inside the sandbox").requiredOption("--path <path>", "Absolute path inside the sandbox").option("--json", "Output as JSON").action(fsStatAction);
111946
- fs5.command("mkdir <id>").description("Create a directory inside the sandbox (mkdir -p)").requiredOption("--path <path>", "Absolute path inside the sandbox").action(fsMkdirAction);
115165
+ const fs7 = sandbox.command("fs").description("Filesystem operations inside a sandbox");
115166
+ fs7.command("read <id>").description("Read a file from the sandbox").requiredOption("--path <path>", "Absolute file path inside the sandbox").option("--out <localPath>", "Write to this local file (stdout when omitted)").action(fsReadAction);
115167
+ fs7.command("write <id>").description("Write a file to the sandbox").requiredOption("--path <path>", "Absolute target path inside the sandbox").option("--file <localPath>", "Local source file to upload (mutually exclusive with --content)").option("--content <string>", "Inline string content to write").option("--mode <octal>", "Unix permission mask (default: 0644)").action(fsWriteAction);
115168
+ fs7.command("stat <id>").description("Stat a path inside the sandbox").requiredOption("--path <path>", "Absolute path inside the sandbox").option("--json", "Output as JSON").action(fsStatAction);
115169
+ fs7.command("mkdir <id>").description("Create a directory inside the sandbox (mkdir -p)").requiredOption("--path <path>", "Absolute path inside the sandbox").action(fsMkdirAction);
111947
115170
  const snaps = sandbox.command("snapshots").description("Manage sandbox snapshots (ADR-037)");
111948
115171
  sandbox.command("snapshot <id>").description("Take a snapshot of a sandbox").option("--label <label>", "Human-readable label for the snapshot").option("--wait", "Wait until the snapshot reaches ready or failed status").option("--json", "Output as JSON").action(snapshotCreateAction);
111949
115172
  snaps.command("list").alias("ls").description("List your snapshots").option("--project <id>", "Filter by project ID").option("--status <status>", "Filter by status: creating | ready | failed | deleted").option("--page <n>", "Page number (1-indexed)").option("--page-size <n>", "Items per page (default 20, max 100)").option("--json", "Output as JSON").action(snapshotListAction);
@@ -112150,8 +115373,8 @@ async function listAction7(options) {
112150
115373
  const projectId = await resolveProjectIdBySlug(options.project);
112151
115374
  qs.push(`project_id=${projectId}`);
112152
115375
  }
112153
- const path7 = qs.length ? `?${qs.join("&")}` : "";
112154
- const data = await withSpinner("Fetching sandboxes...", () => apiRequest(api, path7));
115376
+ const path14 = qs.length ? `?${qs.join("&")}` : "";
115377
+ const data = await withSpinner("Fetching sandboxes...", () => apiRequest(api, path14));
112155
115378
  if (options.json) {
112156
115379
  json(data);
112157
115380
  return;
@@ -112287,9 +115510,9 @@ async function execAction(id, args, options) {
112287
115510
  body.env = env4;
112288
115511
  if (options.cwd)
112289
115512
  body.cwd = options.cwd;
112290
- const path7 = options.detach ? `/${encodeURIComponent(id)}/exec-detached` : `/${encodeURIComponent(id)}/exec`;
115513
+ const path14 = options.detach ? `/${encodeURIComponent(id)}/exec-detached` : `/${encodeURIComponent(id)}/exec`;
112291
115514
  if (options.detach) {
112292
- const res2 = await withSpinner("Starting detached job...", () => apiRequest(api, path7, {
115515
+ const res2 = await withSpinner("Starting detached job...", () => apiRequest(api, path14, {
112293
115516
  method: "POST",
112294
115517
  body: JSON.stringify(body)
112295
115518
  }));
@@ -112297,7 +115520,7 @@ async function execAction(id, args, options) {
112297
115520
  info2(`Stream logs: temps sandbox logs ${id} ${res2.job_id}`);
112298
115521
  return;
112299
115522
  }
112300
- const res = await apiRequest(api, path7, {
115523
+ const res = await apiRequest(api, path14, {
112301
115524
  method: "POST",
112302
115525
  body: JSON.stringify(body)
112303
115526
  });
@@ -112388,7 +115611,7 @@ async function fsReadAction(id, options) {
112388
115611
  const res = await withSpinner("Reading file...", () => apiRequest(api, `/${encodeURIComponent(id)}/fs/read?path=${encodeURIComponent(options.path)}`));
112389
115612
  const bytes = base64Decode(res.contents_b64);
112390
115613
  if (options.out) {
112391
- await Bun.write(options.out, bytes);
115614
+ await writeFile5(options.out, bytes);
112392
115615
  success2(`Wrote ${res.size} bytes to ${colors.primary(options.out)}`);
112393
115616
  } else {
112394
115617
  process.stdout.write(bytes);
@@ -112400,8 +115623,7 @@ async function fsWriteAction(id, options) {
112400
115623
  }
112401
115624
  let bytes;
112402
115625
  if (options.file) {
112403
- const buf = await Bun.file(options.file).arrayBuffer();
112404
- bytes = new Uint8Array(buf);
115626
+ bytes = new Uint8Array(await readFile9(options.file));
112405
115627
  } else if (options.content !== undefined) {
112406
115628
  bytes = new TextEncoder().encode(options.content);
112407
115629
  } else {
@@ -112451,16 +115673,16 @@ async function fsMkdirAction(id, options) {
112451
115673
  }));
112452
115674
  success2(`Directory ${colors.primary(options.path)} created`);
112453
115675
  }
112454
- function snapshotUrl(baseUrl, path7) {
112455
- return `${baseUrl.replace(/\/+$/, "")}/v1/sandbox-snapshots${path7}`;
115676
+ function snapshotUrl(baseUrl, path14) {
115677
+ return `${baseUrl.replace(/\/+$/, "")}/v1/sandbox-snapshots${path14}`;
112456
115678
  }
112457
- async function snapshotApiRequest(api, path7, init = {}) {
115679
+ async function snapshotApiRequest(api, path14, init = {}) {
112458
115680
  const headers = new Headers(init.headers);
112459
115681
  headers.set("Authorization", `Bearer ${api.apiKey}`);
112460
115682
  if (init.body && !headers.has("Content-Type")) {
112461
115683
  headers.set("Content-Type", "application/json");
112462
115684
  }
112463
- const response = await fetch(snapshotUrl(api.baseUrl, path7), { ...init, headers });
115685
+ const response = await fetch(snapshotUrl(api.baseUrl, path14), { ...init, headers });
112464
115686
  if (!response.ok) {
112465
115687
  throw await readApiError(response);
112466
115688
  }
@@ -112618,6 +115840,8 @@ async function snapshotStorageAction(options) {
112618
115840
  }
112619
115841
 
112620
115842
  // src/commands/workflow/index.ts
115843
+ import { existsSync as existsSync16 } from "node:fs";
115844
+ import { readFile as readFile10 } from "node:fs/promises";
112621
115845
  init_sdk_gen();
112622
115846
  init_spinner();
112623
115847
  init_output();
@@ -112630,13 +115854,13 @@ async function authClient() {
112630
115854
  const baseUrl = normalizeApiUrl(config.get("apiUrl"));
112631
115855
  return { baseUrl, apiKey };
112632
115856
  }
112633
- async function apiRequest2(api, path7, init = {}) {
115857
+ async function apiRequest2(api, path14, init = {}) {
112634
115858
  const headers = new Headers(init.headers);
112635
115859
  headers.set("Authorization", `Bearer ${api.apiKey}`);
112636
115860
  if (init.body && !headers.has("Content-Type")) {
112637
115861
  headers.set("Content-Type", "application/json");
112638
115862
  }
112639
- const response = await fetch(`${api.baseUrl}${path7}`, { ...init, headers });
115863
+ const response = await fetch(`${api.baseUrl}${path14}`, { ...init, headers });
112640
115864
  if (!response.ok) {
112641
115865
  throw await readApiError2(response);
112642
115866
  }
@@ -112795,13 +116019,12 @@ async function runAction2(slug, options) {
112795
116019
  let run;
112796
116020
  let runLabel;
112797
116021
  if (options.fromFile) {
112798
- const file = Bun.file(options.fromFile);
112799
- if (!await file.exists()) {
116022
+ if (!existsSync16(options.fromFile)) {
112800
116023
  error2(`File not found: ${options.fromFile}`);
112801
116024
  process.exitCode = 2;
112802
116025
  return;
112803
116026
  }
112804
- const yaml = await file.text();
116027
+ const yaml = await readFile10(options.fromFile, "utf8");
112805
116028
  if (!yaml.trim()) {
112806
116029
  error2(`File is empty: ${options.fromFile}`);
112807
116030
  process.exitCode = 2;
@@ -113107,9 +116330,9 @@ function extractAiEvent(message) {
113107
116330
  }
113108
116331
  if (itemType === "file_change") {
113109
116332
  if (type === "item.started") {
113110
- const path7 = item.path ?? "";
116333
+ const path14 = item.path ?? "";
113111
116334
  const op = item.operation ?? "edit";
113112
- return { kind: "call", toolUseId: id, name: "file", summary: `${op} ${path7}` };
116335
+ return { kind: "call", toolUseId: id, name: "file", summary: `${op} ${path14}` };
113113
116336
  }
113114
116337
  return {
113115
116338
  kind: "result",
@@ -113305,7 +116528,7 @@ function printRunSummary(run) {
113305
116528
  }
113306
116529
 
113307
116530
  // src/commands/revenue/index.ts
113308
- import { readFile as readFile9, stat } from "node:fs/promises";
116531
+ import { readFile as readFile11, stat } from "node:fs/promises";
113309
116532
  import { basename as basename6 } from "node:path";
113310
116533
  init_sdk_gen();
113311
116534
  init_spinner();
@@ -113379,7 +116602,7 @@ async function uploadCsv(projectId, integrationId, kind, filePath) {
113379
116602
  if (!fileStat.isFile()) {
113380
116603
  throw new Error(`Not a regular file: ${filePath}`);
113381
116604
  }
113382
- const bytes = await readFile9(filePath);
116605
+ const bytes = await readFile11(filePath);
113383
116606
  const arrayBuffer = new ArrayBuffer(bytes.byteLength);
113384
116607
  new Uint8Array(arrayBuffer).set(bytes);
113385
116608
  const form = new FormData;
@@ -114043,8 +117266,8 @@ init_prompts();
114043
117266
  init_spinner();
114044
117267
  init_output();
114045
117268
  init_sdk_gen();
114046
- import { existsSync as existsSync14, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
114047
- import { resolve as resolve8, join as join8 } from "node:path";
117269
+ import { existsSync as existsSync17, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
117270
+ import { resolve as resolve8, join as join14 } from "node:path";
114048
117271
  import { tmpdir as tmpdir5 } from "node:os";
114049
117272
  async function runSetupWizard(options) {
114050
117273
  newline();
@@ -114147,7 +117370,7 @@ async function runSetupWizard(options) {
114147
117370
  } else {
114148
117371
  staticDir = detectedStaticDir ?? "dist";
114149
117372
  }
114150
- if (!existsSync14(resolve8(staticDir))) {
117373
+ if (!existsSync17(resolve8(staticDir))) {
114151
117374
  warning2(`Folder not found: ${colors.bold(staticDir)}`);
114152
117375
  info2("Build your project first, then re-run, or pass --static-dir <path>.");
114153
117376
  return null;
@@ -114345,7 +117568,7 @@ async function runSetupWizard(options) {
114345
117568
  info2("Building and deploying...");
114346
117569
  newline();
114347
117570
  try {
114348
- const hasDockerfile = existsSync14(resolve8("Dockerfile"));
117571
+ const hasDockerfile = existsSync17(resolve8("Dockerfile"));
114349
117572
  let dockerfilePath;
114350
117573
  let buildArgsList;
114351
117574
  if (!hasDockerfile && presetSlug && presetSlug !== "dockerfile") {
@@ -114373,9 +117596,9 @@ async function runSetupWizard(options) {
114373
117596
  isGitBased
114374
117597
  };
114375
117598
  }
114376
- const tempDir = join8(tmpdir5(), `temps-dockerfile-${Date.now()}`);
117599
+ const tempDir = join14(tmpdir5(), `temps-dockerfile-${Date.now()}`);
114377
117600
  mkdirSync2(tempDir, { recursive: true });
114378
- dockerfilePath = join8(tempDir, "Dockerfile");
117601
+ dockerfilePath = join14(tempDir, "Dockerfile");
114379
117602
  writeFileSync5(dockerfilePath, dockerfileData.dockerfile);
114380
117603
  success2(`Dockerfile generated from ${presetSlug} preset`);
114381
117604
  if (dockerfileData.build_args && Object.keys(dockerfileData.build_args).length > 0) {
@@ -114482,13 +117705,13 @@ async function selectPresetFromAll() {
114482
117705
  }
114483
117706
  function detectPackageManager(dir) {
114484
117707
  const projectDir = dir ? resolve8(dir) : process.cwd();
114485
- if (existsSync14(join8(projectDir, "pnpm-lock.yaml")))
117708
+ if (existsSync17(join14(projectDir, "pnpm-lock.yaml")))
114486
117709
  return "pnpm";
114487
- if (existsSync14(join8(projectDir, "yarn.lock")))
117710
+ if (existsSync17(join14(projectDir, "yarn.lock")))
114488
117711
  return "yarn";
114489
- if (existsSync14(join8(projectDir, "bun.lockb")) || existsSync14(join8(projectDir, "bun.lock")))
117712
+ if (existsSync17(join14(projectDir, "bun.lockb")) || existsSync17(join14(projectDir, "bun.lock")))
114490
117713
  return "bun";
114491
- if (existsSync14(join8(projectDir, "package-lock.json")))
117714
+ if (existsSync17(join14(projectDir, "package-lock.json")))
114492
117715
  return "npm";
114493
117716
  return "npm";
114494
117717
  }
@@ -114939,28 +118162,28 @@ function registerAiCommands(program2) {
114939
118162
  }
114940
118163
 
114941
118164
  // src/config/instances.ts
114942
- import { readFile as readFile10, writeFile as writeFile5, mkdir as mkdir5 } from "node:fs/promises";
114943
- import { existsSync as existsSync15 } from "node:fs";
114944
- import { dirname as dirname4 } from "node:path";
118165
+ import { readFile as readFile12, writeFile as writeFile6, mkdir as mkdir5 } from "node:fs/promises";
118166
+ import { existsSync as existsSync18 } from "node:fs";
118167
+ import { dirname as dirname5 } from "node:path";
114945
118168
  function getInstancesPath() {
114946
118169
  const home = process.env.HOME || process.env.USERPROFILE || "~";
114947
118170
  return `${home}/.temps/.instances.json`;
114948
118171
  }
114949
118172
  async function loadInstances() {
114950
- const path7 = getInstancesPath();
118173
+ const path14 = getInstancesPath();
114951
118174
  try {
114952
- if (existsSync15(path7)) {
114953
- const content = await readFile10(path7, "utf-8");
118175
+ if (existsSync18(path14)) {
118176
+ const content = await readFile12(path14, "utf-8");
114954
118177
  return JSON.parse(content);
114955
118178
  }
114956
118179
  } catch {}
114957
118180
  return [];
114958
118181
  }
114959
118182
  async function saveInstances(instances2) {
114960
- const path7 = getInstancesPath();
114961
- const dir = dirname4(path7);
118183
+ const path14 = getInstancesPath();
118184
+ const dir = dirname5(path14);
114962
118185
  await mkdir5(dir, { recursive: true });
114963
- await writeFile5(path7, JSON.stringify(instances2, null, 2) + `
118186
+ await writeFile6(path14, JSON.stringify(instances2, null, 2) + `
114964
118187
  `, { mode: 384 });
114965
118188
  }
114966
118189
  async function listInstances() {
@@ -115044,7 +118267,7 @@ async function listAction9(options) {
115044
118267
  printTable(instances2, columns, { style: "minimal" });
115045
118268
  newline();
115046
118269
  }
115047
- async function addAction(options) {
118270
+ async function addAction2(options) {
115048
118271
  const name = options.name ?? await promptText({
115049
118272
  message: "Instance name",
115050
118273
  required: true
@@ -115054,7 +118277,7 @@ async function addAction(options) {
115054
118277
  success2(`Instance "${name}" added`);
115055
118278
  info2(`Login with: ${colors.bold(`temps login --cloud --url ${url}`)}`);
115056
118279
  }
115057
- async function removeAction3(name) {
118280
+ async function removeAction4(name) {
115058
118281
  const instance = await getInstance2(name);
115059
118282
  if (!instance) {
115060
118283
  error2(`Instance "${name}" not found`);
@@ -115133,15 +118356,15 @@ async function showAction3(name, options) {
115133
118356
  function registerInstancesCommands(program2) {
115134
118357
  const instances2 = program2.command("instances").alias("instance").description("Manage Temps server instances");
115135
118358
  instances2.command("list").alias("ls").description("List configured instances").option("--json", "Output in JSON format").action(listAction9);
115136
- instances2.command("add").description("Add a new instance").option("-n, --name <name>", "Instance name").option("-u, --url <url>", "Instance URL").action(addAction);
115137
- instances2.command("remove <name>").alias("rm").description("Remove an instance").action(removeAction3);
118359
+ instances2.command("add").description("Add a new instance").option("-n, --name <name>", "Instance name").option("-u, --url <url>", "Instance URL").action(addAction2);
118360
+ instances2.command("remove <name>").alias("rm").description("Remove an instance").action(removeAction4);
115138
118361
  instances2.command("switch <name>").alias("use").description("Switch to a different instance").action(switchAction);
115139
118362
  instances2.command("show [name]").description("Show instance details (or current instance)").option("--json", "Output in JSON format").action(showAction3);
115140
118363
  }
115141
118364
 
115142
118365
  // src/commands/env-sync/index.ts
115143
- import * as fs5 from "node:fs";
115144
- import * as path7 from "node:path";
118366
+ import * as fs7 from "node:fs";
118367
+ import * as path14 from "node:path";
115145
118368
  init_sdk_gen();
115146
118369
  init_spinner();
115147
118370
  init_prompts();
@@ -115240,8 +118463,8 @@ async function pull2(file, options) {
115240
118463
  }
115241
118464
  const envContent = exportableVars.map((v) => formatEnvLine(v.key, resolvedValues.get(v.id) ?? "")).join(`
115242
118465
  `);
115243
- const outputPath = path7.isAbsolute(outputFile) ? outputFile : path7.resolve(process.cwd(), outputFile);
115244
- if (fs5.existsSync(outputPath)) {
118466
+ const outputPath = path14.isAbsolute(outputFile) ? outputFile : path14.resolve(process.cwd(), outputFile);
118467
+ if (fs7.existsSync(outputPath)) {
115245
118468
  const overwrite = await promptConfirm({
115246
118469
  message: `${outputFile} already exists. Overwrite?`,
115247
118470
  default: false
@@ -115251,7 +118474,7 @@ async function pull2(file, options) {
115251
118474
  return;
115252
118475
  }
115253
118476
  }
115254
- fs5.writeFileSync(outputPath, envContent + `
118477
+ fs7.writeFileSync(outputPath, envContent + `
115255
118478
  `);
115256
118479
  success2(`Pulled ${exportableVars.length} variables to ${outputFile}`);
115257
118480
  }
@@ -115260,12 +118483,12 @@ async function push(file, options) {
115260
118483
  await setupClient();
115261
118484
  const resolved = await requireProjectSlug(options.project);
115262
118485
  const inputFile = file ?? ".env";
115263
- const inputPath = path7.isAbsolute(inputFile) ? inputFile : path7.resolve(process.cwd(), inputFile);
115264
- if (!fs5.existsSync(inputPath)) {
118486
+ const inputPath = path14.isAbsolute(inputFile) ? inputFile : path14.resolve(process.cwd(), inputFile);
118487
+ if (!fs7.existsSync(inputPath)) {
115265
118488
  error2(`File not found: ${inputFile}`);
115266
118489
  return;
115267
118490
  }
115268
- const content = fs5.readFileSync(inputPath, "utf-8");
118491
+ const content = fs7.readFileSync(inputPath, "utf-8");
115269
118492
  const variables = parseEnvFile2(content);
115270
118493
  if (Object.keys(variables).length === 0) {
115271
118494
  warning2("No variables found in file");
@@ -115621,9 +118844,9 @@ async function isCloudAuthenticated() {
115621
118844
  const key = await credentials.get("cloudApiKey");
115622
118845
  return !!key;
115623
118846
  }
115624
- async function cloudFetch(path8, options) {
118847
+ async function cloudFetch(path15, options) {
115625
118848
  const apiKey = await requireCloudAuth();
115626
- const response = await fetch(`${CLOUD_URL}${path8}`, {
118849
+ const response = await fetch(`${CLOUD_URL}${path15}`, {
115627
118850
  ...options,
115628
118851
  headers: {
115629
118852
  Authorization: `Bearer ${apiKey}`,
@@ -115641,8 +118864,8 @@ async function cloudFetch(path8, options) {
115641
118864
  return;
115642
118865
  return JSON.parse(text);
115643
118866
  }
115644
- async function cloudFetchPublic(path8) {
115645
- const response = await fetch(`${CLOUD_URL}${path8}`, {
118867
+ async function cloudFetchPublic(path15) {
118868
+ const response = await fetch(`${CLOUD_URL}${path15}`, {
115646
118869
  headers: { "Content-Type": "application/json" }
115647
118870
  });
115648
118871
  if (!response.ok) {
@@ -116228,12 +119451,14 @@ function createProgram() {
116228
119451
  registerMonitorsCommands(program2);
116229
119452
  registerWebhooksCommands(program2);
116230
119453
  registerContainersCommands(program2);
119454
+ registerClusterCommands(program2);
116231
119455
  registerTokensCommands(program2);
116232
119456
  registerErrorsCommands(program2);
116233
119457
  registerMetricsCommands(program2);
116234
119458
  registerTracesCommands(program2);
116235
119459
  registerFacetsCommands(program2);
116236
119460
  registerOtelForwardCommands(program2);
119461
+ registerOtelCommands(program2);
116237
119462
  registerKvCommands(program2);
116238
119463
  registerFlagsCommands(program2);
116239
119464
  registerDataCommands(program2);
@@ -116259,6 +119484,7 @@ function createProgram() {
116259
119484
  registerNotificationPreferencesCommands(program2);
116260
119485
  registerSkillsCommands(program2);
116261
119486
  registerMcpServersCommands(program2);
119487
+ registerMcpCommands(program2);
116262
119488
  registerSecretsCommands(program2);
116263
119489
  registerSandboxCommands(program2);
116264
119490
  registerWorkflowCommands(program2);
@@ -116330,7 +119556,7 @@ function extractCommandInfo(cmd2, parentName = "") {
116330
119556
  function escapeForMdx(text) {
116331
119557
  return text.replace(/('[^']*\{[^']*')/g, "`$1`");
116332
119558
  }
116333
- function generateMarkdown(commands, level = 2, format2 = "markdown") {
119559
+ function generateMarkdown(commands, level = 2, format3 = "markdown") {
116334
119560
  let md = "";
116335
119561
  for (const cmd2 of commands) {
116336
119562
  const heading = "#".repeat(level);
@@ -116355,7 +119581,7 @@ function generateMarkdown(commands, level = 2, format2 = "markdown") {
116355
119581
  const defaultVal = opt.defaultValue !== undefined ? `\`${opt.defaultValue}\`` : "-";
116356
119582
  const required = opt.required ? "Yes" : "No";
116357
119583
  let escapedDesc = opt.description.replace(/\|/g, "\\|");
116358
- if (format2 === "mdx") {
119584
+ if (format3 === "mdx") {
116359
119585
  escapedDesc = escapeForMdx(escapedDesc);
116360
119586
  }
116361
119587
  md += `| \`${opt.flags}\` | ${escapedDesc} | ${defaultVal} | ${required} |
@@ -116375,7 +119601,7 @@ function generateMarkdown(commands, level = 2, format2 = "markdown") {
116375
119601
  }
116376
119602
  md += `
116377
119603
  `;
116378
- md += generateMarkdown(cmd2.subcommands, level + 1, format2);
119604
+ md += generateMarkdown(cmd2.subcommands, level + 1, format3);
116379
119605
  }
116380
119606
  }
116381
119607
  return md;
@@ -116399,14 +119625,14 @@ function generateCommandIndex(commands) {
116399
119625
 
116400
119626
  `;
116401
119627
  }
116402
- function generateHeader(format2 = "markdown", version) {
119628
+ function generateHeader(format3 = "markdown", version) {
116403
119629
  const mdxMetadata = `export const metadata = {
116404
119630
  title: 'CLI Reference',
116405
119631
  description: 'Complete reference for the Temps CLI - all commands, options, and usage examples.',
116406
119632
  }
116407
119633
 
116408
119634
  `;
116409
- return `${format2 === "mdx" ? mdxMetadata : ""}# Temps CLI Reference
119635
+ return `${format3 === "mdx" ? mdxMetadata : ""}# Temps CLI Reference
116410
119636
 
116411
119637
  > Auto-generated documentation for the Temps CLI.
116412
119638
  >
@@ -116534,15 +119760,15 @@ async function generateDocs(options) {
116534
119760
  if (options.format === "json") {
116535
119761
  output = JSON.stringify(commands, null, 2);
116536
119762
  } else {
116537
- const format2 = options.format === "mdx" ? "mdx" : "markdown";
119763
+ const format3 = options.format === "mdx" ? "mdx" : "markdown";
116538
119764
  const version = program2.version() ?? "unknown";
116539
- output = generateHeader(format2, version);
119765
+ output = generateHeader(format3, version);
116540
119766
  output += generateCommandIndex(commands);
116541
- output += generateMarkdown(commands, 2, format2);
119767
+ output += generateMarkdown(commands, 2, format3);
116542
119768
  output += generateFooter(version);
116543
119769
  }
116544
119770
  if (options.output) {
116545
- await writeFile6(options.output, output, "utf8");
119771
+ await writeFile7(options.output, output, "utf8");
116546
119772
  newline();
116547
119773
  header("Documentation Generated");
116548
119774
  console.log(`${colors.success("Written to:")} ${options.output}`);
@@ -116613,12 +119839,14 @@ function createProgram2() {
116613
119839
  registerMonitorsCommands(program2);
116614
119840
  registerWebhooksCommands(program2);
116615
119841
  registerContainersCommands(program2);
119842
+ registerClusterCommands(program2);
116616
119843
  registerTokensCommands(program2);
116617
119844
  registerErrorsCommands(program2);
116618
119845
  registerMetricsCommands(program2);
116619
119846
  registerTracesCommands(program2);
116620
119847
  registerFacetsCommands(program2);
116621
119848
  registerOtelForwardCommands(program2);
119849
+ registerOtelCommands(program2);
116622
119850
  registerKvCommands(program2);
116623
119851
  registerFlagsCommands(program2);
116624
119852
  registerDataCommands(program2);
@@ -116644,6 +119872,7 @@ function createProgram2() {
116644
119872
  registerNotificationPreferencesCommands(program2);
116645
119873
  registerSkillsCommands(program2);
116646
119874
  registerMcpServersCommands(program2);
119875
+ registerMcpCommands(program2);
116647
119876
  registerSecretsCommands(program2);
116648
119877
  registerSandboxCommands(program2);
116649
119878
  registerWorkflowCommands(program2);