@temps-sdk/cli 0.1.34 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2168 -118
- 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({
|
|
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 }),
|
|
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
|
|
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
|
-
|
|
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("?")
|
|
@@ -73984,6 +74090,152 @@ var require_jsx_dev_runtime = __commonJS((exports, module) => {
|
|
|
73984
74090
|
}
|
|
73985
74091
|
});
|
|
73986
74092
|
|
|
74093
|
+
// node_modules/jsonc-parser/lib/umd/main.js
|
|
74094
|
+
var require_main = __commonJS((exports, module) => {
|
|
74095
|
+
(function(factory) {
|
|
74096
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
74097
|
+
var v = factory(__require, exports);
|
|
74098
|
+
if (v !== undefined)
|
|
74099
|
+
module.exports = v;
|
|
74100
|
+
} else if (typeof define === "function" && define.amd) {
|
|
74101
|
+
define(["require", "exports", "./impl/format", "./impl/edit", "./impl/scanner", "./impl/parser"], factory);
|
|
74102
|
+
}
|
|
74103
|
+
})(function(require2, exports2) {
|
|
74104
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
74105
|
+
exports2.applyEdits = exports2.modify = exports2.format = exports2.printParseErrorCode = exports2.ParseErrorCode = exports2.stripComments = exports2.visit = exports2.getNodeValue = exports2.getNodePath = exports2.findNodeAtOffset = exports2.findNodeAtLocation = exports2.parseTree = exports2.parse = exports2.getLocation = exports2.SyntaxKind = exports2.ScanError = exports2.createScanner = undefined;
|
|
74106
|
+
const formatter = require2("./impl/format");
|
|
74107
|
+
const edit = require2("./impl/edit");
|
|
74108
|
+
const scanner = require2("./impl/scanner");
|
|
74109
|
+
const parser = require2("./impl/parser");
|
|
74110
|
+
exports2.createScanner = scanner.createScanner;
|
|
74111
|
+
var ScanError;
|
|
74112
|
+
(function(ScanError2) {
|
|
74113
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
74114
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
74115
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
74116
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
74117
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
74118
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
74119
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
74120
|
+
})(ScanError || (exports2.ScanError = ScanError = {}));
|
|
74121
|
+
var SyntaxKind;
|
|
74122
|
+
(function(SyntaxKind2) {
|
|
74123
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
74124
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
74125
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
74126
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
74127
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
74128
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
74129
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
74130
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
74131
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
74132
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
74133
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
74134
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
74135
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
74136
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
74137
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
74138
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
74139
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
74140
|
+
})(SyntaxKind || (exports2.SyntaxKind = SyntaxKind = {}));
|
|
74141
|
+
exports2.getLocation = parser.getLocation;
|
|
74142
|
+
exports2.parse = parser.parse;
|
|
74143
|
+
exports2.parseTree = parser.parseTree;
|
|
74144
|
+
exports2.findNodeAtLocation = parser.findNodeAtLocation;
|
|
74145
|
+
exports2.findNodeAtOffset = parser.findNodeAtOffset;
|
|
74146
|
+
exports2.getNodePath = parser.getNodePath;
|
|
74147
|
+
exports2.getNodeValue = parser.getNodeValue;
|
|
74148
|
+
exports2.visit = parser.visit;
|
|
74149
|
+
exports2.stripComments = parser.stripComments;
|
|
74150
|
+
var ParseErrorCode;
|
|
74151
|
+
(function(ParseErrorCode2) {
|
|
74152
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
74153
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
74154
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
74155
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
74156
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
74157
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
74158
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
74159
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
74160
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
74161
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
74162
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
74163
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
74164
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
74165
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
74166
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
74167
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
74168
|
+
})(ParseErrorCode || (exports2.ParseErrorCode = ParseErrorCode = {}));
|
|
74169
|
+
function printParseErrorCode(code) {
|
|
74170
|
+
switch (code) {
|
|
74171
|
+
case 1:
|
|
74172
|
+
return "InvalidSymbol";
|
|
74173
|
+
case 2:
|
|
74174
|
+
return "InvalidNumberFormat";
|
|
74175
|
+
case 3:
|
|
74176
|
+
return "PropertyNameExpected";
|
|
74177
|
+
case 4:
|
|
74178
|
+
return "ValueExpected";
|
|
74179
|
+
case 5:
|
|
74180
|
+
return "ColonExpected";
|
|
74181
|
+
case 6:
|
|
74182
|
+
return "CommaExpected";
|
|
74183
|
+
case 7:
|
|
74184
|
+
return "CloseBraceExpected";
|
|
74185
|
+
case 8:
|
|
74186
|
+
return "CloseBracketExpected";
|
|
74187
|
+
case 9:
|
|
74188
|
+
return "EndOfFileExpected";
|
|
74189
|
+
case 10:
|
|
74190
|
+
return "InvalidCommentToken";
|
|
74191
|
+
case 11:
|
|
74192
|
+
return "UnexpectedEndOfComment";
|
|
74193
|
+
case 12:
|
|
74194
|
+
return "UnexpectedEndOfString";
|
|
74195
|
+
case 13:
|
|
74196
|
+
return "UnexpectedEndOfNumber";
|
|
74197
|
+
case 14:
|
|
74198
|
+
return "InvalidUnicode";
|
|
74199
|
+
case 15:
|
|
74200
|
+
return "InvalidEscapeCharacter";
|
|
74201
|
+
case 16:
|
|
74202
|
+
return "InvalidCharacter";
|
|
74203
|
+
}
|
|
74204
|
+
return "<unknown ParseErrorCode>";
|
|
74205
|
+
}
|
|
74206
|
+
exports2.printParseErrorCode = printParseErrorCode;
|
|
74207
|
+
function format2(documentText, range2, options) {
|
|
74208
|
+
return formatter.format(documentText, range2, options);
|
|
74209
|
+
}
|
|
74210
|
+
exports2.format = format2;
|
|
74211
|
+
function modify(text, path7, value, options) {
|
|
74212
|
+
return edit.setProperty(text, path7, value, options);
|
|
74213
|
+
}
|
|
74214
|
+
exports2.modify = modify;
|
|
74215
|
+
function applyEdits(text, edits) {
|
|
74216
|
+
let sortedEdits = edits.slice(0).sort((a, b) => {
|
|
74217
|
+
const diff2 = a.offset - b.offset;
|
|
74218
|
+
if (diff2 === 0) {
|
|
74219
|
+
return a.length - b.length;
|
|
74220
|
+
}
|
|
74221
|
+
return diff2;
|
|
74222
|
+
});
|
|
74223
|
+
let lastModifiedOffset = text.length;
|
|
74224
|
+
for (let i = sortedEdits.length - 1;i >= 0; i--) {
|
|
74225
|
+
let e = sortedEdits[i];
|
|
74226
|
+
if (e.offset + e.length <= lastModifiedOffset) {
|
|
74227
|
+
text = edit.applyEdit(text, e);
|
|
74228
|
+
} else {
|
|
74229
|
+
throw new Error("Overlapping edit");
|
|
74230
|
+
}
|
|
74231
|
+
lastModifiedOffset = e.offset;
|
|
74232
|
+
}
|
|
74233
|
+
return text;
|
|
74234
|
+
}
|
|
74235
|
+
exports2.applyEdits = applyEdits;
|
|
74236
|
+
});
|
|
74237
|
+
});
|
|
74238
|
+
|
|
73987
74239
|
// node_modules/ws/lib/constants.js
|
|
73988
74240
|
var require_constants4 = __commonJS((exports, module) => {
|
|
73989
74241
|
var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
|
|
@@ -75478,7 +75730,7 @@ var require_extension2 = __commonJS((exports, module) => {
|
|
|
75478
75730
|
else
|
|
75479
75731
|
dest[name].push(elem);
|
|
75480
75732
|
}
|
|
75481
|
-
function
|
|
75733
|
+
function parse2(header2) {
|
|
75482
75734
|
const offers = Object.create(null);
|
|
75483
75735
|
let params = Object.create(null);
|
|
75484
75736
|
let mustUnescape = false;
|
|
@@ -75631,7 +75883,7 @@ var require_extension2 = __commonJS((exports, module) => {
|
|
|
75631
75883
|
}).join(", ");
|
|
75632
75884
|
}).join(", ");
|
|
75633
75885
|
}
|
|
75634
|
-
module.exports = { format: format2, parse };
|
|
75886
|
+
module.exports = { format: format2, parse: parse2 };
|
|
75635
75887
|
});
|
|
75636
75888
|
|
|
75637
75889
|
// node_modules/ws/lib/websocket.js
|
|
@@ -75662,7 +75914,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
75662
75914
|
var {
|
|
75663
75915
|
EventTarget: { addEventListener, removeEventListener }
|
|
75664
75916
|
} = require_event_target2();
|
|
75665
|
-
var { format: format2, parse } = require_extension2();
|
|
75917
|
+
var { format: format2, parse: parse2 } = require_extension2();
|
|
75666
75918
|
var { toBuffer } = require_buffer_util2();
|
|
75667
75919
|
var kAborted = Symbol("kAborted");
|
|
75668
75920
|
var protocolVersions = [8, 13];
|
|
@@ -76215,7 +76467,7 @@ var require_websocket2 = __commonJS((exports, module) => {
|
|
|
76215
76467
|
}
|
|
76216
76468
|
let extensions;
|
|
76217
76469
|
try {
|
|
76218
|
-
extensions =
|
|
76470
|
+
extensions = parse2(secWebSocketExtensions);
|
|
76219
76471
|
} catch (err) {
|
|
76220
76472
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
|
76221
76473
|
abortHandshake(websocket, socket, message);
|
|
@@ -76512,7 +76764,7 @@ var require_stream2 = __commonJS((exports, module) => {
|
|
|
76512
76764
|
// node_modules/ws/lib/subprotocol.js
|
|
76513
76765
|
var require_subprotocol2 = __commonJS((exports, module) => {
|
|
76514
76766
|
var { tokenChars } = require_validation4();
|
|
76515
|
-
function
|
|
76767
|
+
function parse2(header2) {
|
|
76516
76768
|
const protocols = new Set;
|
|
76517
76769
|
let start = -1;
|
|
76518
76770
|
let end = -1;
|
|
@@ -76551,7 +76803,7 @@ var require_subprotocol2 = __commonJS((exports, module) => {
|
|
|
76551
76803
|
protocols.add(protocol);
|
|
76552
76804
|
return protocols;
|
|
76553
76805
|
}
|
|
76554
|
-
module.exports = { parse };
|
|
76806
|
+
module.exports = { parse: parse2 };
|
|
76555
76807
|
});
|
|
76556
76808
|
|
|
76557
76809
|
// node_modules/ws/lib/websocket-server.js
|
|
@@ -78715,6 +78967,9 @@ var credentials = {
|
|
|
78715
78967
|
return getSecretsPath();
|
|
78716
78968
|
}
|
|
78717
78969
|
};
|
|
78970
|
+
function getApiUrl() {
|
|
78971
|
+
return config.get("apiUrl");
|
|
78972
|
+
}
|
|
78718
78973
|
async function requireAuth() {
|
|
78719
78974
|
const apiKey = await credentials.getApiKey();
|
|
78720
78975
|
if (!apiKey) {
|
|
@@ -81057,6 +81312,19 @@ async function configureEnvironmentVariables() {
|
|
|
81057
81312
|
init_spinner();
|
|
81058
81313
|
init_output();
|
|
81059
81314
|
init_sdk_gen();
|
|
81315
|
+
function gitProviderLabel(providerType) {
|
|
81316
|
+
const labels = {
|
|
81317
|
+
github: "GitHub",
|
|
81318
|
+
github_app: "GitHub (App)",
|
|
81319
|
+
gitlab: "GitLab",
|
|
81320
|
+
gitea: "Gitea",
|
|
81321
|
+
bitbucket: "Bitbucket",
|
|
81322
|
+
generic: "Self-hosted Git"
|
|
81323
|
+
};
|
|
81324
|
+
if (!providerType)
|
|
81325
|
+
return "Not connected";
|
|
81326
|
+
return labels[providerType.toLowerCase()] ?? providerType;
|
|
81327
|
+
}
|
|
81060
81328
|
async function show(options) {
|
|
81061
81329
|
await requireAuth();
|
|
81062
81330
|
await setupClient();
|
|
@@ -81096,6 +81364,7 @@ async function show(options) {
|
|
|
81096
81364
|
Directory: project.directory,
|
|
81097
81365
|
"Main Branch": project.main_branch,
|
|
81098
81366
|
Repository: project.repo_name ? `${project.repo_owner}/${project.repo_name}` : "Not connected",
|
|
81367
|
+
"Git Provider": gitProviderLabel(project.git_provider_type),
|
|
81099
81368
|
"Attack Mode": project.attack_mode ? "Enabled" : "Disabled",
|
|
81100
81369
|
"Preview Envs": project.enable_preview_environments ? "Enabled" : "Disabled",
|
|
81101
81370
|
Created: formatDate(new Date(project.created_at * 1000).toISOString()),
|
|
@@ -81263,14 +81532,19 @@ async function updateSettingsAction(options) {
|
|
|
81263
81532
|
}
|
|
81264
81533
|
return data;
|
|
81265
81534
|
});
|
|
81535
|
+
let name = options.name;
|
|
81266
81536
|
let slug = options.slug;
|
|
81267
81537
|
let attackMode = options.attackMode;
|
|
81268
81538
|
let previewEnvs = options.previewEnvs;
|
|
81269
|
-
if (slug === undefined && attackMode === undefined && previewEnvs === undefined && imageRetentionHours === undefined && !options.yes) {
|
|
81539
|
+
if (name === undefined && slug === undefined && attackMode === undefined && previewEnvs === undefined && imageRetentionHours === undefined && !options.yes) {
|
|
81270
81540
|
newline();
|
|
81271
81541
|
header("Update Project Settings");
|
|
81272
81542
|
info2(`Current settings for "${project.name}"`);
|
|
81273
81543
|
newline();
|
|
81544
|
+
name = await promptText({
|
|
81545
|
+
message: "Project name (display name)",
|
|
81546
|
+
default: project.name
|
|
81547
|
+
});
|
|
81274
81548
|
slug = await promptText({
|
|
81275
81549
|
message: "Project slug (URL-friendly identifier)",
|
|
81276
81550
|
default: project.slug
|
|
@@ -81289,6 +81563,7 @@ async function updateSettingsAction(options) {
|
|
|
81289
81563
|
client,
|
|
81290
81564
|
path: { project_id: project.id },
|
|
81291
81565
|
body: {
|
|
81566
|
+
name: name ?? undefined,
|
|
81292
81567
|
slug: slug ?? undefined,
|
|
81293
81568
|
attack_mode: attackMode ?? undefined,
|
|
81294
81569
|
enable_preview_environments: previewEnvs ?? undefined,
|
|
@@ -81305,7 +81580,8 @@ async function updateSettingsAction(options) {
|
|
|
81305
81580
|
return;
|
|
81306
81581
|
}
|
|
81307
81582
|
success2("Project settings updated successfully");
|
|
81308
|
-
keyValue("
|
|
81583
|
+
keyValue("Name", updated?.name ?? name ?? project.name);
|
|
81584
|
+
keyValue("Slug", updated?.slug ?? slug ?? project.slug);
|
|
81309
81585
|
keyValue("Attack Mode", attackMode ? colors.success("Enabled") : colors.muted("Disabled"));
|
|
81310
81586
|
keyValue("Preview Environments", previewEnvs ? colors.success("Enabled") : colors.muted("Disabled"));
|
|
81311
81587
|
const effectiveRetention = imageRetentionHours !== undefined ? imageRetentionHours : updated?.image_retention_hours ?? null;
|
|
@@ -81548,6 +81824,96 @@ async function updateConfigAction(options) {
|
|
|
81548
81824
|
keyValue("WebSocket Idle Timeout", `${websocketIdleTimeoutSeconds}s`);
|
|
81549
81825
|
}
|
|
81550
81826
|
|
|
81827
|
+
// src/commands/projects/source.ts
|
|
81828
|
+
init_sdk_gen();
|
|
81829
|
+
init_spinner();
|
|
81830
|
+
init_output();
|
|
81831
|
+
var SWITCHABLE = [
|
|
81832
|
+
"docker_image",
|
|
81833
|
+
"static_files",
|
|
81834
|
+
"uploaded_source",
|
|
81835
|
+
"manual"
|
|
81836
|
+
];
|
|
81837
|
+
async function fetchProject(reference) {
|
|
81838
|
+
const id = Number.parseInt(reference, 10);
|
|
81839
|
+
const result = Number.isNaN(id) ? await getProjectBySlug({ client, path: { slug: reference } }) : await getProject({ client, path: { id } });
|
|
81840
|
+
if (result.error || !result.data) {
|
|
81841
|
+
throw new Error(getErrorMessage(result.error) ?? `Project "${reference}" not found`);
|
|
81842
|
+
}
|
|
81843
|
+
return result.data;
|
|
81844
|
+
}
|
|
81845
|
+
function printProject(project, asJson) {
|
|
81846
|
+
if (asJson) {
|
|
81847
|
+
json(project);
|
|
81848
|
+
return;
|
|
81849
|
+
}
|
|
81850
|
+
newline();
|
|
81851
|
+
keyValue("Project", project.slug);
|
|
81852
|
+
keyValue("Source", project.source_type);
|
|
81853
|
+
keyValue("Alternate sources", project.allow_alternate_sources ? "allowed" : "not allowed");
|
|
81854
|
+
}
|
|
81855
|
+
async function projectSourceAction(options) {
|
|
81856
|
+
await requireAuth();
|
|
81857
|
+
await setupClient();
|
|
81858
|
+
const resolved = await requireProjectSlug(options.project);
|
|
81859
|
+
if (resolved.source !== "flag") {
|
|
81860
|
+
info2(`Using project ${colors.bold(resolved.slug)} (from ${resolved.source})`);
|
|
81861
|
+
}
|
|
81862
|
+
const project = await withSpinner("Fetching project...", () => fetchProject(resolved.slug));
|
|
81863
|
+
if (!options.type && options.allowAlternate === undefined) {
|
|
81864
|
+
printProject(project, options.json);
|
|
81865
|
+
if (!options.json) {
|
|
81866
|
+
newline();
|
|
81867
|
+
info2(`Change the primary source: --type <${SWITCHABLE.join("|")}>`);
|
|
81868
|
+
info2("Also accept `drop` uploads: --allow-alternate");
|
|
81869
|
+
}
|
|
81870
|
+
return;
|
|
81871
|
+
}
|
|
81872
|
+
let updated = project;
|
|
81873
|
+
if (options.type) {
|
|
81874
|
+
if (options.type === "git") {
|
|
81875
|
+
throw new Error(`Switching to a Git source needs a repository and a provider connection.
|
|
81876
|
+
` + `Use: bunx @temps-sdk/cli projects git --project ${project.slug}`);
|
|
81877
|
+
}
|
|
81878
|
+
if (!SWITCHABLE.includes(options.type)) {
|
|
81879
|
+
throw new Error(`Unknown source type "${options.type}". Expected one of: ${SWITCHABLE.join(", ")}`);
|
|
81880
|
+
}
|
|
81881
|
+
updated = await withSpinner(`Changing source to ${options.type}...`, async () => {
|
|
81882
|
+
const { data, error: error3 } = await changeProjectSource({
|
|
81883
|
+
client,
|
|
81884
|
+
path: { id: project.id },
|
|
81885
|
+
body: { source_type: options.type }
|
|
81886
|
+
});
|
|
81887
|
+
if (error3 || !data) {
|
|
81888
|
+
throw new Error(getErrorMessage(error3) ?? "Failed to change deployment source");
|
|
81889
|
+
}
|
|
81890
|
+
return data;
|
|
81891
|
+
});
|
|
81892
|
+
success2(`Source changed to ${options.type}`);
|
|
81893
|
+
}
|
|
81894
|
+
if (options.allowAlternate !== undefined) {
|
|
81895
|
+
const allow = options.allowAlternate;
|
|
81896
|
+
updated = await withSpinner(allow ? "Allowing alternate sources..." : "Restricting to configured source...", async () => {
|
|
81897
|
+
const { data, error: error3 } = await setAlternateSources({
|
|
81898
|
+
client,
|
|
81899
|
+
path: { id: project.id },
|
|
81900
|
+
body: { allow_alternate_sources: allow }
|
|
81901
|
+
});
|
|
81902
|
+
if (error3 || !data) {
|
|
81903
|
+
throw new Error(getErrorMessage(error3) ?? "Failed to update alternate sources");
|
|
81904
|
+
}
|
|
81905
|
+
return data;
|
|
81906
|
+
});
|
|
81907
|
+
if (allow) {
|
|
81908
|
+
success2(`${updated.slug} still deploys from ${updated.source_type} and now also accepts uploaded source`);
|
|
81909
|
+
info2(`Try: bunx @temps-sdk/cli drop ./ --project ${updated.slug}`);
|
|
81910
|
+
} else {
|
|
81911
|
+
success2(`${updated.slug} now only deploys from ${updated.source_type}`);
|
|
81912
|
+
}
|
|
81913
|
+
}
|
|
81914
|
+
printProject(updated, options.json);
|
|
81915
|
+
}
|
|
81916
|
+
|
|
81551
81917
|
// src/commands/projects/secrets.ts
|
|
81552
81918
|
import { readFileSync as readFileSync4 } from "node:fs";
|
|
81553
81919
|
init_sdk_gen();
|
|
@@ -81597,10 +81963,10 @@ async function findSecretByKey(projectId, key) {
|
|
|
81597
81963
|
return found;
|
|
81598
81964
|
}
|
|
81599
81965
|
function registerProjectSecretsCommands(projects) {
|
|
81600
|
-
const secrets = projects.command("secrets").description("Manage project secrets — mounted into the deployed container as files at /run/secrets/<KEY
|
|
81966
|
+
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
81967
|
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);
|
|
81968
|
+
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);
|
|
81969
|
+
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
81970
|
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
81971
|
}
|
|
81606
81972
|
async function listAction2(options) {
|
|
@@ -81642,6 +82008,8 @@ async function listAction2(options) {
|
|
|
81642
82008
|
console.log(` ${colors.muted("Mount path:")} ${colors.bold(`/run/secrets/${secret.key}`)}`);
|
|
81643
82009
|
const scope = secret.environments.length > 0 ? secret.environments.map((e) => e.name).join(", ") : "all environments";
|
|
81644
82010
|
console.log(` ${colors.muted("Environments:")} ${scope}${secret.include_in_preview ? " (+ preview)" : ""}`);
|
|
82011
|
+
const services = secret.compose_services && secret.compose_services.length > 0 ? secret.compose_services.join(", ") : "all services";
|
|
82012
|
+
console.log(` ${colors.muted("Compose services:")} ${services}`);
|
|
81645
82013
|
newline();
|
|
81646
82014
|
}
|
|
81647
82015
|
}
|
|
@@ -81663,6 +82031,7 @@ async function createAction(options) {
|
|
|
81663
82031
|
key: options.key,
|
|
81664
82032
|
value,
|
|
81665
82033
|
...environmentIds ? { environment_ids: environmentIds } : {},
|
|
82034
|
+
...options.service.length > 0 ? { compose_services: options.service } : {},
|
|
81666
82035
|
...options.includeInPreview !== undefined ? { include_in_preview: options.includeInPreview } : {}
|
|
81667
82036
|
}
|
|
81668
82037
|
});
|
|
@@ -81671,16 +82040,20 @@ async function createAction(options) {
|
|
|
81671
82040
|
return data;
|
|
81672
82041
|
});
|
|
81673
82042
|
success2(`Secret created: ${secret.key}`);
|
|
81674
|
-
info2(`Mounted at ${colors.bold(`/run/secrets/${secret.key}`)}
|
|
82043
|
+
info2(`Mounted at ${colors.bold(`/run/secrets/${secret.key}`)} on the next deployment`);
|
|
82044
|
+
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
82045
|
info2("A redeploy is required for this to take effect.");
|
|
81676
82046
|
}
|
|
81677
82047
|
async function updateAction(options) {
|
|
81678
82048
|
await requireAuth();
|
|
81679
82049
|
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");
|
|
82050
|
+
if (options.value === undefined && options.environment.length === 0 && options.service.length === 0 && options.allServices !== true && options.includeInPreview === undefined) {
|
|
82051
|
+
warning2("No fields to update. Provide at least one of --value, --environment, --service, --all-services, or --include-in-preview");
|
|
81682
82052
|
return;
|
|
81683
82053
|
}
|
|
82054
|
+
if (options.service.length > 0 && options.allServices === true) {
|
|
82055
|
+
throw new Error("--service and --all-services are mutually exclusive");
|
|
82056
|
+
}
|
|
81684
82057
|
const resolved = await requireProjectSlug(options.project);
|
|
81685
82058
|
if (resolved.source !== "flag") {
|
|
81686
82059
|
info2(`Using project ${colors.bold(resolved.slug)} (from ${resolved.source})`);
|
|
@@ -81689,12 +82062,14 @@ async function updateAction(options) {
|
|
|
81689
82062
|
const projectId = await getProjectId(resolved.slug);
|
|
81690
82063
|
const current = await findSecretByKey(projectId, options.key);
|
|
81691
82064
|
const environmentIds = options.environment.length > 0 ? await resolveEnvironmentIds(projectId, options.environment) : undefined;
|
|
82065
|
+
const composeServices = options.allServices ? [] : options.service.length > 0 ? options.service : current.compose_services ?? [];
|
|
81692
82066
|
const { data, error: error3 } = await updateProjectSecret({
|
|
81693
82067
|
client,
|
|
81694
82068
|
path: { project_id: projectId, secret_id: current.id },
|
|
81695
82069
|
body: {
|
|
81696
82070
|
...options.value !== undefined ? { value: resolveValue(options.value) } : {},
|
|
81697
82071
|
...environmentIds ? { environment_ids: environmentIds } : {},
|
|
82072
|
+
compose_services: composeServices,
|
|
81698
82073
|
...options.includeInPreview !== undefined ? { include_in_preview: options.includeInPreview } : {}
|
|
81699
82074
|
}
|
|
81700
82075
|
});
|
|
@@ -81745,8 +82120,9 @@ function registerProjectsCommands(program2) {
|
|
|
81745
82120
|
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
82121
|
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
82122
|
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);
|
|
82123
|
+
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
82124
|
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);
|
|
82125
|
+
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
82126
|
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
82127
|
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
82128
|
}
|
|
@@ -89078,10 +89454,13 @@ async function resolveExistingProject(reference) {
|
|
|
89078
89454
|
function assertUploadable(project) {
|
|
89079
89455
|
if (UPLOADABLE_SOURCE_TYPES.includes(project.source_type))
|
|
89080
89456
|
return;
|
|
89457
|
+
if (project.allow_alternate_sources)
|
|
89458
|
+
return;
|
|
89081
89459
|
const command = COMMAND_BY_SOURCE_TYPE[project.source_type];
|
|
89082
89460
|
const alternative = command ? `
|
|
89083
|
-
|
|
89084
|
-
throw new Error(`Project "${project.slug}" deploys from ${project.source_type}, ` + `so it cannot take an uploaded source archive
|
|
89461
|
+
Deploy it from its configured source: bunx @temps-sdk/cli ${command} --project ${project.slug}` : "";
|
|
89462
|
+
throw new Error(`Project "${project.slug}" deploys from ${project.source_type}, ` + `so it cannot take an uploaded source archive.
|
|
89463
|
+
` + `Allow it to: bunx @temps-sdk/cli projects source --project ${project.slug} --allow-alternate` + alternative);
|
|
89085
89464
|
}
|
|
89086
89465
|
function selectCandidate(candidates, options, currentDirectory) {
|
|
89087
89466
|
const matches2 = candidates.filter((item) => (!options.preset || item.preset === options.preset) && (!options.directory || item.directory === options.directory));
|
|
@@ -89110,6 +89489,9 @@ async function syncBuildConfig(project, candidate) {
|
|
|
89110
89489
|
if (updated.error)
|
|
89111
89490
|
throw new Error(JSON.stringify(updated.error));
|
|
89112
89491
|
succeedSpinner(`Build config updated: ${changes.join(", ")}`);
|
|
89492
|
+
if (!UPLOADABLE_SOURCE_TYPES.includes(project.source_type)) {
|
|
89493
|
+
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.`);
|
|
89494
|
+
}
|
|
89113
89495
|
}
|
|
89114
89496
|
function buildConfigChanges(project, candidate) {
|
|
89115
89497
|
const changes = [];
|
|
@@ -93079,6 +93461,10 @@ init_sdk_gen();
|
|
|
93079
93461
|
init_spinner();
|
|
93080
93462
|
init_prompts();
|
|
93081
93463
|
init_output();
|
|
93464
|
+
var SEVERITIES = ["debug", "info", "warning", "error", "critical", "emergency"];
|
|
93465
|
+
function parseProviderIds(value) {
|
|
93466
|
+
return value.split(",").map((id) => id.trim()).filter((id) => id.length > 0).map((id) => parseInt(id, 10));
|
|
93467
|
+
}
|
|
93082
93468
|
function parseEnabledFlag(value) {
|
|
93083
93469
|
if (value === undefined)
|
|
93084
93470
|
return;
|
|
@@ -93132,6 +93518,12 @@ function registerNotificationsCommands(program2) {
|
|
|
93132
93518
|
notifications.command("show").description("Show notification provider details").requiredOption("--id <id>", "Provider ID").option("--json", "Output in JSON format").action(showProvider2);
|
|
93133
93519
|
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
93520
|
notifications.command("test").description("Send a test notification").requiredOption("--id <id>", "Provider ID").action(testProviderAction);
|
|
93521
|
+
const routes = notifications.command("routes").description("Manage severity-based notification routes (which providers receive which severities)");
|
|
93522
|
+
routes.command("list").alias("ls").description("List notification routes").option("--json", "Output in JSON format").action(listRoutes2);
|
|
93523
|
+
routes.command("show").description("Show notification route details").requiredOption("--id <id>", "Route ID").option("--json", "Output in JSON format").action(showRoute);
|
|
93524
|
+
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);
|
|
93525
|
+
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);
|
|
93526
|
+
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
93527
|
}
|
|
93136
93528
|
async function listProviders2(options) {
|
|
93137
93529
|
await requireAuth();
|
|
@@ -93630,6 +94022,216 @@ async function testProviderAction(options) {
|
|
|
93630
94022
|
success2("Test notification sent successfully!");
|
|
93631
94023
|
info2("Check your notification channel for the test message");
|
|
93632
94024
|
}
|
|
94025
|
+
function routeColumns() {
|
|
94026
|
+
return [
|
|
94027
|
+
{ header: "ID", key: "id", width: 6 },
|
|
94028
|
+
{ header: "Name", key: "name", color: (v) => colors.bold(v) },
|
|
94029
|
+
{ header: "Range", accessor: (r) => `${r.min_severity} → ${r.max_severity}` },
|
|
94030
|
+
{ header: "Providers", accessor: (r) => r.provider_ids.join(", ") || "(none)" },
|
|
94031
|
+
{ header: "Status", accessor: (r) => r.enabled ? "enabled" : "disabled", color: (v) => statusBadge(v === "enabled" ? "active" : "inactive") }
|
|
94032
|
+
];
|
|
94033
|
+
}
|
|
94034
|
+
async function listRoutes2(options) {
|
|
94035
|
+
await requireAuth();
|
|
94036
|
+
await setupClient();
|
|
94037
|
+
const routesPage = await withSpinner("Fetching notification routes...", async () => {
|
|
94038
|
+
const { data, error: error3 } = await listNotificationRoutes({ client, query: { page: 1, page_size: 100 } });
|
|
94039
|
+
if (error3) {
|
|
94040
|
+
throw new Error(getErrorMessage(error3));
|
|
94041
|
+
}
|
|
94042
|
+
return data;
|
|
94043
|
+
});
|
|
94044
|
+
const items = routesPage?.items ?? [];
|
|
94045
|
+
if (options.json) {
|
|
94046
|
+
json(items);
|
|
94047
|
+
return;
|
|
94048
|
+
}
|
|
94049
|
+
newline();
|
|
94050
|
+
header(`${icons.info} Notification Routes (${items.length})`);
|
|
94051
|
+
if (items.length === 0) {
|
|
94052
|
+
info2("No notification routes configured");
|
|
94053
|
+
info2('Run: temps notifications routes create --name "Critical alerts" --min-severity critical --max-severity emergency --provider-ids <id> -y');
|
|
94054
|
+
newline();
|
|
94055
|
+
return;
|
|
94056
|
+
}
|
|
94057
|
+
printTable(items, routeColumns(), { style: "minimal" });
|
|
94058
|
+
newline();
|
|
94059
|
+
}
|
|
94060
|
+
async function showRoute(options) {
|
|
94061
|
+
await requireAuth();
|
|
94062
|
+
await setupClient();
|
|
94063
|
+
const id = parseInt(options.id, 10);
|
|
94064
|
+
if (isNaN(id)) {
|
|
94065
|
+
warning2("Invalid route ID");
|
|
94066
|
+
return;
|
|
94067
|
+
}
|
|
94068
|
+
const route = await withSpinner("Fetching route...", async () => {
|
|
94069
|
+
const { data, error: error3 } = await getNotificationRoute({ client, path: { id } });
|
|
94070
|
+
if (error3 || !data) {
|
|
94071
|
+
throw new Error(getErrorMessage(error3) ?? `Route ${options.id} not found`);
|
|
94072
|
+
}
|
|
94073
|
+
return data;
|
|
94074
|
+
});
|
|
94075
|
+
if (options.json) {
|
|
94076
|
+
json(route);
|
|
94077
|
+
return;
|
|
94078
|
+
}
|
|
94079
|
+
newline();
|
|
94080
|
+
header(`${icons.info} ${route.name}`);
|
|
94081
|
+
keyValue("ID", route.id);
|
|
94082
|
+
keyValue("Severity range", `${route.min_severity} → ${route.max_severity}`);
|
|
94083
|
+
keyValue("Providers", route.provider_ids.join(", ") || "(none)");
|
|
94084
|
+
keyValue("Status", route.enabled ? colors.success("enabled") : colors.muted("disabled"));
|
|
94085
|
+
keyValue("Created", new Date(route.created_at * 1000).toLocaleString());
|
|
94086
|
+
keyValue("Updated", new Date(route.updated_at * 1000).toLocaleString());
|
|
94087
|
+
newline();
|
|
94088
|
+
}
|
|
94089
|
+
async function resolveProviderIds(options) {
|
|
94090
|
+
if (options.providerIds) {
|
|
94091
|
+
return parseProviderIds(options.providerIds);
|
|
94092
|
+
}
|
|
94093
|
+
if (options.yes) {
|
|
94094
|
+
throw new Error("--provider-ids is required with -y/--yes");
|
|
94095
|
+
}
|
|
94096
|
+
const { data: providers, error: error3 } = await listNotificationProviders({ client });
|
|
94097
|
+
if (error3) {
|
|
94098
|
+
throw new Error(getErrorMessage(error3));
|
|
94099
|
+
}
|
|
94100
|
+
if (!providers || providers.length === 0) {
|
|
94101
|
+
throw new Error("No notification providers configured. Run: temps notifications add");
|
|
94102
|
+
}
|
|
94103
|
+
const selected = await promptCheckbox({
|
|
94104
|
+
message: "Providers to deliver to this route",
|
|
94105
|
+
choices: providers.map((p) => ({
|
|
94106
|
+
name: `${p.name} (${p.provider_type}, ${p.enabled ? "enabled" : "disabled"})`,
|
|
94107
|
+
value: p.id
|
|
94108
|
+
})),
|
|
94109
|
+
required: true
|
|
94110
|
+
});
|
|
94111
|
+
return selected;
|
|
94112
|
+
}
|
|
94113
|
+
async function createRoute2(options) {
|
|
94114
|
+
await requireAuth();
|
|
94115
|
+
await setupClient();
|
|
94116
|
+
const isAutomation = options.yes && options.name && options.minSeverity && options.maxSeverity && options.providerIds;
|
|
94117
|
+
const name = options.name || await promptText({
|
|
94118
|
+
message: "Route name",
|
|
94119
|
+
required: true
|
|
94120
|
+
});
|
|
94121
|
+
const minSeverity = options.minSeverity || (isAutomation ? undefined : await promptSelect({
|
|
94122
|
+
message: "Minimum severity",
|
|
94123
|
+
choices: SEVERITIES.map((s) => ({ name: s, value: s })),
|
|
94124
|
+
default: "debug"
|
|
94125
|
+
}));
|
|
94126
|
+
if (!minSeverity) {
|
|
94127
|
+
warning2("--min-severity is required with -y/--yes");
|
|
94128
|
+
return;
|
|
94129
|
+
}
|
|
94130
|
+
const maxSeverity = options.maxSeverity || (isAutomation ? undefined : await promptSelect({
|
|
94131
|
+
message: "Maximum severity",
|
|
94132
|
+
choices: SEVERITIES.map((s) => ({ name: s, value: s })),
|
|
94133
|
+
default: "emergency"
|
|
94134
|
+
}));
|
|
94135
|
+
if (!maxSeverity) {
|
|
94136
|
+
warning2("--max-severity is required with -y/--yes");
|
|
94137
|
+
return;
|
|
94138
|
+
}
|
|
94139
|
+
const providerIds = await resolveProviderIds(options);
|
|
94140
|
+
const parsedEnabled = parseEnabledFlag(options.enabled);
|
|
94141
|
+
if (parsedEnabled === "invalid") {
|
|
94142
|
+
warning2('Invalid value for --enabled. Use "true" or "false"');
|
|
94143
|
+
return;
|
|
94144
|
+
}
|
|
94145
|
+
const created = await withSpinner("Creating notification route...", async () => {
|
|
94146
|
+
const { data, error: error3 } = await createNotificationRoute({
|
|
94147
|
+
client,
|
|
94148
|
+
body: {
|
|
94149
|
+
name,
|
|
94150
|
+
min_severity: minSeverity,
|
|
94151
|
+
max_severity: maxSeverity,
|
|
94152
|
+
provider_ids: providerIds,
|
|
94153
|
+
enabled: parsedEnabled ?? true
|
|
94154
|
+
}
|
|
94155
|
+
});
|
|
94156
|
+
if (error3) {
|
|
94157
|
+
throw new Error(getErrorMessage(error3));
|
|
94158
|
+
}
|
|
94159
|
+
return data;
|
|
94160
|
+
});
|
|
94161
|
+
if (options.json && created) {
|
|
94162
|
+
json(created);
|
|
94163
|
+
return;
|
|
94164
|
+
}
|
|
94165
|
+
success2(`Notification route "${created?.name ?? name}" created successfully`);
|
|
94166
|
+
}
|
|
94167
|
+
async function updateRoute2(options) {
|
|
94168
|
+
await requireAuth();
|
|
94169
|
+
await setupClient();
|
|
94170
|
+
const id = parseInt(options.id, 10);
|
|
94171
|
+
if (isNaN(id)) {
|
|
94172
|
+
warning2("Invalid route ID");
|
|
94173
|
+
return;
|
|
94174
|
+
}
|
|
94175
|
+
const parsedEnabled = parseEnabledFlag(options.enabled);
|
|
94176
|
+
if (parsedEnabled === "invalid") {
|
|
94177
|
+
warning2('Invalid value for --enabled. Use "true" or "false"');
|
|
94178
|
+
return;
|
|
94179
|
+
}
|
|
94180
|
+
const updated = await withSpinner("Updating notification route...", async () => {
|
|
94181
|
+
const { data, error: error3 } = await updateNotificationRoute({
|
|
94182
|
+
client,
|
|
94183
|
+
path: { id },
|
|
94184
|
+
body: {
|
|
94185
|
+
name: options.name ?? undefined,
|
|
94186
|
+
min_severity: options.minSeverity ?? undefined,
|
|
94187
|
+
max_severity: options.maxSeverity ?? undefined,
|
|
94188
|
+
provider_ids: options.providerIds ? parseProviderIds(options.providerIds) : undefined,
|
|
94189
|
+
enabled: parsedEnabled ?? undefined
|
|
94190
|
+
}
|
|
94191
|
+
});
|
|
94192
|
+
if (error3) {
|
|
94193
|
+
throw new Error(getErrorMessage(error3));
|
|
94194
|
+
}
|
|
94195
|
+
return data;
|
|
94196
|
+
});
|
|
94197
|
+
if (options.json && updated) {
|
|
94198
|
+
json(updated);
|
|
94199
|
+
return;
|
|
94200
|
+
}
|
|
94201
|
+
success2(`Notification route "${updated?.name ?? options.id}" updated successfully`);
|
|
94202
|
+
}
|
|
94203
|
+
async function removeRoute(options) {
|
|
94204
|
+
await requireAuth();
|
|
94205
|
+
await setupClient();
|
|
94206
|
+
const id = parseInt(options.id, 10);
|
|
94207
|
+
if (isNaN(id)) {
|
|
94208
|
+
warning2("Invalid route ID");
|
|
94209
|
+
return;
|
|
94210
|
+
}
|
|
94211
|
+
const { data: route, error: getError } = await getNotificationRoute({ client, path: { id } });
|
|
94212
|
+
if (getError || !route) {
|
|
94213
|
+
warning2(`Route ${options.id} not found`);
|
|
94214
|
+
return;
|
|
94215
|
+
}
|
|
94216
|
+
const skipConfirmation = options.force || options.yes;
|
|
94217
|
+
if (!skipConfirmation) {
|
|
94218
|
+
const confirmed = await promptConfirm({
|
|
94219
|
+
message: `Remove notification route "${route.name}"?`,
|
|
94220
|
+
default: false
|
|
94221
|
+
});
|
|
94222
|
+
if (!confirmed) {
|
|
94223
|
+
info2("Cancelled");
|
|
94224
|
+
return;
|
|
94225
|
+
}
|
|
94226
|
+
}
|
|
94227
|
+
await withSpinner("Removing route...", async () => {
|
|
94228
|
+
const { error: error3 } = await deleteNotificationRoute({ client, path: { id } });
|
|
94229
|
+
if (error3) {
|
|
94230
|
+
throw new Error(getErrorMessage(error3));
|
|
94231
|
+
}
|
|
94232
|
+
});
|
|
94233
|
+
success2("Notification route removed");
|
|
94234
|
+
}
|
|
93633
94235
|
|
|
93634
94236
|
// src/commands/dns/index.ts
|
|
93635
94237
|
init_sdk_gen();
|
|
@@ -95573,6 +96175,23 @@ function buildAutomationSettingsUpdate(options, currentSettings) {
|
|
|
95573
96175
|
max_requests_per_minute: options.rateLimitingRpm ? parseInt(options.rateLimitingRpm, 10) : currentSettings?.rate_limiting?.max_requests_per_minute || 60
|
|
95574
96176
|
};
|
|
95575
96177
|
}
|
|
96178
|
+
if (options.consoleForceHttps !== undefined) {
|
|
96179
|
+
switch (options.consoleForceHttps) {
|
|
96180
|
+
case "auto":
|
|
96181
|
+
updates.console_force_https = null;
|
|
96182
|
+
break;
|
|
96183
|
+
case "always":
|
|
96184
|
+
updates.console_force_https = true;
|
|
96185
|
+
break;
|
|
96186
|
+
case "never":
|
|
96187
|
+
updates.console_force_https = false;
|
|
96188
|
+
break;
|
|
96189
|
+
default:
|
|
96190
|
+
return {
|
|
96191
|
+
error: `--console-force-https must be auto, always or never, got "${options.consoleForceHttps}"`
|
|
96192
|
+
};
|
|
96193
|
+
}
|
|
96194
|
+
}
|
|
95576
96195
|
if (options.screenshotsEnabled !== undefined) {
|
|
95577
96196
|
const enabled = options.screenshotsEnabled === "true";
|
|
95578
96197
|
updates.screenshots = {
|
|
@@ -95606,6 +96225,37 @@ function buildAutomationSettingsUpdate(options, currentSettings) {
|
|
|
95606
96225
|
default_websocket_idle_timeout_seconds: parsed[3]
|
|
95607
96226
|
};
|
|
95608
96227
|
}
|
|
96228
|
+
if (options.maxMemoryLimitMb !== undefined || options.maxConcurrentConnectionsCeiling !== undefined || options.allowUnlimitedTimeouts !== undefined) {
|
|
96229
|
+
const current = currentSettings?.tenant_resource_ceilings;
|
|
96230
|
+
const numeric = [
|
|
96231
|
+
["--max-memory-limit-mb", options.maxMemoryLimitMb, current?.max_memory_limit_mb ?? 0],
|
|
96232
|
+
["--max-concurrent-connections-ceiling", options.maxConcurrentConnectionsCeiling, current?.max_concurrent_connections ?? 0]
|
|
96233
|
+
];
|
|
96234
|
+
const parsed = [];
|
|
96235
|
+
for (const [flag, raw, fallback] of numeric) {
|
|
96236
|
+
if (raw === undefined) {
|
|
96237
|
+
parsed.push(fallback);
|
|
96238
|
+
continue;
|
|
96239
|
+
}
|
|
96240
|
+
const value = parseInt(raw, 10);
|
|
96241
|
+
if (Number.isNaN(value) || value < 0) {
|
|
96242
|
+
return { error: `${flag} must be a non-negative number (0 = no ceiling), got "${raw}"` };
|
|
96243
|
+
}
|
|
96244
|
+
parsed.push(value);
|
|
96245
|
+
}
|
|
96246
|
+
let allowUnlimited = current?.allow_unlimited_request_timeouts ?? true;
|
|
96247
|
+
if (options.allowUnlimitedTimeouts !== undefined) {
|
|
96248
|
+
if (options.allowUnlimitedTimeouts !== "true" && options.allowUnlimitedTimeouts !== "false") {
|
|
96249
|
+
return { error: `--allow-unlimited-timeouts must be true or false, got "${options.allowUnlimitedTimeouts}"` };
|
|
96250
|
+
}
|
|
96251
|
+
allowUnlimited = options.allowUnlimitedTimeouts === "true";
|
|
96252
|
+
}
|
|
96253
|
+
updates.tenant_resource_ceilings = {
|
|
96254
|
+
max_memory_limit_mb: parsed[0],
|
|
96255
|
+
max_concurrent_connections: parsed[1],
|
|
96256
|
+
allow_unlimited_request_timeouts: allowUnlimited
|
|
96257
|
+
};
|
|
96258
|
+
}
|
|
95609
96259
|
if (options.setting && options.value) {
|
|
95610
96260
|
switch (options.setting) {
|
|
95611
96261
|
case "external_url":
|
|
@@ -95626,7 +96276,7 @@ function buildAutomationSettingsUpdate(options, currentSettings) {
|
|
|
95626
96276
|
function registerSettingsCommands(program2) {
|
|
95627
96277
|
const settings = program2.command("settings").description("Manage platform settings");
|
|
95628
96278
|
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);
|
|
96279
|
+
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
96280
|
settings.command("set-external-url").description("Set the external URL for the platform").requiredOption("--url <url>", "External URL").action(setExternalUrl);
|
|
95631
96281
|
settings.command("set-preview-domain").description("Set the preview domain pattern").requiredOption("--domain <domain>", "Preview domain pattern").action(setPreviewDomain);
|
|
95632
96282
|
}
|
|
@@ -95651,6 +96301,7 @@ async function showSettings(options) {
|
|
|
95651
96301
|
newline();
|
|
95652
96302
|
header(`${icons.info} Platform Settings`);
|
|
95653
96303
|
keyValue("External URL", appSettings.external_url || colors.muted("Not set"));
|
|
96304
|
+
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
96305
|
keyValue("Preview Domain", appSettings.preview_domain || colors.muted("Not set"));
|
|
95655
96306
|
newline();
|
|
95656
96307
|
header("Let's Encrypt");
|
|
@@ -95705,6 +96356,12 @@ async function showSettings(options) {
|
|
|
95705
96356
|
info2("Not configured");
|
|
95706
96357
|
}
|
|
95707
96358
|
newline();
|
|
96359
|
+
header("Project Override Ceilings");
|
|
96360
|
+
const ceilings = appSettings.tenant_resource_ceilings;
|
|
96361
|
+
keyValue("Max Memory Limit", ceilings?.max_memory_limit_mb ? `${ceilings.max_memory_limit_mb} MB` : colors.muted("No ceiling"));
|
|
96362
|
+
keyValue("Max Concurrent Connections", ceilings?.max_concurrent_connections ? ceilings.max_concurrent_connections.toString() : colors.muted("No ceiling"));
|
|
96363
|
+
keyValue("Projects May Disable Timeouts", ceilings?.allow_unlimited_request_timeouts === false ? colors.muted("No") : colors.success("Yes"));
|
|
96364
|
+
newline();
|
|
95708
96365
|
}
|
|
95709
96366
|
async function updateSettingsAction2(options) {
|
|
95710
96367
|
await requireAuth();
|
|
@@ -95714,7 +96371,7 @@ async function updateSettingsAction2(options) {
|
|
|
95714
96371
|
throw new Error(getErrorMessage(getError));
|
|
95715
96372
|
}
|
|
95716
96373
|
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);
|
|
96374
|
+
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
96375
|
if (isAutomation) {
|
|
95719
96376
|
const result2 = buildAutomationSettingsUpdate(options, currentSettings ?? undefined);
|
|
95720
96377
|
if ("error" in result2) {
|
|
@@ -97796,6 +98453,7 @@ function registerContainersCommands(program2) {
|
|
|
97796
98453
|
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
98454
|
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
98455
|
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);
|
|
98456
|
+
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
98457
|
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
98458
|
}
|
|
97801
98459
|
async function listContainersAction(options) {
|
|
@@ -97874,6 +98532,53 @@ async function listContainersAction(options) {
|
|
|
97874
98532
|
printTable(all, baseColumns, { style: "minimal" });
|
|
97875
98533
|
newline();
|
|
97876
98534
|
}
|
|
98535
|
+
async function listContainerHistoryAction(options) {
|
|
98536
|
+
await requireAuth();
|
|
98537
|
+
await setupClient();
|
|
98538
|
+
const projId = parseInt(options.projectId, 10);
|
|
98539
|
+
const envId = parseInt(options.environmentId, 10);
|
|
98540
|
+
if (isNaN(projId) || isNaN(envId)) {
|
|
98541
|
+
warning2("Invalid project or environment ID");
|
|
98542
|
+
return;
|
|
98543
|
+
}
|
|
98544
|
+
const containers = await withSpinner("Fetching container history...", async () => {
|
|
98545
|
+
const { data, error: error3 } = await listContainerHistory({
|
|
98546
|
+
client,
|
|
98547
|
+
path: { project_id: projId, environment_id: envId }
|
|
98548
|
+
});
|
|
98549
|
+
if (error3)
|
|
98550
|
+
throw new Error(getErrorMessage(error3));
|
|
98551
|
+
return data?.containers ?? [];
|
|
98552
|
+
});
|
|
98553
|
+
if (options.json) {
|
|
98554
|
+
json(containers);
|
|
98555
|
+
return;
|
|
98556
|
+
}
|
|
98557
|
+
newline();
|
|
98558
|
+
header(`${icons.info} Container history (${containers.length})`);
|
|
98559
|
+
if (containers.length === 0) {
|
|
98560
|
+
info2("No containers have ever run in this environment");
|
|
98561
|
+
newline();
|
|
98562
|
+
return;
|
|
98563
|
+
}
|
|
98564
|
+
const columns = [
|
|
98565
|
+
{ header: "ID", key: "container_id", width: 16, color: (v) => colors.muted(v.slice(0, 12) + "...") },
|
|
98566
|
+
{ header: "Name", key: "container_name", color: (v) => colors.bold(v) },
|
|
98567
|
+
{
|
|
98568
|
+
header: "Status",
|
|
98569
|
+
accessor: (c) => c.is_current ? "current" : "replaced",
|
|
98570
|
+
color: (v) => statusBadge(v === "current" ? "active" : "inactive")
|
|
98571
|
+
},
|
|
98572
|
+
{ header: "Deployed", key: "deployed_at", color: (v) => colors.muted(new Date(v).toLocaleString()) },
|
|
98573
|
+
{
|
|
98574
|
+
header: "Removed",
|
|
98575
|
+
accessor: (c) => c.deleted_at ? new Date(c.deleted_at).toLocaleString() : "—",
|
|
98576
|
+
color: (v) => colors.muted(v)
|
|
98577
|
+
}
|
|
98578
|
+
];
|
|
98579
|
+
printTable(containers, columns, { style: "minimal" });
|
|
98580
|
+
newline();
|
|
98581
|
+
}
|
|
97877
98582
|
async function showContainer(options) {
|
|
97878
98583
|
await requireAuth();
|
|
97879
98584
|
await setupClient();
|
|
@@ -98302,6 +99007,92 @@ async function watchMetrics(projectId, environmentId, containerIds, intervalMs)
|
|
|
98302
99007
|
console.log("\x1B[?25h");
|
|
98303
99008
|
}
|
|
98304
99009
|
|
|
99010
|
+
// src/commands/cluster/index.ts
|
|
99011
|
+
init_spinner();
|
|
99012
|
+
init_output();
|
|
99013
|
+
var STALE_SYNC_THRESHOLD_SECONDS = 120;
|
|
99014
|
+
function classifyNodeDnsHealth(entry) {
|
|
99015
|
+
if (entry.dns_resolver_running === null)
|
|
99016
|
+
return "unknown";
|
|
99017
|
+
if (!entry.dns_resolver_running)
|
|
99018
|
+
return "disabled";
|
|
99019
|
+
if (entry.dns_resolver_tasks_alive === false)
|
|
99020
|
+
return "unhealthy";
|
|
99021
|
+
if (entry.dns_resolver_consecutive_failures > 0)
|
|
99022
|
+
return "degraded";
|
|
99023
|
+
if (entry.seconds_since_last_sync !== null && entry.seconds_since_last_sync > STALE_SYNC_THRESHOLD_SECONDS) {
|
|
99024
|
+
return "degraded";
|
|
99025
|
+
}
|
|
99026
|
+
return "healthy";
|
|
99027
|
+
}
|
|
99028
|
+
function formatSyncAge(entry) {
|
|
99029
|
+
if (entry.dns_resolver_last_sync_at === null)
|
|
99030
|
+
return "never";
|
|
99031
|
+
return formatRelativeTime(entry.dns_resolver_last_sync_at);
|
|
99032
|
+
}
|
|
99033
|
+
function registerClusterCommands(program2) {
|
|
99034
|
+
const cluster = program2.command("cluster").description("Cluster-wide multi-node operations");
|
|
99035
|
+
const dns = cluster.command("dns").description("Cluster DNS resolver (ADR-024) operations");
|
|
99036
|
+
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);
|
|
99037
|
+
}
|
|
99038
|
+
async function dnsStatusAction(options) {
|
|
99039
|
+
await requireAuth();
|
|
99040
|
+
await setupClient();
|
|
99041
|
+
const result2 = await withSpinner("Fetching cluster DNS status...", async () => {
|
|
99042
|
+
const { data, error: error3 } = await client.get({
|
|
99043
|
+
url: "cluster/dns/status"
|
|
99044
|
+
});
|
|
99045
|
+
if (error3 || !data) {
|
|
99046
|
+
throw new Error(getErrorMessage(error3));
|
|
99047
|
+
}
|
|
99048
|
+
return data;
|
|
99049
|
+
});
|
|
99050
|
+
if (options.json) {
|
|
99051
|
+
json(result2);
|
|
99052
|
+
return;
|
|
99053
|
+
}
|
|
99054
|
+
newline();
|
|
99055
|
+
header(`${icons.globe} Cluster DNS Status`);
|
|
99056
|
+
keyValue("Cluster DNS enabled", result2.cluster_dns_enabled ? colors.success("yes") : colors.muted("no"));
|
|
99057
|
+
keyValue("Total DNS records", result2.total_record_count);
|
|
99058
|
+
if (result2.nodes.length === 0) {
|
|
99059
|
+
newline();
|
|
99060
|
+
console.log(colors.muted(" No nodes registered"));
|
|
99061
|
+
newline();
|
|
99062
|
+
return;
|
|
99063
|
+
}
|
|
99064
|
+
newline();
|
|
99065
|
+
const columns = [
|
|
99066
|
+
{ header: "Node", key: "node_name", color: (v) => colors.bold(v) },
|
|
99067
|
+
{ header: "Node Status", accessor: (n) => n.node_status, color: (v) => statusBadge(v) },
|
|
99068
|
+
{
|
|
99069
|
+
header: "Resolver",
|
|
99070
|
+
accessor: (n) => classifyNodeDnsHealth(n),
|
|
99071
|
+
color: (v) => statusBadge(v)
|
|
99072
|
+
},
|
|
99073
|
+
{ header: "Last Sync", accessor: (n) => formatSyncAge(n) },
|
|
99074
|
+
{
|
|
99075
|
+
header: "Failures",
|
|
99076
|
+
accessor: (n) => n.dns_resolver_consecutive_failures.toString(),
|
|
99077
|
+
color: (v) => parseInt(v, 10) > 0 ? colors.error(v) : colors.muted(v)
|
|
99078
|
+
},
|
|
99079
|
+
{
|
|
99080
|
+
header: "Records",
|
|
99081
|
+
accessor: (n) => n.dns_resolver_record_count === null ? "-" : n.dns_resolver_record_count.toString()
|
|
99082
|
+
}
|
|
99083
|
+
];
|
|
99084
|
+
printTable(result2.nodes, columns, { style: "minimal" });
|
|
99085
|
+
const withErrors = result2.nodes.filter((n) => n.dns_resolver_last_error);
|
|
99086
|
+
if (withErrors.length > 0) {
|
|
99087
|
+
newline();
|
|
99088
|
+
console.log(colors.muted(" Last errors:"));
|
|
99089
|
+
for (const node of withErrors) {
|
|
99090
|
+
console.log(` ${colors.bold(node.node_name)}: ${colors.error(node.dns_resolver_last_error ?? "")}`);
|
|
99091
|
+
}
|
|
99092
|
+
}
|
|
99093
|
+
newline();
|
|
99094
|
+
}
|
|
99095
|
+
|
|
98305
99096
|
// src/commands/docs.ts
|
|
98306
99097
|
import { writeFile as writeFile6 } from "node:fs/promises";
|
|
98307
99098
|
|
|
@@ -98646,7 +99437,7 @@ function registerErrorsCommands(program2) {
|
|
|
98646
99437
|
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
99438
|
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
99439
|
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);
|
|
99440
|
+
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
99441
|
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
99442
|
const sourcemaps = errors8.command("sourcemaps").alias("sm").description("Manage source maps for error symbolication");
|
|
98652
99443
|
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 +99722,7 @@ async function getErrorTimelineAction(options) {
|
|
|
98931
99722
|
const endTime = new Date;
|
|
98932
99723
|
const startTime = new Date;
|
|
98933
99724
|
startTime.setDate(startTime.getDate() - days);
|
|
99725
|
+
const environmentId = options.environmentId ? parseInt(options.environmentId, 10) : undefined;
|
|
98934
99726
|
const timeSeries = await withSpinner("Fetching error timeline...", async () => {
|
|
98935
99727
|
const { data, error: error3 } = await getErrorTimeSeries({
|
|
98936
99728
|
client,
|
|
@@ -98938,7 +99730,8 @@ async function getErrorTimelineAction(options) {
|
|
|
98938
99730
|
query: {
|
|
98939
99731
|
start_time: startTime.toISOString(),
|
|
98940
99732
|
end_time: endTime.toISOString(),
|
|
98941
|
-
bucket: options.bucket
|
|
99733
|
+
bucket: options.bucket,
|
|
99734
|
+
...environmentId && { environment_id: environmentId }
|
|
98942
99735
|
}
|
|
98943
99736
|
});
|
|
98944
99737
|
if (error3) {
|
|
@@ -100710,6 +101503,178 @@ async function testInstanceDefaultAction(id, options) {
|
|
|
100710
101503
|
newline();
|
|
100711
101504
|
}
|
|
100712
101505
|
|
|
101506
|
+
// src/commands/otel/ingest-errors.ts
|
|
101507
|
+
init_sdk_gen();
|
|
101508
|
+
init_spinner();
|
|
101509
|
+
init_output();
|
|
101510
|
+
var ERROR_CLASS_WORDS = {
|
|
101511
|
+
clickhouse: "ClickHouse",
|
|
101512
|
+
postgres: "Postgres",
|
|
101513
|
+
conn: "connection",
|
|
101514
|
+
s3: "S3",
|
|
101515
|
+
io: "I/O"
|
|
101516
|
+
};
|
|
101517
|
+
function humanizeErrorClass(errorClass) {
|
|
101518
|
+
const words2 = errorClass.split("_").map((w) => ERROR_CLASS_WORDS[w] ?? w).join(" ");
|
|
101519
|
+
return words2.charAt(0).toUpperCase() + words2.slice(1);
|
|
101520
|
+
}
|
|
101521
|
+
async function otelIngestErrors(options) {
|
|
101522
|
+
await requireAuth();
|
|
101523
|
+
await setupClient();
|
|
101524
|
+
const limit = options.limit ? parseInt(options.limit, 10) : undefined;
|
|
101525
|
+
if (limit !== undefined && (Number.isNaN(limit) || limit < 1)) {
|
|
101526
|
+
throw new Error(`Invalid --limit "${options.limit}". Must be a positive integer.`);
|
|
101527
|
+
}
|
|
101528
|
+
const data = await withSpinner("Fetching ingest errors...", async () => {
|
|
101529
|
+
const { data: data2, error: error3 } = await getIngestErrors({
|
|
101530
|
+
client,
|
|
101531
|
+
query: limit === undefined ? {} : { limit }
|
|
101532
|
+
});
|
|
101533
|
+
if (error3)
|
|
101534
|
+
throw new Error(getErrorMessage(error3));
|
|
101535
|
+
return data2;
|
|
101536
|
+
});
|
|
101537
|
+
const errors8 = data?.errors ?? [];
|
|
101538
|
+
if (options.json) {
|
|
101539
|
+
json({ count: errors8.length, errors: errors8 });
|
|
101540
|
+
return;
|
|
101541
|
+
}
|
|
101542
|
+
header("OTel ingest errors");
|
|
101543
|
+
if (errors8.length === 0) {
|
|
101544
|
+
newline();
|
|
101545
|
+
console.log(colors.muted(" No ingest errors recorded in the last 7 days."));
|
|
101546
|
+
console.log(colors.muted(" Entries appear here only when a storage write fails after all retries."));
|
|
101547
|
+
newline();
|
|
101548
|
+
return;
|
|
101549
|
+
}
|
|
101550
|
+
const columns = [
|
|
101551
|
+
{ header: "Signal", accessor: (e) => e.signal_type, align: "left" },
|
|
101552
|
+
{
|
|
101553
|
+
header: "Reason",
|
|
101554
|
+
accessor: (e) => humanizeErrorClass(e.error_class),
|
|
101555
|
+
align: "left"
|
|
101556
|
+
},
|
|
101557
|
+
{ header: "Count", accessor: (e) => e.count, align: "right" },
|
|
101558
|
+
{
|
|
101559
|
+
header: "Last seen",
|
|
101560
|
+
accessor: (e) => formatRelativeTime(e.last_seen),
|
|
101561
|
+
align: "right"
|
|
101562
|
+
},
|
|
101563
|
+
{
|
|
101564
|
+
header: "Sample message",
|
|
101565
|
+
accessor: (e) => truncate(e.sample_message, 60),
|
|
101566
|
+
align: "left"
|
|
101567
|
+
}
|
|
101568
|
+
];
|
|
101569
|
+
printTable(errors8, columns, { style: "minimal" });
|
|
101570
|
+
newline();
|
|
101571
|
+
console.log(colors.muted(` ${errors8.length} failure group(s). Each entry means data was dropped after retries were exhausted.`));
|
|
101572
|
+
newline();
|
|
101573
|
+
}
|
|
101574
|
+
|
|
101575
|
+
// src/commands/otel/pipeline-history.ts
|
|
101576
|
+
init_sdk_gen();
|
|
101577
|
+
init_spinner();
|
|
101578
|
+
init_output();
|
|
101579
|
+
var SERVER_PRESETS = new Set(["1h", "6h", "24h", "7d"]);
|
|
101580
|
+
function summarize(series) {
|
|
101581
|
+
const values2 = series.points.map((p) => p.value);
|
|
101582
|
+
if (values2.length === 0) {
|
|
101583
|
+
return { name: series.name, buckets: 0, peak: 0, mean: 0, last: 0 };
|
|
101584
|
+
}
|
|
101585
|
+
const sum2 = values2.reduce((a, b) => a + b, 0);
|
|
101586
|
+
return {
|
|
101587
|
+
name: series.name,
|
|
101588
|
+
buckets: values2.length,
|
|
101589
|
+
peak: Math.max(...values2),
|
|
101590
|
+
mean: sum2 / values2.length,
|
|
101591
|
+
last: values2[values2.length - 1] ?? 0
|
|
101592
|
+
};
|
|
101593
|
+
}
|
|
101594
|
+
function formatValue(v) {
|
|
101595
|
+
return Number.isInteger(v) ? String(v) : v.toFixed(2);
|
|
101596
|
+
}
|
|
101597
|
+
async function otelPipelineHistory(options) {
|
|
101598
|
+
await requireAuth();
|
|
101599
|
+
await setupClient();
|
|
101600
|
+
const query = {};
|
|
101601
|
+
let periodLabel;
|
|
101602
|
+
if (options.startTime || options.endTime) {
|
|
101603
|
+
if (!options.startTime || !options.endTime) {
|
|
101604
|
+
throw new Error("--start-time and --end-time must be provided together (or use --period).");
|
|
101605
|
+
}
|
|
101606
|
+
query.start_time = options.startTime;
|
|
101607
|
+
query.end_time = options.endTime;
|
|
101608
|
+
periodLabel = "custom range";
|
|
101609
|
+
} else {
|
|
101610
|
+
const period = options.period ?? "24h";
|
|
101611
|
+
if (SERVER_PRESETS.has(period)) {
|
|
101612
|
+
query.range = period;
|
|
101613
|
+
periodLabel = period;
|
|
101614
|
+
} else {
|
|
101615
|
+
const parsed = parsePeriod(period);
|
|
101616
|
+
query.start_time = parsed.startDate;
|
|
101617
|
+
query.end_time = parsed.endDate;
|
|
101618
|
+
periodLabel = parsed.label;
|
|
101619
|
+
}
|
|
101620
|
+
}
|
|
101621
|
+
const data = await withSpinner("Fetching pipeline history...", async () => {
|
|
101622
|
+
const { data: data2, error: error3 } = await getPipelineHistory({ client, query });
|
|
101623
|
+
if (error3)
|
|
101624
|
+
throw new Error(getErrorMessage(error3));
|
|
101625
|
+
return data2;
|
|
101626
|
+
});
|
|
101627
|
+
if (options.json) {
|
|
101628
|
+
json(data);
|
|
101629
|
+
return;
|
|
101630
|
+
}
|
|
101631
|
+
const series = data?.series ?? [];
|
|
101632
|
+
const interval = data?.sample_interval_seconds ?? 60;
|
|
101633
|
+
header(`OTel pipeline history (${periodLabel})`);
|
|
101634
|
+
if (series.length === 0 || series.every((s) => s.points.length === 0)) {
|
|
101635
|
+
newline();
|
|
101636
|
+
console.log(colors.muted(" No samples recorded in this window."));
|
|
101637
|
+
console.log(colors.muted(` The pipeline sampler writes every ${interval}s, so a server started recently has no history yet.`));
|
|
101638
|
+
newline();
|
|
101639
|
+
return;
|
|
101640
|
+
}
|
|
101641
|
+
const summaries = series.map(summarize);
|
|
101642
|
+
const columns = [
|
|
101643
|
+
{ header: "Metric", accessor: (s) => s.name, align: "left" },
|
|
101644
|
+
{ header: "Peak", accessor: (s) => formatValue(s.peak), align: "right" },
|
|
101645
|
+
{ header: "Avg", accessor: (s) => formatValue(s.mean), align: "right" },
|
|
101646
|
+
{ header: "Last", accessor: (s) => formatValue(s.last), align: "right" },
|
|
101647
|
+
{ header: "Buckets", accessor: (s) => s.buckets, align: "right" }
|
|
101648
|
+
];
|
|
101649
|
+
printTable(summaries, columns, { style: "minimal" });
|
|
101650
|
+
newline();
|
|
101651
|
+
console.log(colors.muted(` Window ${data?.start_time} to ${data?.end_time}, ${data?.step_seconds}s buckets.`));
|
|
101652
|
+
console.log(colors.muted(` Values are counts per ${interval}s sample, not window totals. Use --json for every bucket.`));
|
|
101653
|
+
newline();
|
|
101654
|
+
}
|
|
101655
|
+
|
|
101656
|
+
// src/commands/otel/index.ts
|
|
101657
|
+
function registerOtelCommands(program2) {
|
|
101658
|
+
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)');
|
|
101659
|
+
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);
|
|
101660
|
+
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);
|
|
101661
|
+
otel.addHelpText("after", `
|
|
101662
|
+
Triage workflow — a drop counter moved, now find out why:
|
|
101663
|
+
$ temps otel pipeline-history --period 24h # when did it happen?
|
|
101664
|
+
$ temps otel ingest-errors # what failed, and how often?
|
|
101665
|
+
|
|
101666
|
+
Examples:
|
|
101667
|
+
$ temps otel ingest-errors --limit 50
|
|
101668
|
+
$ temps otel ingest-errors --json
|
|
101669
|
+
$ temps otel pipeline-history --period 7d
|
|
101670
|
+
$ temps otel pipeline-history \\
|
|
101671
|
+
--start-time 2026-08-24T00:00:00Z --end-time 2026-08-25T00:00:00Z --json
|
|
101672
|
+
|
|
101673
|
+
Notes:
|
|
101674
|
+
Ingest errors are recorded only after a storage write exhausts its retries,
|
|
101675
|
+
so any entry means data was actually lost. Windows are capped at 7 days.`);
|
|
101676
|
+
}
|
|
101677
|
+
|
|
100713
101678
|
// src/commands/kv/index.ts
|
|
100714
101679
|
init_output();
|
|
100715
101680
|
function registerKvCommands(program2) {
|
|
@@ -100818,7 +101783,7 @@ function assertValueType(raw) {
|
|
|
100818
101783
|
}
|
|
100819
101784
|
throw new Error(`Invalid type "${raw}". Must be one of: bool, string, number, json`);
|
|
100820
101785
|
}
|
|
100821
|
-
function
|
|
101786
|
+
function formatValue2(value) {
|
|
100822
101787
|
if (value === null || value === undefined)
|
|
100823
101788
|
return colors.dim("(inherits default)");
|
|
100824
101789
|
return typeof value === "string" ? value : JSON.stringify(value);
|
|
@@ -100826,14 +101791,14 @@ function formatValue(value) {
|
|
|
100826
101791
|
function effectiveValue(flag, environmentId) {
|
|
100827
101792
|
const override = flag.environments?.find((e) => e.environment_id === environmentId);
|
|
100828
101793
|
if (!override)
|
|
100829
|
-
return `${
|
|
101794
|
+
return `${formatValue2(flag.default_value)} ${colors.dim("(default)")}`;
|
|
100830
101795
|
if (!override.enabled) {
|
|
100831
|
-
return `${
|
|
101796
|
+
return `${formatValue2(flag.default_value)} ${colors.warning("(disabled)")}`;
|
|
100832
101797
|
}
|
|
100833
101798
|
if (override.value === null || override.value === undefined) {
|
|
100834
|
-
return `${
|
|
101799
|
+
return `${formatValue2(flag.default_value)} ${colors.dim("(default)")}`;
|
|
100835
101800
|
}
|
|
100836
|
-
return
|
|
101801
|
+
return formatValue2(override.value);
|
|
100837
101802
|
}
|
|
100838
101803
|
async function listFlagsCmd(options) {
|
|
100839
101804
|
await requireAuth();
|
|
@@ -100870,7 +101835,7 @@ async function listFlagsCmd(options) {
|
|
|
100870
101835
|
const columns = [
|
|
100871
101836
|
{ header: "Key", key: "key", color: (v) => colors.bold(v) },
|
|
100872
101837
|
{ header: "Type", key: "value_type" },
|
|
100873
|
-
environmentId !== undefined ? { header: options.environment, accessor: (f) => effectiveValue(f, environmentId) } : { header: "Default", accessor: (f) =>
|
|
101838
|
+
environmentId !== undefined ? { header: options.environment, accessor: (f) => effectiveValue(f, environmentId) } : { header: "Default", accessor: (f) => formatValue2(f.default_value) },
|
|
100874
101839
|
{ header: "Client", accessor: (f) => f.client_visible ? "yes" : "no" },
|
|
100875
101840
|
{ header: "Status", accessor: (f) => f.archived_at ? "archived" : "active", color: (value, f) => f.archived_at ? colors.dim(value) : value }
|
|
100876
101841
|
];
|
|
@@ -100901,7 +101866,7 @@ async function getFlagCmd(key, options) {
|
|
|
100901
101866
|
newline();
|
|
100902
101867
|
header(`${icons.folder} ${flag.key}`);
|
|
100903
101868
|
keyValue("Type", flag.value_type);
|
|
100904
|
-
keyValue("Default",
|
|
101869
|
+
keyValue("Default", formatValue2(flag.default_value));
|
|
100905
101870
|
keyValue("Description", flag.description ?? "-");
|
|
100906
101871
|
keyValue("Client visible", flag.client_visible ? "yes" : "no");
|
|
100907
101872
|
keyValue("Last evaluated by an app", flag.last_evaluated_at ?? colors.dim("never"));
|
|
@@ -100915,7 +101880,7 @@ async function getFlagCmd(key, options) {
|
|
|
100915
101880
|
printTable(flag.environments, [
|
|
100916
101881
|
{ header: "Environment ID", accessor: (e) => String(e.environment_id) },
|
|
100917
101882
|
{ header: "Enabled", accessor: (e) => e.enabled ? "yes" : "no (kill switch)", color: (value, e) => e.enabled ? value : colors.warning(value) },
|
|
100918
|
-
{ header: "Value", accessor: (e) =>
|
|
101883
|
+
{ header: "Value", accessor: (e) => formatValue2(e.value) }
|
|
100919
101884
|
], { style: "minimal" });
|
|
100920
101885
|
}
|
|
100921
101886
|
newline();
|
|
@@ -100949,7 +101914,7 @@ async function createFlagCmd(key, options) {
|
|
|
100949
101914
|
return;
|
|
100950
101915
|
}
|
|
100951
101916
|
newline();
|
|
100952
|
-
success2(`Created flag ${colors.bold(flag.key)} (${flag.value_type}, default ${
|
|
101917
|
+
success2(`Created flag ${colors.bold(flag.key)} (${flag.value_type}, default ${formatValue2(flag.default_value)})`);
|
|
100953
101918
|
if (!flag.client_visible) {
|
|
100954
101919
|
info2("Server-only. Pass --client-visible to expose it to browsers.");
|
|
100955
101920
|
}
|
|
@@ -103191,7 +104156,7 @@ function resolveIpAccessAction(rawAction) {
|
|
|
103191
104156
|
function registerIpAccessCommands(program2) {
|
|
103192
104157
|
const ipAccess = program2.command("ip-access").alias("ipa").description("Manage IP access control rules");
|
|
103193
104158
|
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>", '
|
|
104159
|
+
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
104160
|
ipAccess.command("show").description("Show IP access control rule details").requiredOption("--id <id>", "Rule ID").option("--json", "Output in JSON format").action(showIpAccessAction);
|
|
103196
104161
|
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
104162
|
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,8 +104828,20 @@ function printProxyLogDetail(log) {
|
|
|
103863
104828
|
header("Error");
|
|
103864
104829
|
console.log(` ${colors.error(log.error_message)}`);
|
|
103865
104830
|
}
|
|
104831
|
+
printHeaderSection("Request Headers", log.request_headers);
|
|
104832
|
+
printHeaderSection("Response Headers", log.response_headers);
|
|
103866
104833
|
newline();
|
|
103867
104834
|
}
|
|
104835
|
+
function printHeaderSection(title, headers) {
|
|
104836
|
+
const entries = Object.entries(headers ?? {});
|
|
104837
|
+
if (entries.length === 0)
|
|
104838
|
+
return;
|
|
104839
|
+
newline();
|
|
104840
|
+
header(title);
|
|
104841
|
+
for (const [name, value] of entries) {
|
|
104842
|
+
keyValue(name, value === "[REDACTED]" ? colors.dim(value) : value);
|
|
104843
|
+
}
|
|
104844
|
+
}
|
|
103868
104845
|
function formatBytes6(bytes) {
|
|
103869
104846
|
if (bytes === 0)
|
|
103870
104847
|
return "0 B";
|
|
@@ -103889,6 +104866,100 @@ function registerEmailDomainsCommands(program2) {
|
|
|
103889
104866
|
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
104867
|
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
104868
|
emailDomains.command("verify").description("Verify an email domain DNS configuration").requiredOption("--id <id>", "Email domain ID").action(verifyDomainAction);
|
|
104869
|
+
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);
|
|
104870
|
+
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);
|
|
104871
|
+
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);
|
|
104872
|
+
}
|
|
104873
|
+
function parseAuthorizationIds(options) {
|
|
104874
|
+
const domainId = parsePositiveSafeInteger(options.id);
|
|
104875
|
+
const projectId = parsePositiveSafeInteger(options.projectId);
|
|
104876
|
+
if (domainId === undefined || projectId === undefined) {
|
|
104877
|
+
warning2("Domain ID and project ID must both be positive integers");
|
|
104878
|
+
return;
|
|
104879
|
+
}
|
|
104880
|
+
return { domainId, projectId };
|
|
104881
|
+
}
|
|
104882
|
+
function parsePositiveSafeInteger(value) {
|
|
104883
|
+
if (!/^[1-9]\d*$/.test(value))
|
|
104884
|
+
return;
|
|
104885
|
+
const parsed = Number(value);
|
|
104886
|
+
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
104887
|
+
}
|
|
104888
|
+
async function listAuthorizedProjectsAction(options) {
|
|
104889
|
+
await requireAuth();
|
|
104890
|
+
await setupClient();
|
|
104891
|
+
const domainId = parsePositiveSafeInteger(options.id);
|
|
104892
|
+
if (domainId === undefined) {
|
|
104893
|
+
warning2("Domain ID must be a positive integer");
|
|
104894
|
+
return;
|
|
104895
|
+
}
|
|
104896
|
+
const projects = await withSpinner("Fetching authorized projects...", async () => {
|
|
104897
|
+
const { data, error: error3 } = await listEmailDomainProjects({ client, path: { id: domainId } });
|
|
104898
|
+
if (error3)
|
|
104899
|
+
throw new Error(getErrorMessage(error3));
|
|
104900
|
+
return data ?? [];
|
|
104901
|
+
});
|
|
104902
|
+
if (options.json) {
|
|
104903
|
+
json(projects);
|
|
104904
|
+
return;
|
|
104905
|
+
}
|
|
104906
|
+
newline();
|
|
104907
|
+
header(`${icons.key} Authorized Projects (${projects.length})`);
|
|
104908
|
+
if (projects.length === 0) {
|
|
104909
|
+
info2("No projects can send through this email domain yet");
|
|
104910
|
+
info2(`Run: temps email-domains authorize-project --id ${domainId} --project-id <id>`);
|
|
104911
|
+
newline();
|
|
104912
|
+
return;
|
|
104913
|
+
}
|
|
104914
|
+
const columns = [
|
|
104915
|
+
{ header: "ID", key: "id", width: 6 },
|
|
104916
|
+
{ header: "Project", key: "name", color: (value) => colors.bold(value) },
|
|
104917
|
+
{ header: "Slug", key: "slug", color: (value) => colors.muted(value) }
|
|
104918
|
+
];
|
|
104919
|
+
printTable(projects, columns, { style: "minimal" });
|
|
104920
|
+
newline();
|
|
104921
|
+
}
|
|
104922
|
+
async function authorizeProjectAction(options) {
|
|
104923
|
+
await requireAuth();
|
|
104924
|
+
await setupClient();
|
|
104925
|
+
const ids = parseAuthorizationIds(options);
|
|
104926
|
+
if (!ids)
|
|
104927
|
+
return;
|
|
104928
|
+
await withSpinner("Authorizing project...", async () => {
|
|
104929
|
+
const { error: error3 } = await authorizeEmailDomainProject({
|
|
104930
|
+
client,
|
|
104931
|
+
path: { id: ids.domainId, project_id: ids.projectId }
|
|
104932
|
+
});
|
|
104933
|
+
if (error3)
|
|
104934
|
+
throw new Error(getErrorMessage(error3));
|
|
104935
|
+
});
|
|
104936
|
+
success2(`Project ${ids.projectId} can now send through email domain ${ids.domainId}`);
|
|
104937
|
+
}
|
|
104938
|
+
async function revokeProjectAction(options) {
|
|
104939
|
+
await requireAuth();
|
|
104940
|
+
await setupClient();
|
|
104941
|
+
const ids = parseAuthorizationIds(options);
|
|
104942
|
+
if (!ids)
|
|
104943
|
+
return;
|
|
104944
|
+
if (!options.force && !options.yes) {
|
|
104945
|
+
const confirmed = await promptConfirm({
|
|
104946
|
+
message: `Revoke project ${ids.projectId} from email domain ${ids.domainId}?`,
|
|
104947
|
+
default: false
|
|
104948
|
+
});
|
|
104949
|
+
if (!confirmed) {
|
|
104950
|
+
info2("Cancelled");
|
|
104951
|
+
return;
|
|
104952
|
+
}
|
|
104953
|
+
}
|
|
104954
|
+
await withSpinner("Revoking project authorization...", async () => {
|
|
104955
|
+
const { error: error3 } = await revokeEmailDomainProject({
|
|
104956
|
+
client,
|
|
104957
|
+
path: { id: ids.domainId, project_id: ids.projectId }
|
|
104958
|
+
});
|
|
104959
|
+
if (error3)
|
|
104960
|
+
throw new Error(getErrorMessage(error3));
|
|
104961
|
+
});
|
|
104962
|
+
success2(`Project ${ids.projectId} can no longer send through email domain ${ids.domainId}`);
|
|
103892
104963
|
}
|
|
103893
104964
|
async function listDomainsAction(options) {
|
|
103894
104965
|
await requireAuth();
|
|
@@ -105220,9 +106291,9 @@ function registerLoadBalancerCommands(program2) {
|
|
|
105220
106291
|
const lb = program2.command("load-balancer").alias("lb").description("Manage load balancer routes");
|
|
105221
106292
|
lb.command("list").alias("ls").description("List load balancer routes").option("--json", "Output in JSON format").action(listRoutesAction);
|
|
105222
106293
|
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(
|
|
106294
|
+
lb.command("show").description("Show route details").requiredOption("-d, --domain <domain>", "Domain of the route").option("--json", "Output in JSON format").action(showRoute2);
|
|
105224
106295
|
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(
|
|
106296
|
+
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
106297
|
}
|
|
105227
106298
|
async function listRoutesAction(options) {
|
|
105228
106299
|
await requireAuth();
|
|
@@ -105306,7 +106377,7 @@ async function createRouteAction(options) {
|
|
|
105306
106377
|
success2(`Route created for ${domain2}`);
|
|
105307
106378
|
info2(`Target: ${target}`);
|
|
105308
106379
|
}
|
|
105309
|
-
async function
|
|
106380
|
+
async function showRoute2(options) {
|
|
105310
106381
|
await requireAuth();
|
|
105311
106382
|
await setupClient();
|
|
105312
106383
|
const domain2 = options.domain;
|
|
@@ -105380,7 +106451,7 @@ async function updateRouteAction(options) {
|
|
|
105380
106451
|
success2(`Route updated for ${domain2}`);
|
|
105381
106452
|
info2(`New target: ${target}`);
|
|
105382
106453
|
}
|
|
105383
|
-
async function
|
|
106454
|
+
async function removeRoute2(options) {
|
|
105384
106455
|
await requireAuth();
|
|
105385
106456
|
await setupClient();
|
|
105386
106457
|
const domain2 = options.domain;
|
|
@@ -107765,6 +108836,119 @@ function formatPresetPort(port) {
|
|
|
107765
108836
|
|
|
107766
108837
|
// src/commands/platform/index.ts
|
|
107767
108838
|
init_sdk_gen();
|
|
108839
|
+
|
|
108840
|
+
// src/commands/platform/alert-rules.ts
|
|
108841
|
+
init_sdk_gen();
|
|
108842
|
+
init_spinner();
|
|
108843
|
+
init_output();
|
|
108844
|
+
var CONTROL_PLANE_NODE_ID = 0;
|
|
108845
|
+
function parseNodeId(raw) {
|
|
108846
|
+
if (raw === undefined)
|
|
108847
|
+
return CONTROL_PLANE_NODE_ID;
|
|
108848
|
+
const id = Number(raw);
|
|
108849
|
+
if (!Number.isInteger(id) || id < 0) {
|
|
108850
|
+
throw new Error(`Invalid --node "${raw}": expected a non-negative integer node ID`);
|
|
108851
|
+
}
|
|
108852
|
+
return id;
|
|
108853
|
+
}
|
|
108854
|
+
async function platformAlertRulesList(options) {
|
|
108855
|
+
await requireAuth();
|
|
108856
|
+
await setupClient();
|
|
108857
|
+
const nodeId = parseNodeId(options.node);
|
|
108858
|
+
const rules = await withSpinner("Fetching node alert rules...", async () => {
|
|
108859
|
+
const { data, error: error3 } = await nodeMetricsGetAlertRules({ client, path: { id: nodeId } });
|
|
108860
|
+
if (error3)
|
|
108861
|
+
throw new Error(getErrorMessage(error3));
|
|
108862
|
+
return data ?? [];
|
|
108863
|
+
});
|
|
108864
|
+
if (options.json) {
|
|
108865
|
+
json({ node_id: nodeId, rules });
|
|
108866
|
+
return;
|
|
108867
|
+
}
|
|
108868
|
+
header(`Platform Alert Rules — node ${nodeId}`);
|
|
108869
|
+
newline();
|
|
108870
|
+
if (rules.length === 0) {
|
|
108871
|
+
console.log(colors.muted(" No alert rules on this node. The control-plane defaults are seeded on server startup."));
|
|
108872
|
+
newline();
|
|
108873
|
+
return;
|
|
108874
|
+
}
|
|
108875
|
+
for (const rule of rules) {
|
|
108876
|
+
const state = rule.enabled ? colors.success("enabled") : colors.muted("disabled");
|
|
108877
|
+
console.log(` ${colors.bold(String(rule.id))} ${rule.name} ${state}`);
|
|
108878
|
+
console.log(colors.muted(` ${rule.metric_name} ${rule.comparator} ${rule.threshold} ` + `for ${rule.for_duration_secs}s → ${rule.severity}`));
|
|
108879
|
+
if (rule.silenced_until) {
|
|
108880
|
+
console.log(colors.muted(` silenced until ${rule.silenced_until}`));
|
|
108881
|
+
}
|
|
108882
|
+
}
|
|
108883
|
+
newline();
|
|
108884
|
+
console.log(colors.muted(` ${rules.length} rule(s). Retune one with: ` + `temps platform alert-rules set <rule-id> --threshold <n>`));
|
|
108885
|
+
newline();
|
|
108886
|
+
}
|
|
108887
|
+
async function platformAlertRulesSet(ruleId, options) {
|
|
108888
|
+
await requireAuth();
|
|
108889
|
+
await setupClient();
|
|
108890
|
+
const nodeId = parseNodeId(options.node);
|
|
108891
|
+
const id = Number(ruleId);
|
|
108892
|
+
if (!Number.isInteger(id) || id <= 0) {
|
|
108893
|
+
throw new Error(`Invalid rule ID "${ruleId}": expected a positive integer`);
|
|
108894
|
+
}
|
|
108895
|
+
if (options.enable && options.disable) {
|
|
108896
|
+
throw new Error("--enable and --disable are mutually exclusive");
|
|
108897
|
+
}
|
|
108898
|
+
const body = {};
|
|
108899
|
+
if (options.threshold !== undefined) {
|
|
108900
|
+
const threshold = Number(options.threshold);
|
|
108901
|
+
if (!Number.isFinite(threshold)) {
|
|
108902
|
+
throw new Error(`Invalid --threshold "${options.threshold}": expected a number`);
|
|
108903
|
+
}
|
|
108904
|
+
body.threshold = threshold;
|
|
108905
|
+
}
|
|
108906
|
+
if (options.comparator !== undefined)
|
|
108907
|
+
body.comparator = options.comparator;
|
|
108908
|
+
if (options.severity !== undefined)
|
|
108909
|
+
body.severity = options.severity;
|
|
108910
|
+
if (options.forDuration !== undefined) {
|
|
108911
|
+
const forDuration = Number(options.forDuration);
|
|
108912
|
+
if (!Number.isInteger(forDuration) || forDuration < 0) {
|
|
108913
|
+
throw new Error(`Invalid --for-duration "${options.forDuration}": expected a non-negative integer (seconds)`);
|
|
108914
|
+
}
|
|
108915
|
+
body.for_duration_secs = forDuration;
|
|
108916
|
+
}
|
|
108917
|
+
if (options.enable)
|
|
108918
|
+
body.enabled = true;
|
|
108919
|
+
if (options.disable)
|
|
108920
|
+
body.enabled = false;
|
|
108921
|
+
if (Object.keys(body).length === 0) {
|
|
108922
|
+
throw new Error("Nothing to update. Pass at least one of --threshold, --comparator, --severity, " + "--for-duration, --enable, --disable");
|
|
108923
|
+
}
|
|
108924
|
+
const updated = await withSpinner(`Updating alert rule ${id}...`, async () => {
|
|
108925
|
+
const { data, error: error3 } = await nodeMetricsUpdateAlertRule({
|
|
108926
|
+
client,
|
|
108927
|
+
path: { id: nodeId, rule_id: id },
|
|
108928
|
+
body
|
|
108929
|
+
});
|
|
108930
|
+
if (error3)
|
|
108931
|
+
throw new Error(getErrorMessage(error3));
|
|
108932
|
+
if (!data)
|
|
108933
|
+
throw new Error(`Alert rule ${id} not found on node ${nodeId}`);
|
|
108934
|
+
return data;
|
|
108935
|
+
});
|
|
108936
|
+
if (options.json) {
|
|
108937
|
+
json(updated);
|
|
108938
|
+
return;
|
|
108939
|
+
}
|
|
108940
|
+
success2(`Alert rule ${updated.id} updated`);
|
|
108941
|
+
newline();
|
|
108942
|
+
keyValue("Name", updated.name);
|
|
108943
|
+
keyValue("Metric", updated.metric_name);
|
|
108944
|
+
keyValue("Condition", `${updated.comparator} ${updated.threshold}`);
|
|
108945
|
+
keyValue("For", `${updated.for_duration_secs}s`);
|
|
108946
|
+
keyValue("Severity", updated.severity);
|
|
108947
|
+
keyValue("Enabled", updated.enabled);
|
|
108948
|
+
newline();
|
|
108949
|
+
}
|
|
108950
|
+
|
|
108951
|
+
// src/commands/platform/index.ts
|
|
107768
108952
|
init_spinner();
|
|
107769
108953
|
init_prompts();
|
|
107770
108954
|
init_output();
|
|
@@ -107779,6 +108963,17 @@ function registerPlatformCommands(program2) {
|
|
|
107779
108963
|
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
108964
|
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
108965
|
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);
|
|
108966
|
+
const alertRules = platform3.command("alert-rules").description("Inspect and retune the control-plane's own monitoring alert rules");
|
|
108967
|
+
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);
|
|
108968
|
+
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);
|
|
108969
|
+
alertRules.addHelpText("after", `
|
|
108970
|
+
These rules are seeded automatically on server startup and are update-only:
|
|
108971
|
+
a deleted rule reappears on the next restart, so use --disable to stop one.
|
|
108972
|
+
|
|
108973
|
+
Examples:
|
|
108974
|
+
$ temps platform alert-rules list
|
|
108975
|
+
$ temps platform alert-rules set 39 --threshold 80
|
|
108976
|
+
$ temps platform alert-rules set 39 --disable`);
|
|
107782
108977
|
}
|
|
107783
108978
|
async function platformInfoAction(options) {
|
|
107784
108979
|
await requireAuth();
|
|
@@ -109491,6 +110686,9 @@ async function apiPath(path7, options) {
|
|
|
109491
110686
|
"last_seen"
|
|
109492
110687
|
], [{ dimension: "path", operator: "eq", values: [path7] }], options.sortBy ?? "requests", options.order, `IPs calling ${path7}:`);
|
|
109493
110688
|
}
|
|
110689
|
+
function resolveApiQueryFilters(options) {
|
|
110690
|
+
return (options.filter ?? []).map(parseFilter);
|
|
110691
|
+
}
|
|
109494
110692
|
async function apiQuery(options) {
|
|
109495
110693
|
const dimensions = parseCsv(options.groupBy ?? "", TRAFFIC_DIMENSIONS, "dimension", true);
|
|
109496
110694
|
const metrics = parseCsv(options.metrics, TRAFFIC_METRICS, "metric");
|
|
@@ -109498,7 +110696,7 @@ async function apiQuery(options) {
|
|
|
109498
110696
|
const sortBy2 = options.sortBy ? [...TRAFFIC_DIMENSIONS, ...TRAFFIC_METRICS].includes(options.sortBy) ? options.sortBy : (() => {
|
|
109499
110697
|
throw new Error(`Unknown sort field "${options.sortBy}"`);
|
|
109500
110698
|
})() : defaultSort;
|
|
109501
|
-
await runTrafficAggregation(options, dimensions, metrics, (options
|
|
110699
|
+
await runTrafficAggregation(options, dimensions, metrics, resolveApiQueryFilters(options), sortBy2, options.order, "API traffic query:");
|
|
109502
110700
|
}
|
|
109503
110701
|
async function apiSummary(options) {
|
|
109504
110702
|
await requireAuth();
|
|
@@ -110864,7 +112062,7 @@ async function resolveProjectId7(projectSlug) {
|
|
|
110864
112062
|
throw new Error(`Project '${projectSlug}' not found`);
|
|
110865
112063
|
}
|
|
110866
112064
|
function registerMcpServersCommands(program2) {
|
|
110867
|
-
const mcp = program2.command("mcp-servers").
|
|
112065
|
+
const mcp = program2.command("mcp-servers").description("Manage MCP server definitions (global or project-scoped)");
|
|
110868
112066
|
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
112067
|
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
112068
|
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 +112213,852 @@ async function deleteAction3(slug, options) {
|
|
|
111015
112213
|
success2(`MCP server "${slug}" deleted`);
|
|
111016
112214
|
}
|
|
111017
112215
|
|
|
112216
|
+
// src/commands/mcp/index.ts
|
|
112217
|
+
init_sdk_gen();
|
|
112218
|
+
init_output();
|
|
112219
|
+
init_prompts();
|
|
112220
|
+
init_spinner();
|
|
112221
|
+
|
|
112222
|
+
// src/commands/mcp/clients/claude-code.ts
|
|
112223
|
+
import * as fs6 from "node:fs";
|
|
112224
|
+
import * as os5 from "node:os";
|
|
112225
|
+
import * as path8 from "node:path";
|
|
112226
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
112227
|
+
|
|
112228
|
+
// src/commands/mcp/clients/base.ts
|
|
112229
|
+
var jsonc = __toESM(require_main(), 1);
|
|
112230
|
+
import * as fs5 from "node:fs";
|
|
112231
|
+
import * as path7 from "node:path";
|
|
112232
|
+
var MCP_SERVER_NAME = "temps";
|
|
112233
|
+
function redactSecrets(text) {
|
|
112234
|
+
return text.replace(/Bearer\s+\S+/gi, "Bearer ***").replace(/Authorization:\s*\S+(\s+\S+)?/gi, "Authorization: ***");
|
|
112235
|
+
}
|
|
112236
|
+
|
|
112237
|
+
class JsonConfigMcpClientAdapter {
|
|
112238
|
+
async isClientSupported() {
|
|
112239
|
+
return true;
|
|
112240
|
+
}
|
|
112241
|
+
async readServerConfig() {
|
|
112242
|
+
const configPath = this.getConfigPath();
|
|
112243
|
+
if (!fs5.existsSync(configPath))
|
|
112244
|
+
return null;
|
|
112245
|
+
try {
|
|
112246
|
+
const content = await fs5.promises.readFile(configPath, "utf8");
|
|
112247
|
+
const config2 = jsonc.parse(content);
|
|
112248
|
+
const prop = this.getServerPropertyName();
|
|
112249
|
+
return config2?.[prop]?.[MCP_SERVER_NAME] ?? null;
|
|
112250
|
+
} catch {
|
|
112251
|
+
return null;
|
|
112252
|
+
}
|
|
112253
|
+
}
|
|
112254
|
+
async isServerInstalled() {
|
|
112255
|
+
return await this.readServerConfig() !== null;
|
|
112256
|
+
}
|
|
112257
|
+
async getServerUrl() {
|
|
112258
|
+
const serverConfig = await this.readServerConfig();
|
|
112259
|
+
return serverConfig ? this.extractUrl(serverConfig) : null;
|
|
112260
|
+
}
|
|
112261
|
+
async addServer(entry) {
|
|
112262
|
+
const configPath = this.getConfigPath();
|
|
112263
|
+
try {
|
|
112264
|
+
await fs5.promises.mkdir(path7.dirname(configPath), { recursive: true });
|
|
112265
|
+
let content = "";
|
|
112266
|
+
if (fs5.existsSync(configPath)) {
|
|
112267
|
+
await fs5.promises.chmod(configPath, 384);
|
|
112268
|
+
content = await fs5.promises.readFile(configPath, "utf8");
|
|
112269
|
+
}
|
|
112270
|
+
const prop = this.getServerPropertyName();
|
|
112271
|
+
const existing = jsonc.parse(content || "{}") ?? {};
|
|
112272
|
+
const newEntry = this.buildServerConfig(entry);
|
|
112273
|
+
const currentEntry = existing?.[prop]?.[MCP_SERVER_NAME];
|
|
112274
|
+
if (currentEntry !== undefined && JSON.stringify(currentEntry) === JSON.stringify(newEntry)) {
|
|
112275
|
+
return { success: true, alreadyInstalled: true };
|
|
112276
|
+
}
|
|
112277
|
+
const edits = jsonc.modify(content, [prop, MCP_SERVER_NAME], newEntry, {
|
|
112278
|
+
formattingOptions: { tabSize: 2, insertSpaces: true }
|
|
112279
|
+
});
|
|
112280
|
+
const updated = jsonc.applyEdits(content, edits);
|
|
112281
|
+
await fs5.promises.writeFile(configPath, updated, { encoding: "utf8", mode: 384 });
|
|
112282
|
+
await fs5.promises.chmod(configPath, 384);
|
|
112283
|
+
return { success: true };
|
|
112284
|
+
} catch (error3) {
|
|
112285
|
+
return { success: false, reason: redactSecrets(error3 instanceof Error ? error3.message : String(error3)) };
|
|
112286
|
+
}
|
|
112287
|
+
}
|
|
112288
|
+
async removeServer() {
|
|
112289
|
+
const configPath = this.getConfigPath();
|
|
112290
|
+
try {
|
|
112291
|
+
if (!fs5.existsSync(configPath))
|
|
112292
|
+
return { success: true, alreadyInstalled: true };
|
|
112293
|
+
await fs5.promises.chmod(configPath, 384);
|
|
112294
|
+
const content = await fs5.promises.readFile(configPath, "utf8");
|
|
112295
|
+
const prop = this.getServerPropertyName();
|
|
112296
|
+
const existing = jsonc.parse(content);
|
|
112297
|
+
if (!existing?.[prop]?.[MCP_SERVER_NAME]) {
|
|
112298
|
+
return { success: true, alreadyInstalled: true };
|
|
112299
|
+
}
|
|
112300
|
+
const edits = jsonc.modify(content, [prop, MCP_SERVER_NAME], undefined, {
|
|
112301
|
+
formattingOptions: { tabSize: 2, insertSpaces: true }
|
|
112302
|
+
});
|
|
112303
|
+
const updated = jsonc.applyEdits(content, edits);
|
|
112304
|
+
await fs5.promises.writeFile(configPath, updated, { encoding: "utf8", mode: 384 });
|
|
112305
|
+
await fs5.promises.chmod(configPath, 384);
|
|
112306
|
+
return { success: true };
|
|
112307
|
+
} catch (error3) {
|
|
112308
|
+
return { success: false, reason: redactSecrets(error3 instanceof Error ? error3.message : String(error3)) };
|
|
112309
|
+
}
|
|
112310
|
+
}
|
|
112311
|
+
async describeTarget() {
|
|
112312
|
+
return `${this.getConfigPath()} (${this.getServerPropertyName()}.${MCP_SERVER_NAME})`;
|
|
112313
|
+
}
|
|
112314
|
+
}
|
|
112315
|
+
|
|
112316
|
+
// src/commands/mcp/clients/exec-utils.ts
|
|
112317
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
112318
|
+
function resolveOnPath(bin) {
|
|
112319
|
+
try {
|
|
112320
|
+
const finder = process.platform === "win32" ? "where" : "which";
|
|
112321
|
+
const out = execFileSync2(finder, [bin], { stdio: ["ignore", "pipe", "ignore"] }).toString().trim();
|
|
112322
|
+
return out.split(/\r?\n/)[0] || null;
|
|
112323
|
+
} catch {
|
|
112324
|
+
return null;
|
|
112325
|
+
}
|
|
112326
|
+
}
|
|
112327
|
+
function execErrorMessage(error3) {
|
|
112328
|
+
if (error3 && typeof error3 === "object" && "stderr" in error3) {
|
|
112329
|
+
const stderr = error3.stderr;
|
|
112330
|
+
if (stderr)
|
|
112331
|
+
return Buffer.isBuffer(stderr) ? stderr.toString() : String(stderr);
|
|
112332
|
+
}
|
|
112333
|
+
return error3 instanceof Error ? error3.message : String(error3);
|
|
112334
|
+
}
|
|
112335
|
+
|
|
112336
|
+
// src/commands/mcp/clients/claude-code.ts
|
|
112337
|
+
function parseClaudeCodeMcpGetOutput(output) {
|
|
112338
|
+
const match = output.match(/^\s*URL:\s*(\S+)/m);
|
|
112339
|
+
return match?.[1] ?? null;
|
|
112340
|
+
}
|
|
112341
|
+
|
|
112342
|
+
class ClaudeCodeAdapter {
|
|
112343
|
+
id = "claude-code";
|
|
112344
|
+
label = "Claude Code";
|
|
112345
|
+
binary;
|
|
112346
|
+
findBinary() {
|
|
112347
|
+
if (this.binary !== undefined)
|
|
112348
|
+
return this.binary;
|
|
112349
|
+
const candidates = [
|
|
112350
|
+
path8.join(os5.homedir(), ".claude", "local", "claude"),
|
|
112351
|
+
"/usr/local/bin/claude",
|
|
112352
|
+
"/opt/homebrew/bin/claude"
|
|
112353
|
+
];
|
|
112354
|
+
for (const candidate of candidates) {
|
|
112355
|
+
if (fs6.existsSync(candidate)) {
|
|
112356
|
+
this.binary = candidate;
|
|
112357
|
+
return candidate;
|
|
112358
|
+
}
|
|
112359
|
+
}
|
|
112360
|
+
this.binary = resolveOnPath("claude");
|
|
112361
|
+
return this.binary;
|
|
112362
|
+
}
|
|
112363
|
+
async isClientSupported() {
|
|
112364
|
+
return this.findBinary() !== null;
|
|
112365
|
+
}
|
|
112366
|
+
getServerEntry(binary) {
|
|
112367
|
+
try {
|
|
112368
|
+
return execFileSync3(binary, ["mcp", "get", MCP_SERVER_NAME], { stdio: ["ignore", "pipe", "pipe"] }).toString();
|
|
112369
|
+
} catch {
|
|
112370
|
+
return null;
|
|
112371
|
+
}
|
|
112372
|
+
}
|
|
112373
|
+
async isServerInstalled() {
|
|
112374
|
+
const binary = this.findBinary();
|
|
112375
|
+
if (!binary)
|
|
112376
|
+
return false;
|
|
112377
|
+
return this.getServerEntry(binary) !== null;
|
|
112378
|
+
}
|
|
112379
|
+
async getServerUrl() {
|
|
112380
|
+
const binary = this.findBinary();
|
|
112381
|
+
if (!binary)
|
|
112382
|
+
return null;
|
|
112383
|
+
const entry = this.getServerEntry(binary);
|
|
112384
|
+
if (!entry)
|
|
112385
|
+
return null;
|
|
112386
|
+
return parseClaudeCodeMcpGetOutput(entry);
|
|
112387
|
+
}
|
|
112388
|
+
async addServer(entry) {
|
|
112389
|
+
const binary = this.findBinary();
|
|
112390
|
+
if (!binary)
|
|
112391
|
+
return { success: false, reason: "The claude CLI was not found on PATH." };
|
|
112392
|
+
try {
|
|
112393
|
+
execFileSync3(binary, [
|
|
112394
|
+
"mcp",
|
|
112395
|
+
"add",
|
|
112396
|
+
"--transport",
|
|
112397
|
+
"http",
|
|
112398
|
+
"--scope",
|
|
112399
|
+
"user",
|
|
112400
|
+
MCP_SERVER_NAME,
|
|
112401
|
+
entry.url,
|
|
112402
|
+
"--header",
|
|
112403
|
+
`Authorization: Bearer ${entry.apiKey}`
|
|
112404
|
+
], { stdio: ["ignore", "pipe", "pipe"] });
|
|
112405
|
+
return { success: true };
|
|
112406
|
+
} catch (error3) {
|
|
112407
|
+
const reason = redactSecrets(execErrorMessage(error3));
|
|
112408
|
+
if (/already exists/i.test(reason))
|
|
112409
|
+
return { success: true, alreadyInstalled: true };
|
|
112410
|
+
return { success: false, reason };
|
|
112411
|
+
}
|
|
112412
|
+
}
|
|
112413
|
+
async removeServer() {
|
|
112414
|
+
const binary = this.findBinary();
|
|
112415
|
+
if (!binary)
|
|
112416
|
+
return { success: false, reason: "The claude CLI was not found on PATH." };
|
|
112417
|
+
try {
|
|
112418
|
+
execFileSync3(binary, ["mcp", "remove", "--scope", "user", MCP_SERVER_NAME], {
|
|
112419
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
112420
|
+
});
|
|
112421
|
+
return { success: true };
|
|
112422
|
+
} catch (error3) {
|
|
112423
|
+
const reason = redactSecrets(execErrorMessage(error3));
|
|
112424
|
+
if (/no such|not found/i.test(reason))
|
|
112425
|
+
return { success: true, alreadyInstalled: true };
|
|
112426
|
+
return { success: false, reason };
|
|
112427
|
+
}
|
|
112428
|
+
}
|
|
112429
|
+
async describeTarget() {
|
|
112430
|
+
return `claude mcp add --transport http --scope user ${MCP_SERVER_NAME} <url>`;
|
|
112431
|
+
}
|
|
112432
|
+
}
|
|
112433
|
+
|
|
112434
|
+
// src/commands/mcp/clients/claude-desktop.ts
|
|
112435
|
+
import * as os6 from "node:os";
|
|
112436
|
+
import * as path9 from "node:path";
|
|
112437
|
+
class ClaudeDesktopAdapter extends JsonConfigMcpClientAdapter {
|
|
112438
|
+
id = "claude-desktop";
|
|
112439
|
+
label = "Claude Desktop";
|
|
112440
|
+
getConfigPath() {
|
|
112441
|
+
const home = os6.homedir();
|
|
112442
|
+
if (process.platform === "darwin") {
|
|
112443
|
+
return path9.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
112444
|
+
}
|
|
112445
|
+
if (process.platform === "win32") {
|
|
112446
|
+
return path9.join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json");
|
|
112447
|
+
}
|
|
112448
|
+
throw new Error("Claude Desktop is only available on macOS and Windows");
|
|
112449
|
+
}
|
|
112450
|
+
getServerPropertyName() {
|
|
112451
|
+
return "mcpServers";
|
|
112452
|
+
}
|
|
112453
|
+
buildServerConfig(entry) {
|
|
112454
|
+
return {
|
|
112455
|
+
command: "npx",
|
|
112456
|
+
args: ["-y", "mcp-remote@latest", entry.url, "--header", "Authorization:${AUTH_HEADER}"],
|
|
112457
|
+
env: { AUTH_HEADER: `Bearer ${entry.apiKey}` }
|
|
112458
|
+
};
|
|
112459
|
+
}
|
|
112460
|
+
extractUrl(serverConfig) {
|
|
112461
|
+
const args = serverConfig.args;
|
|
112462
|
+
if (!Array.isArray(args))
|
|
112463
|
+
return null;
|
|
112464
|
+
const url = args.find((arg) => typeof arg === "string" && /^https?:\/\//.test(arg));
|
|
112465
|
+
return typeof url === "string" ? url : null;
|
|
112466
|
+
}
|
|
112467
|
+
async isClientSupported() {
|
|
112468
|
+
return process.platform === "darwin" || process.platform === "win32";
|
|
112469
|
+
}
|
|
112470
|
+
}
|
|
112471
|
+
|
|
112472
|
+
// src/commands/mcp/clients/codex.ts
|
|
112473
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
112474
|
+
var TOKEN_ENV_VAR = "TEMPS_MCP_AUTH_HEADER";
|
|
112475
|
+
function parseCodexMcpGetOutput(output) {
|
|
112476
|
+
const match = output.match(/^\s*url:\s*(\S+)/m);
|
|
112477
|
+
return match?.[1] ?? null;
|
|
112478
|
+
}
|
|
112479
|
+
|
|
112480
|
+
class CodexAdapter {
|
|
112481
|
+
id = "codex";
|
|
112482
|
+
label = "Codex";
|
|
112483
|
+
binary;
|
|
112484
|
+
findBinary() {
|
|
112485
|
+
if (this.binary !== undefined)
|
|
112486
|
+
return this.binary;
|
|
112487
|
+
this.binary = resolveOnPath("codex");
|
|
112488
|
+
return this.binary;
|
|
112489
|
+
}
|
|
112490
|
+
async isClientSupported() {
|
|
112491
|
+
return this.findBinary() !== null;
|
|
112492
|
+
}
|
|
112493
|
+
getServerEntry(binary) {
|
|
112494
|
+
try {
|
|
112495
|
+
return execFileSync4(binary, ["mcp", "get", MCP_SERVER_NAME], { stdio: ["ignore", "pipe", "pipe"] }).toString();
|
|
112496
|
+
} catch {
|
|
112497
|
+
return null;
|
|
112498
|
+
}
|
|
112499
|
+
}
|
|
112500
|
+
async isServerInstalled() {
|
|
112501
|
+
const binary = this.findBinary();
|
|
112502
|
+
if (!binary)
|
|
112503
|
+
return false;
|
|
112504
|
+
return this.getServerEntry(binary) !== null;
|
|
112505
|
+
}
|
|
112506
|
+
async getServerUrl() {
|
|
112507
|
+
const binary = this.findBinary();
|
|
112508
|
+
if (!binary)
|
|
112509
|
+
return null;
|
|
112510
|
+
const entry = this.getServerEntry(binary);
|
|
112511
|
+
if (!entry)
|
|
112512
|
+
return null;
|
|
112513
|
+
return parseCodexMcpGetOutput(entry);
|
|
112514
|
+
}
|
|
112515
|
+
async addServer(entry) {
|
|
112516
|
+
const binary = this.findBinary();
|
|
112517
|
+
if (!binary)
|
|
112518
|
+
return { success: false, reason: "The codex CLI was not found on PATH." };
|
|
112519
|
+
try {
|
|
112520
|
+
execFileSync4(binary, ["mcp", "add", MCP_SERVER_NAME, "--url", entry.url, "--bearer-token-env-var", TOKEN_ENV_VAR], {
|
|
112521
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
112522
|
+
env: { ...process.env, [TOKEN_ENV_VAR]: `Bearer ${entry.apiKey}` }
|
|
112523
|
+
});
|
|
112524
|
+
return { success: true };
|
|
112525
|
+
} catch (error3) {
|
|
112526
|
+
const reason = redactSecrets(execErrorMessage(error3));
|
|
112527
|
+
if (/already (installed|exists|added|registered)/i.test(reason)) {
|
|
112528
|
+
return { success: true, alreadyInstalled: true };
|
|
112529
|
+
}
|
|
112530
|
+
return { success: false, reason };
|
|
112531
|
+
}
|
|
112532
|
+
}
|
|
112533
|
+
async removeServer() {
|
|
112534
|
+
const binary = this.findBinary();
|
|
112535
|
+
if (!binary)
|
|
112536
|
+
return { success: false, reason: "The codex CLI was not found on PATH." };
|
|
112537
|
+
try {
|
|
112538
|
+
execFileSync4(binary, ["mcp", "remove", MCP_SERVER_NAME], { stdio: ["ignore", "pipe", "pipe"] });
|
|
112539
|
+
return { success: true };
|
|
112540
|
+
} catch (error3) {
|
|
112541
|
+
const reason = redactSecrets(execErrorMessage(error3));
|
|
112542
|
+
if (/not found|no such/i.test(reason))
|
|
112543
|
+
return { success: true, alreadyInstalled: true };
|
|
112544
|
+
return { success: false, reason };
|
|
112545
|
+
}
|
|
112546
|
+
}
|
|
112547
|
+
async describeTarget() {
|
|
112548
|
+
return `codex mcp add ${MCP_SERVER_NAME} --url <url> --bearer-token-env-var ${TOKEN_ENV_VAR}`;
|
|
112549
|
+
}
|
|
112550
|
+
}
|
|
112551
|
+
|
|
112552
|
+
// src/commands/mcp/clients/cursor.ts
|
|
112553
|
+
import * as os7 from "node:os";
|
|
112554
|
+
import * as path10 from "node:path";
|
|
112555
|
+
class CursorAdapter extends JsonConfigMcpClientAdapter {
|
|
112556
|
+
id = "cursor";
|
|
112557
|
+
label = "Cursor";
|
|
112558
|
+
getConfigPath() {
|
|
112559
|
+
return path10.join(os7.homedir(), ".cursor", "mcp.json");
|
|
112560
|
+
}
|
|
112561
|
+
getServerPropertyName() {
|
|
112562
|
+
return "mcpServers";
|
|
112563
|
+
}
|
|
112564
|
+
buildServerConfig(entry) {
|
|
112565
|
+
return { url: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
|
|
112566
|
+
}
|
|
112567
|
+
extractUrl(serverConfig) {
|
|
112568
|
+
return typeof serverConfig.url === "string" ? serverConfig.url : null;
|
|
112569
|
+
}
|
|
112570
|
+
async isClientSupported() {
|
|
112571
|
+
return process.platform === "darwin" || process.platform === "win32" || process.platform === "linux";
|
|
112572
|
+
}
|
|
112573
|
+
}
|
|
112574
|
+
|
|
112575
|
+
// src/commands/mcp/clients/vscode.ts
|
|
112576
|
+
import * as os8 from "node:os";
|
|
112577
|
+
import * as path11 from "node:path";
|
|
112578
|
+
class VsCodeAdapter extends JsonConfigMcpClientAdapter {
|
|
112579
|
+
id = "vscode";
|
|
112580
|
+
label = "VS Code";
|
|
112581
|
+
getConfigPath() {
|
|
112582
|
+
const home = os8.homedir();
|
|
112583
|
+
if (process.platform === "darwin") {
|
|
112584
|
+
return path11.join(home, "Library", "Application Support", "Code", "User", "mcp.json");
|
|
112585
|
+
}
|
|
112586
|
+
if (process.platform === "win32") {
|
|
112587
|
+
return path11.join(process.env.APPDATA || "", "Code", "User", "mcp.json");
|
|
112588
|
+
}
|
|
112589
|
+
return path11.join(home, ".config", "Code", "User", "mcp.json");
|
|
112590
|
+
}
|
|
112591
|
+
getServerPropertyName() {
|
|
112592
|
+
return "servers";
|
|
112593
|
+
}
|
|
112594
|
+
buildServerConfig(entry) {
|
|
112595
|
+
return { type: "http", url: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
|
|
112596
|
+
}
|
|
112597
|
+
extractUrl(serverConfig) {
|
|
112598
|
+
return typeof serverConfig.url === "string" ? serverConfig.url : null;
|
|
112599
|
+
}
|
|
112600
|
+
async isClientSupported() {
|
|
112601
|
+
return process.platform === "darwin" || process.platform === "win32" || process.platform === "linux";
|
|
112602
|
+
}
|
|
112603
|
+
}
|
|
112604
|
+
|
|
112605
|
+
// src/commands/mcp/clients/windsurf.ts
|
|
112606
|
+
import * as os9 from "node:os";
|
|
112607
|
+
import * as path12 from "node:path";
|
|
112608
|
+
class WindsurfAdapter extends JsonConfigMcpClientAdapter {
|
|
112609
|
+
id = "windsurf";
|
|
112610
|
+
label = "Windsurf";
|
|
112611
|
+
getConfigPath() {
|
|
112612
|
+
return path12.join(os9.homedir(), ".codeium", "windsurf", "mcp_config.json");
|
|
112613
|
+
}
|
|
112614
|
+
getServerPropertyName() {
|
|
112615
|
+
return "mcpServers";
|
|
112616
|
+
}
|
|
112617
|
+
buildServerConfig(entry) {
|
|
112618
|
+
return { serverUrl: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
|
|
112619
|
+
}
|
|
112620
|
+
extractUrl(serverConfig) {
|
|
112621
|
+
return typeof serverConfig.serverUrl === "string" ? serverConfig.serverUrl : null;
|
|
112622
|
+
}
|
|
112623
|
+
async isClientSupported() {
|
|
112624
|
+
return process.platform === "darwin" || process.platform === "win32" || process.platform === "linux";
|
|
112625
|
+
}
|
|
112626
|
+
}
|
|
112627
|
+
|
|
112628
|
+
// src/commands/mcp/clients/zed.ts
|
|
112629
|
+
import * as os10 from "node:os";
|
|
112630
|
+
import * as path13 from "node:path";
|
|
112631
|
+
class ZedAdapter extends JsonConfigMcpClientAdapter {
|
|
112632
|
+
id = "zed";
|
|
112633
|
+
label = "Zed";
|
|
112634
|
+
getConfigPath() {
|
|
112635
|
+
const home = os10.homedir();
|
|
112636
|
+
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
|
112637
|
+
if (process.platform === "linux" && xdgConfigHome) {
|
|
112638
|
+
return path13.join(xdgConfigHome, "zed", "settings.json");
|
|
112639
|
+
}
|
|
112640
|
+
return path13.join(home, ".config", "zed", "settings.json");
|
|
112641
|
+
}
|
|
112642
|
+
getServerPropertyName() {
|
|
112643
|
+
return "context_servers";
|
|
112644
|
+
}
|
|
112645
|
+
buildServerConfig(entry) {
|
|
112646
|
+
return { enabled: true, url: entry.url, headers: { Authorization: `Bearer ${entry.apiKey}` } };
|
|
112647
|
+
}
|
|
112648
|
+
extractUrl(serverConfig) {
|
|
112649
|
+
return typeof serverConfig.url === "string" ? serverConfig.url : null;
|
|
112650
|
+
}
|
|
112651
|
+
async isClientSupported() {
|
|
112652
|
+
return process.platform === "darwin" || process.platform === "linux";
|
|
112653
|
+
}
|
|
112654
|
+
}
|
|
112655
|
+
|
|
112656
|
+
// src/commands/mcp/clients/index.ts
|
|
112657
|
+
var CLIENT_ADAPTERS = [
|
|
112658
|
+
new ClaudeCodeAdapter,
|
|
112659
|
+
new ClaudeDesktopAdapter,
|
|
112660
|
+
new CodexAdapter,
|
|
112661
|
+
new CursorAdapter,
|
|
112662
|
+
new VsCodeAdapter,
|
|
112663
|
+
new WindsurfAdapter,
|
|
112664
|
+
new ZedAdapter
|
|
112665
|
+
];
|
|
112666
|
+
function getClientAdapter(id) {
|
|
112667
|
+
return CLIENT_ADAPTERS.find((c) => c.id === id);
|
|
112668
|
+
}
|
|
112669
|
+
function listClientIds() {
|
|
112670
|
+
return CLIENT_ADAPTERS.map((c) => c.id);
|
|
112671
|
+
}
|
|
112672
|
+
|
|
112673
|
+
// src/commands/mcp/groups.ts
|
|
112674
|
+
var TOOL_GROUPS = [
|
|
112675
|
+
{
|
|
112676
|
+
key: "deployments",
|
|
112677
|
+
label: "Deployments & Projects",
|
|
112678
|
+
categories: ["projects", "deployments", "environments", "presets"]
|
|
112679
|
+
},
|
|
112680
|
+
{
|
|
112681
|
+
key: "infrastructure",
|
|
112682
|
+
label: "Infrastructure",
|
|
112683
|
+
categories: ["services", "containers", "load-balancer", "scans"]
|
|
112684
|
+
},
|
|
112685
|
+
{
|
|
112686
|
+
key: "networking",
|
|
112687
|
+
label: "Networking & Domains",
|
|
112688
|
+
categories: ["domains", "custom-domains", "dns-providers", "ip-access"]
|
|
112689
|
+
},
|
|
112690
|
+
{
|
|
112691
|
+
key: "data",
|
|
112692
|
+
label: "Databases & Backups",
|
|
112693
|
+
categories: ["backups", "dsn"]
|
|
112694
|
+
},
|
|
112695
|
+
{
|
|
112696
|
+
key: "observability",
|
|
112697
|
+
label: "Observability",
|
|
112698
|
+
categories: ["monitors", "incidents", "errors", "proxy-logs", "funnels", "analytics"]
|
|
112699
|
+
},
|
|
112700
|
+
{
|
|
112701
|
+
key: "notifications",
|
|
112702
|
+
label: "Notifications",
|
|
112703
|
+
categories: ["notifications", "notification-prefs", "webhooks", "email-domains", "email-providers"]
|
|
112704
|
+
},
|
|
112705
|
+
{
|
|
112706
|
+
key: "platform",
|
|
112707
|
+
label: "Platform & Access",
|
|
112708
|
+
categories: ["users", "settings", "api-keys", "audit", "tokens", "platform"]
|
|
112709
|
+
}
|
|
112710
|
+
];
|
|
112711
|
+
function isValidGroupKey(key) {
|
|
112712
|
+
return TOOL_GROUPS.some((g) => g.key === key);
|
|
112713
|
+
}
|
|
112714
|
+
function buildMcpUrl(apiUrl, groups, write) {
|
|
112715
|
+
const base3 = apiUrl.replace(/\/+$/, "");
|
|
112716
|
+
const url = new URL(`${base3}/mcp`);
|
|
112717
|
+
if (groups.length > 0 && groups.length < TOOL_GROUPS.length) {
|
|
112718
|
+
url.searchParams.set("groups", groups.join(","));
|
|
112719
|
+
}
|
|
112720
|
+
if (write) {
|
|
112721
|
+
url.searchParams.set("write", "1");
|
|
112722
|
+
}
|
|
112723
|
+
return url.toString();
|
|
112724
|
+
}
|
|
112725
|
+
function parseMcpUrl(url) {
|
|
112726
|
+
let parsed;
|
|
112727
|
+
try {
|
|
112728
|
+
parsed = new URL(url);
|
|
112729
|
+
} catch {
|
|
112730
|
+
return null;
|
|
112731
|
+
}
|
|
112732
|
+
const groupsParam = parsed.searchParams.get("groups");
|
|
112733
|
+
const groups = groupsParam ? groupsParam.split(",").filter(isValidGroupKey) : TOOL_GROUPS.map((g) => g.key);
|
|
112734
|
+
return { groups, write: parsed.searchParams.get("write") === "1" };
|
|
112735
|
+
}
|
|
112736
|
+
|
|
112737
|
+
// src/commands/mcp/probe.ts
|
|
112738
|
+
async function probeMcpEndpoint(apiUrl, timeoutMs = 5000) {
|
|
112739
|
+
const base3 = apiUrl.replace(/\/+$/, "");
|
|
112740
|
+
const controller = new AbortController;
|
|
112741
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
112742
|
+
try {
|
|
112743
|
+
const res = await fetch(`${base3}/mcp/tools`, { signal: controller.signal });
|
|
112744
|
+
if (res.status === 404) {
|
|
112745
|
+
return { supported: false, reason: "no /mcp/tools route -- this instance predates MCP support or the feature flag is off" };
|
|
112746
|
+
}
|
|
112747
|
+
if (!res.ok) {
|
|
112748
|
+
return { supported: false, reason: `unexpected status ${res.status}` };
|
|
112749
|
+
}
|
|
112750
|
+
const body = await res.json();
|
|
112751
|
+
return { supported: true, groups: body.groups };
|
|
112752
|
+
} catch (error3) {
|
|
112753
|
+
const message = error3 instanceof Error ? error3.message : String(error3);
|
|
112754
|
+
return { supported: false, reason: message };
|
|
112755
|
+
} finally {
|
|
112756
|
+
clearTimeout(timer);
|
|
112757
|
+
}
|
|
112758
|
+
}
|
|
112759
|
+
|
|
112760
|
+
// src/commands/mcp/index.ts
|
|
112761
|
+
function originOf(url) {
|
|
112762
|
+
try {
|
|
112763
|
+
return new URL(url).origin;
|
|
112764
|
+
} catch {
|
|
112765
|
+
return null;
|
|
112766
|
+
}
|
|
112767
|
+
}
|
|
112768
|
+
async function findContextByUrl(url) {
|
|
112769
|
+
const target = originOf(url);
|
|
112770
|
+
if (!target)
|
|
112771
|
+
return null;
|
|
112772
|
+
const contexts = await listContexts();
|
|
112773
|
+
return contexts.find((c) => originOf(c.url) === target) ?? null;
|
|
112774
|
+
}
|
|
112775
|
+
async function ensureMcpAuth(opts = {}) {
|
|
112776
|
+
if (opts.urlOverride) {
|
|
112777
|
+
const matched = await findContextByUrl(opts.urlOverride);
|
|
112778
|
+
if (matched) {
|
|
112779
|
+
return matched.apiKey;
|
|
112780
|
+
}
|
|
112781
|
+
if (opts.yes) {
|
|
112782
|
+
console.error(`Not authenticated to ${opts.urlOverride} and no --api-key provided. ` + "Refusing to reuse a credential from a different Temps instance.");
|
|
112783
|
+
process.exit(1);
|
|
112784
|
+
}
|
|
112785
|
+
warning2(`No saved login is bound to ${opts.urlOverride}.`);
|
|
112786
|
+
info2("Your active session's key belongs to a different server and will not be reused for it.");
|
|
112787
|
+
const wantsLogin2 = await promptConfirm({
|
|
112788
|
+
message: `Log in to ${opts.urlOverride} now?`,
|
|
112789
|
+
default: true
|
|
112790
|
+
});
|
|
112791
|
+
if (!wantsLogin2) {
|
|
112792
|
+
console.error(`Not authenticated to ${opts.urlOverride}. Please run: temps login --url ${opts.urlOverride}`);
|
|
112793
|
+
process.exit(1);
|
|
112794
|
+
}
|
|
112795
|
+
await loginWithDevice({ url: opts.urlOverride });
|
|
112796
|
+
const ctx = await findContextByUrl(opts.urlOverride);
|
|
112797
|
+
if (ctx)
|
|
112798
|
+
return ctx.apiKey;
|
|
112799
|
+
console.error(`Login to ${opts.urlOverride} did not produce a usable session.`);
|
|
112800
|
+
process.exit(1);
|
|
112801
|
+
}
|
|
112802
|
+
if (await credentials.isAuthenticated()) {
|
|
112803
|
+
return requireAuth();
|
|
112804
|
+
}
|
|
112805
|
+
if (opts.yes) {
|
|
112806
|
+
return requireAuth();
|
|
112807
|
+
}
|
|
112808
|
+
warning2("Not logged in to the Temps CLI yet.");
|
|
112809
|
+
const wantsLogin = await promptConfirm({
|
|
112810
|
+
message: "Log in now?",
|
|
112811
|
+
default: true
|
|
112812
|
+
});
|
|
112813
|
+
if (!wantsLogin) {
|
|
112814
|
+
return requireAuth();
|
|
112815
|
+
}
|
|
112816
|
+
const url = await promptText({
|
|
112817
|
+
message: "Temps server URL (leave blank to use the default)",
|
|
112818
|
+
default: getApiUrl()
|
|
112819
|
+
});
|
|
112820
|
+
await loginWithDevice({ url: url || undefined });
|
|
112821
|
+
return requireAuth();
|
|
112822
|
+
}
|
|
112823
|
+
function resolveWebUrl(urlOverride) {
|
|
112824
|
+
if (!urlOverride)
|
|
112825
|
+
return getWebUrl();
|
|
112826
|
+
return urlOverride.replace(/\/+$/, "").replace(/\/api$/, "");
|
|
112827
|
+
}
|
|
112828
|
+
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.";
|
|
112829
|
+
var CUSTOM_TARGET = "__custom_url__";
|
|
112830
|
+
async function selectMcpTarget(options) {
|
|
112831
|
+
if (options.url || options.yes)
|
|
112832
|
+
return { url: options.url };
|
|
112833
|
+
const contexts = await listContexts();
|
|
112834
|
+
if (contexts.length === 0)
|
|
112835
|
+
return {};
|
|
112836
|
+
const active = await getActiveContext();
|
|
112837
|
+
const ordered = active ? [active, ...contexts.filter((c) => c.name !== active.name)] : contexts;
|
|
112838
|
+
const selected = await promptSearch({
|
|
112839
|
+
message: "Which Temps instance do you want to configure? (type to search)",
|
|
112840
|
+
choices: [
|
|
112841
|
+
...ordered.map((c) => ({
|
|
112842
|
+
name: `${c.name}${active?.name === c.name ? " [current]" : ""}`,
|
|
112843
|
+
value: c.name,
|
|
112844
|
+
description: c.url
|
|
112845
|
+
})),
|
|
112846
|
+
{ name: "Enter a different URL...", value: CUSTOM_TARGET, alwaysShow: true }
|
|
112847
|
+
]
|
|
112848
|
+
});
|
|
112849
|
+
if (selected === CUSTOM_TARGET) {
|
|
112850
|
+
const url = await promptText({ message: "Temps server URL" });
|
|
112851
|
+
if (!url)
|
|
112852
|
+
return {};
|
|
112853
|
+
const matched = await findContextByUrl(url);
|
|
112854
|
+
return matched ? { url, apiKey: matched.apiKey } : { url };
|
|
112855
|
+
}
|
|
112856
|
+
const ctx = await getContext(selected);
|
|
112857
|
+
return ctx ? { url: ctx.url, apiKey: ctx.apiKey } : {};
|
|
112858
|
+
}
|
|
112859
|
+
function registerMcpCommands(program2) {
|
|
112860
|
+
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)");
|
|
112861
|
+
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);
|
|
112862
|
+
mcp.command("disable").description("Disable the Temps MCP server on this instance (admin)").option("-u, --url <url>", URL_OPTION_DESCRIPTION).action(disableAction);
|
|
112863
|
+
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);
|
|
112864
|
+
mcp.command("remove [client]").description("Remove the Temps MCP server from an AI client").action(removeAction3);
|
|
112865
|
+
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);
|
|
112866
|
+
}
|
|
112867
|
+
async function setMcpServerEnabled(enabled, urlOverride) {
|
|
112868
|
+
const apiKey = await ensureMcpAuth({ urlOverride });
|
|
112869
|
+
await setupClient(urlOverride, apiKey);
|
|
112870
|
+
await withSpinner(enabled ? "Enabling the Temps MCP server..." : "Disabling the Temps MCP server...", async () => {
|
|
112871
|
+
const { data: currentSettings, error: getError } = await getSettings({ client });
|
|
112872
|
+
if (getError)
|
|
112873
|
+
throw new Error(getErrorMessage(getError));
|
|
112874
|
+
const { error: error3 } = await updateSettings({
|
|
112875
|
+
client,
|
|
112876
|
+
body: { ...currentSettings, mcp_server: { enabled } }
|
|
112877
|
+
});
|
|
112878
|
+
if (error3)
|
|
112879
|
+
throw new Error(getErrorMessage(error3));
|
|
112880
|
+
});
|
|
112881
|
+
}
|
|
112882
|
+
async function enableAction(options) {
|
|
112883
|
+
await setMcpServerEnabled(true, options.url);
|
|
112884
|
+
success2("MCP server enabled.");
|
|
112885
|
+
info2("Run `bunx @temps-sdk/cli mcp add <client>` to connect an AI client (Claude Code, Claude Desktop, Codex, Cursor, VS Code, Windsurf, Zed).");
|
|
112886
|
+
}
|
|
112887
|
+
async function disableAction(options) {
|
|
112888
|
+
await setMcpServerEnabled(false, options.url);
|
|
112889
|
+
success2("MCP server disabled.");
|
|
112890
|
+
info2("AI clients configured with `mcp add` will stop working until this is enabled again.");
|
|
112891
|
+
}
|
|
112892
|
+
async function addAction(clientArg, options) {
|
|
112893
|
+
const target = await selectMcpTarget({ url: options.url, yes: options.yes });
|
|
112894
|
+
const authenticatedApiKey = await ensureMcpAuth({ yes: options.yes, urlOverride: target.url });
|
|
112895
|
+
await setupClient(target.url, target.apiKey ?? authenticatedApiKey);
|
|
112896
|
+
const clientId = clientArg || await promptSelect({
|
|
112897
|
+
message: "Which AI client do you want to configure?",
|
|
112898
|
+
choices: CLIENT_ADAPTERS.map((c) => ({ name: c.label, value: c.id }))
|
|
112899
|
+
});
|
|
112900
|
+
const adapter = getClientAdapter(clientId);
|
|
112901
|
+
if (!adapter) {
|
|
112902
|
+
warning2(`Unknown client "${clientId}". Available: ${listClientIds().join(", ")}`);
|
|
112903
|
+
return;
|
|
112904
|
+
}
|
|
112905
|
+
const mcpBaseUrl = resolveWebUrl(target.url);
|
|
112906
|
+
const probe = await withSpinner("Checking for Temps MCP support...", () => probeMcpEndpoint(mcpBaseUrl));
|
|
112907
|
+
if (!probe.supported) {
|
|
112908
|
+
warning2(`This Temps instance does not expose an MCP endpoint (${probe.reason}).`);
|
|
112909
|
+
info2("Run `bunx @temps-sdk/cli mcp enable` as an admin to turn it on (or this instance may predate MCP support).");
|
|
112910
|
+
return;
|
|
112911
|
+
}
|
|
112912
|
+
const clientSupported = await adapter.isClientSupported();
|
|
112913
|
+
if (!clientSupported) {
|
|
112914
|
+
warning2(`${adapter.label} was not detected on this machine -- continuing anyway.`);
|
|
112915
|
+
}
|
|
112916
|
+
let groups;
|
|
112917
|
+
if (options.groups) {
|
|
112918
|
+
groups = options.groups.split(",").map((g) => g.trim()).filter(Boolean);
|
|
112919
|
+
const invalid = groups.filter((g) => !isValidGroupKey(g));
|
|
112920
|
+
if (invalid.length > 0) {
|
|
112921
|
+
warning2(`Unknown tool group(s): ${invalid.join(", ")}. Available: ${TOOL_GROUPS.map((g) => g.key).join(", ")}`);
|
|
112922
|
+
return;
|
|
112923
|
+
}
|
|
112924
|
+
} else if (options.yes) {
|
|
112925
|
+
groups = TOOL_GROUPS.map((g) => g.key);
|
|
112926
|
+
} else {
|
|
112927
|
+
groups = await promptCheckbox({
|
|
112928
|
+
message: "Which tool groups should be available?",
|
|
112929
|
+
choices: TOOL_GROUPS.map((g) => ({
|
|
112930
|
+
name: `${g.label} (${g.categories.length} categories)`,
|
|
112931
|
+
value: g.key
|
|
112932
|
+
}))
|
|
112933
|
+
});
|
|
112934
|
+
if (groups.length === 0)
|
|
112935
|
+
groups = TOOL_GROUPS.map((g) => g.key);
|
|
112936
|
+
}
|
|
112937
|
+
const write = options.write ?? (options.yes ? false : await promptConfirm({
|
|
112938
|
+
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.",
|
|
112939
|
+
default: false
|
|
112940
|
+
}));
|
|
112941
|
+
let apiKey = options.apiKey;
|
|
112942
|
+
if (!apiKey) {
|
|
112943
|
+
const wantsNewKey = options.yes ? false : await promptConfirm({
|
|
112944
|
+
message: "Create a new dedicated API key scoped for MCP access? (recommended over reusing an existing key)",
|
|
112945
|
+
default: true
|
|
112946
|
+
});
|
|
112947
|
+
if (wantsNewKey) {
|
|
112948
|
+
const created = await withSpinner("Creating a scoped API key...", async () => {
|
|
112949
|
+
const { data, error: error3 } = await createApiKey({
|
|
112950
|
+
client,
|
|
112951
|
+
body: {
|
|
112952
|
+
name: `mcp-${adapter.id}-${new Date().toISOString().slice(0, 10)}`,
|
|
112953
|
+
role_type: write ? "user" : "reader",
|
|
112954
|
+
expires_at: null,
|
|
112955
|
+
permissions: null
|
|
112956
|
+
}
|
|
112957
|
+
});
|
|
112958
|
+
if (error3)
|
|
112959
|
+
throw new Error(getErrorMessage(error3));
|
|
112960
|
+
if (!data)
|
|
112961
|
+
throw new Error("No response data from create API key");
|
|
112962
|
+
return data;
|
|
112963
|
+
});
|
|
112964
|
+
apiKey = created.api_key;
|
|
112965
|
+
newline();
|
|
112966
|
+
success2(`Created API key "${created.name}" (${created.key_prefix}...)`);
|
|
112967
|
+
} else {
|
|
112968
|
+
apiKey = target.apiKey ?? authenticatedApiKey;
|
|
112969
|
+
}
|
|
112970
|
+
}
|
|
112971
|
+
const url = buildMcpUrl(mcpBaseUrl, groups, write);
|
|
112972
|
+
newline();
|
|
112973
|
+
header(`Configure ${adapter.label}`);
|
|
112974
|
+
keyValue("Target", await adapter.describeTarget());
|
|
112975
|
+
keyValue("URL", url);
|
|
112976
|
+
keyValue("Groups", groups.length === TOOL_GROUPS.length ? "all" : groups.join(", "));
|
|
112977
|
+
keyValue("Write tools", write ? "enabled" : "disabled (read-only)");
|
|
112978
|
+
newline();
|
|
112979
|
+
if (!options.yes) {
|
|
112980
|
+
const proceed = await promptConfirm({ message: "Apply this configuration?", default: true });
|
|
112981
|
+
if (!proceed) {
|
|
112982
|
+
info2("Cancelled -- no changes made.");
|
|
112983
|
+
return;
|
|
112984
|
+
}
|
|
112985
|
+
}
|
|
112986
|
+
const result2 = await adapter.addServer({ url, apiKey });
|
|
112987
|
+
if (!result2.success) {
|
|
112988
|
+
warning2(`Failed to configure ${adapter.label}: ${result2.reason}`);
|
|
112989
|
+
return;
|
|
112990
|
+
}
|
|
112991
|
+
if (result2.alreadyInstalled) {
|
|
112992
|
+
info2(`${adapter.label} is already configured with this exact setup.`);
|
|
112993
|
+
} else {
|
|
112994
|
+
success2(`${adapter.label} configured.`);
|
|
112995
|
+
}
|
|
112996
|
+
info2(`Restart ${adapter.label} to pick up the change.`);
|
|
112997
|
+
if (adapter.id === "codex") {
|
|
112998
|
+
newline();
|
|
112999
|
+
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:`);
|
|
113000
|
+
info2(` export ${TOKEN_ENV_VAR}='Bearer ${apiKey}'`);
|
|
113001
|
+
}
|
|
113002
|
+
}
|
|
113003
|
+
async function removeAction3(clientArg) {
|
|
113004
|
+
const clientId = clientArg || await promptSelect({
|
|
113005
|
+
message: "Which AI client do you want to remove the Temps MCP server from?",
|
|
113006
|
+
choices: CLIENT_ADAPTERS.map((c) => ({ name: c.label, value: c.id }))
|
|
113007
|
+
});
|
|
113008
|
+
const adapter = getClientAdapter(clientId);
|
|
113009
|
+
if (!adapter) {
|
|
113010
|
+
warning2(`Unknown client "${clientId}". Available: ${listClientIds().join(", ")}`);
|
|
113011
|
+
return;
|
|
113012
|
+
}
|
|
113013
|
+
const result2 = await adapter.removeServer();
|
|
113014
|
+
if (!result2.success) {
|
|
113015
|
+
warning2(`Failed to remove from ${adapter.label}: ${result2.reason}`);
|
|
113016
|
+
return;
|
|
113017
|
+
}
|
|
113018
|
+
if (result2.alreadyInstalled) {
|
|
113019
|
+
info2(`${adapter.label} had no Temps MCP server configured.`);
|
|
113020
|
+
} else {
|
|
113021
|
+
success2(`Removed the Temps MCP server from ${adapter.label}.`);
|
|
113022
|
+
}
|
|
113023
|
+
}
|
|
113024
|
+
function formatGroups(url) {
|
|
113025
|
+
if (!url)
|
|
113026
|
+
return "-";
|
|
113027
|
+
const parsed = parseMcpUrl(url);
|
|
113028
|
+
if (!parsed)
|
|
113029
|
+
return "-";
|
|
113030
|
+
const label = parsed.groups.length === TOOL_GROUPS.length ? "All" : `${parsed.groups.length}/${TOOL_GROUPS.length}`;
|
|
113031
|
+
return parsed.write ? `${label} (write)` : label;
|
|
113032
|
+
}
|
|
113033
|
+
async function statusAction2(options) {
|
|
113034
|
+
const mcpBaseUrl = resolveWebUrl(options.url);
|
|
113035
|
+
const probe = await withSpinner("Checking this instance...", () => probeMcpEndpoint(mcpBaseUrl));
|
|
113036
|
+
header("Temps MCP status");
|
|
113037
|
+
newline();
|
|
113038
|
+
keyValue("This instance", probe.supported ? `${icons.success} enabled (${mcpBaseUrl})` : `${icons.bullet} disabled (${mcpBaseUrl})`);
|
|
113039
|
+
if (!probe.supported) {
|
|
113040
|
+
info2("Run `bunx @temps-sdk/cli mcp enable` as an admin to turn it on.");
|
|
113041
|
+
}
|
|
113042
|
+
newline();
|
|
113043
|
+
const rows = await Promise.all(CLIENT_ADAPTERS.map(async (adapter) => {
|
|
113044
|
+
const [detected, installed] = await Promise.all([adapter.isClientSupported(), adapter.isServerInstalled()]);
|
|
113045
|
+
const url = installed ? await adapter.getServerUrl() : null;
|
|
113046
|
+
return {
|
|
113047
|
+
label: adapter.label,
|
|
113048
|
+
detected: detected ? `${icons.success} detected` : `${icons.bullet} not detected`,
|
|
113049
|
+
installed: installed ? `${icons.success} configured` : `${icons.bullet} not configured`,
|
|
113050
|
+
groups: formatGroups(url)
|
|
113051
|
+
};
|
|
113052
|
+
}));
|
|
113053
|
+
const columns = [
|
|
113054
|
+
{ header: "Client", key: "label" },
|
|
113055
|
+
{ header: "On this machine", key: "detected" },
|
|
113056
|
+
{ header: "Temps MCP server", key: "installed" },
|
|
113057
|
+
{ header: "Tool groups", key: "groups" }
|
|
113058
|
+
];
|
|
113059
|
+
printTable(rows, columns);
|
|
113060
|
+
}
|
|
113061
|
+
|
|
111018
113062
|
// src/commands/secrets/index.ts
|
|
111019
113063
|
import { readFileSync as readFileSync10 } from "node:fs";
|
|
111020
113064
|
init_spinner();
|
|
@@ -111209,10 +113253,10 @@ init_output();
|
|
|
111209
113253
|
init_sdk_gen();
|
|
111210
113254
|
|
|
111211
113255
|
// src/lib/detect-project.ts
|
|
111212
|
-
import { existsSync as
|
|
113256
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
111213
113257
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
111214
113258
|
import { execSync as execSync2 } from "node:child_process";
|
|
111215
|
-
import { join as
|
|
113259
|
+
import { join as join13, basename as basename5 } from "node:path";
|
|
111216
113260
|
var PRESET_RULES = [
|
|
111217
113261
|
{
|
|
111218
113262
|
files: ["next.config.js", "next.config.ts", "next.config.mjs"],
|
|
@@ -111288,7 +113332,7 @@ var PRESET_RULES = [
|
|
|
111288
113332
|
function detectPreset(dir) {
|
|
111289
113333
|
const projectDir = dir ?? process.cwd();
|
|
111290
113334
|
for (const rule of PRESET_RULES) {
|
|
111291
|
-
const matched = rule.files.some((file) =>
|
|
113335
|
+
const matched = rule.files.some((file) => existsSync15(join13(projectDir, file)));
|
|
111292
113336
|
if (matched) {
|
|
111293
113337
|
return {
|
|
111294
113338
|
slug: rule.slug,
|
|
@@ -111297,14 +113341,14 @@ function detectPreset(dir) {
|
|
|
111297
113341
|
};
|
|
111298
113342
|
}
|
|
111299
113343
|
}
|
|
111300
|
-
if (
|
|
113344
|
+
if (existsSync15(join13(projectDir, "package.json"))) {
|
|
111301
113345
|
return {
|
|
111302
113346
|
slug: "nodejs",
|
|
111303
113347
|
label: "Node.js",
|
|
111304
113348
|
confidence: "low"
|
|
111305
113349
|
};
|
|
111306
113350
|
}
|
|
111307
|
-
if (
|
|
113351
|
+
if (existsSync15(join13(projectDir, "index.html"))) {
|
|
111308
113352
|
return {
|
|
111309
113353
|
slug: "static",
|
|
111310
113354
|
label: "Static Site",
|
|
@@ -111315,8 +113359,8 @@ function detectPreset(dir) {
|
|
|
111315
113359
|
}
|
|
111316
113360
|
async function refinePythonPreset(dir) {
|
|
111317
113361
|
const projectDir = dir ?? process.cwd();
|
|
111318
|
-
const reqPath =
|
|
111319
|
-
if (
|
|
113362
|
+
const reqPath = join13(projectDir, "requirements.txt");
|
|
113363
|
+
if (existsSync15(reqPath)) {
|
|
111320
113364
|
try {
|
|
111321
113365
|
const content = await readFile8(reqPath, "utf-8");
|
|
111322
113366
|
const lower = content.toLowerCase();
|
|
@@ -111328,8 +113372,8 @@ async function refinePythonPreset(dir) {
|
|
|
111328
113372
|
return { slug: "flask", label: "Flask", confidence: "high" };
|
|
111329
113373
|
} catch {}
|
|
111330
113374
|
}
|
|
111331
|
-
const pyprojectPath =
|
|
111332
|
-
if (
|
|
113375
|
+
const pyprojectPath = join13(projectDir, "pyproject.toml");
|
|
113376
|
+
if (existsSync15(pyprojectPath)) {
|
|
111333
113377
|
try {
|
|
111334
113378
|
const content = await readFile8(pyprojectPath, "utf-8");
|
|
111335
113379
|
const lower = content.toLowerCase();
|
|
@@ -111347,16 +113391,16 @@ var STATIC_DIR_CANDIDATES = ["dist", "build", "out", "public", "_site", "output"
|
|
|
111347
113391
|
function detectStaticDir(dir) {
|
|
111348
113392
|
const projectDir = dir ?? process.cwd();
|
|
111349
113393
|
for (const candidate of STATIC_DIR_CANDIDATES) {
|
|
111350
|
-
if (
|
|
113394
|
+
if (existsSync15(join13(projectDir, candidate, "index.html"))) {
|
|
111351
113395
|
return candidate;
|
|
111352
113396
|
}
|
|
111353
113397
|
}
|
|
111354
113398
|
for (const candidate of STATIC_DIR_CANDIDATES) {
|
|
111355
|
-
if (
|
|
113399
|
+
if (existsSync15(join13(projectDir, candidate))) {
|
|
111356
113400
|
return candidate;
|
|
111357
113401
|
}
|
|
111358
113402
|
}
|
|
111359
|
-
if (
|
|
113403
|
+
if (existsSync15(join13(projectDir, "index.html"))) {
|
|
111360
113404
|
return ".";
|
|
111361
113405
|
}
|
|
111362
113406
|
return null;
|
|
@@ -111424,8 +113468,8 @@ async function detectServiceHints(dir) {
|
|
|
111424
113468
|
const hints = new Set;
|
|
111425
113469
|
const envFiles = [".env", ".env.example", ".env.local", ".env.development"];
|
|
111426
113470
|
for (const envFile of envFiles) {
|
|
111427
|
-
const envPath =
|
|
111428
|
-
if (
|
|
113471
|
+
const envPath = join13(projectDir, envFile);
|
|
113472
|
+
if (existsSync15(envPath)) {
|
|
111429
113473
|
try {
|
|
111430
113474
|
const content = await readFile8(envPath, "utf-8");
|
|
111431
113475
|
const upper = content.toUpperCase();
|
|
@@ -111444,8 +113488,8 @@ async function detectServiceHints(dir) {
|
|
|
111444
113488
|
} catch {}
|
|
111445
113489
|
}
|
|
111446
113490
|
}
|
|
111447
|
-
const prismaPath =
|
|
111448
|
-
if (
|
|
113491
|
+
const prismaPath = join13(projectDir, "prisma", "schema.prisma");
|
|
113492
|
+
if (existsSync15(prismaPath)) {
|
|
111449
113493
|
try {
|
|
111450
113494
|
const content = await readFile8(prismaPath, "utf-8");
|
|
111451
113495
|
if (content.includes("postgresql") || content.includes("postgres")) {
|
|
@@ -111458,7 +113502,7 @@ async function detectServiceHints(dir) {
|
|
|
111458
113502
|
}
|
|
111459
113503
|
const drizzleFiles = ["drizzle.config.ts", "drizzle.config.js"];
|
|
111460
113504
|
for (const drizzleFile of drizzleFiles) {
|
|
111461
|
-
if (
|
|
113505
|
+
if (existsSync15(join13(projectDir, drizzleFile))) {
|
|
111462
113506
|
hints.add("postgres");
|
|
111463
113507
|
break;
|
|
111464
113508
|
}
|
|
@@ -111467,8 +113511,8 @@ async function detectServiceHints(dir) {
|
|
|
111467
113511
|
}
|
|
111468
113512
|
async function suggestProjectName(dir) {
|
|
111469
113513
|
const projectDir = dir ?? process.cwd();
|
|
111470
|
-
const pkgPath =
|
|
111471
|
-
if (
|
|
113514
|
+
const pkgPath = join13(projectDir, "package.json");
|
|
113515
|
+
if (existsSync15(pkgPath)) {
|
|
111472
113516
|
try {
|
|
111473
113517
|
const content = await readFile8(pkgPath, "utf-8");
|
|
111474
113518
|
const pkg = JSON.parse(content);
|
|
@@ -111850,16 +113894,16 @@ async function auth() {
|
|
|
111850
113894
|
const baseUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
111851
113895
|
return { baseUrl, apiKey };
|
|
111852
113896
|
}
|
|
111853
|
-
function sandboxUrl(baseUrl,
|
|
111854
|
-
return `${baseUrl.replace(/\/+$/, "")}/v1/sandboxes${
|
|
113897
|
+
function sandboxUrl(baseUrl, path14) {
|
|
113898
|
+
return `${baseUrl.replace(/\/+$/, "")}/v1/sandboxes${path14}`;
|
|
111855
113899
|
}
|
|
111856
|
-
async function apiRequest(api,
|
|
113900
|
+
async function apiRequest(api, path14, init = {}) {
|
|
111857
113901
|
const headers = new Headers(init.headers);
|
|
111858
113902
|
headers.set("Authorization", `Bearer ${api.apiKey}`);
|
|
111859
113903
|
if (init.body && !headers.has("Content-Type")) {
|
|
111860
113904
|
headers.set("Content-Type", "application/json");
|
|
111861
113905
|
}
|
|
111862
|
-
const response = await fetch(sandboxUrl(api.baseUrl,
|
|
113906
|
+
const response = await fetch(sandboxUrl(api.baseUrl, path14), { ...init, headers });
|
|
111863
113907
|
if (!response.ok) {
|
|
111864
113908
|
throw await readApiError(response);
|
|
111865
113909
|
}
|
|
@@ -111939,11 +113983,11 @@ function registerSandboxCommands(program2) {
|
|
|
111939
113983
|
sandbox.command("logs <id> <jobId>").description("Stream logs from a detached job (SSE)").action(logsAction);
|
|
111940
113984
|
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
113985
|
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
|
|
111943
|
-
|
|
111944
|
-
|
|
111945
|
-
|
|
111946
|
-
|
|
113986
|
+
const fs7 = sandbox.command("fs").description("Filesystem operations inside a sandbox");
|
|
113987
|
+
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);
|
|
113988
|
+
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);
|
|
113989
|
+
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);
|
|
113990
|
+
fs7.command("mkdir <id>").description("Create a directory inside the sandbox (mkdir -p)").requiredOption("--path <path>", "Absolute path inside the sandbox").action(fsMkdirAction);
|
|
111947
113991
|
const snaps = sandbox.command("snapshots").description("Manage sandbox snapshots (ADR-037)");
|
|
111948
113992
|
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
113993
|
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 +114194,8 @@ async function listAction7(options) {
|
|
|
112150
114194
|
const projectId = await resolveProjectIdBySlug(options.project);
|
|
112151
114195
|
qs.push(`project_id=${projectId}`);
|
|
112152
114196
|
}
|
|
112153
|
-
const
|
|
112154
|
-
const data = await withSpinner("Fetching sandboxes...", () => apiRequest(api,
|
|
114197
|
+
const path14 = qs.length ? `?${qs.join("&")}` : "";
|
|
114198
|
+
const data = await withSpinner("Fetching sandboxes...", () => apiRequest(api, path14));
|
|
112155
114199
|
if (options.json) {
|
|
112156
114200
|
json(data);
|
|
112157
114201
|
return;
|
|
@@ -112287,9 +114331,9 @@ async function execAction(id, args, options) {
|
|
|
112287
114331
|
body.env = env4;
|
|
112288
114332
|
if (options.cwd)
|
|
112289
114333
|
body.cwd = options.cwd;
|
|
112290
|
-
const
|
|
114334
|
+
const path14 = options.detach ? `/${encodeURIComponent(id)}/exec-detached` : `/${encodeURIComponent(id)}/exec`;
|
|
112291
114335
|
if (options.detach) {
|
|
112292
|
-
const res2 = await withSpinner("Starting detached job...", () => apiRequest(api,
|
|
114336
|
+
const res2 = await withSpinner("Starting detached job...", () => apiRequest(api, path14, {
|
|
112293
114337
|
method: "POST",
|
|
112294
114338
|
body: JSON.stringify(body)
|
|
112295
114339
|
}));
|
|
@@ -112297,7 +114341,7 @@ async function execAction(id, args, options) {
|
|
|
112297
114341
|
info2(`Stream logs: temps sandbox logs ${id} ${res2.job_id}`);
|
|
112298
114342
|
return;
|
|
112299
114343
|
}
|
|
112300
|
-
const res = await apiRequest(api,
|
|
114344
|
+
const res = await apiRequest(api, path14, {
|
|
112301
114345
|
method: "POST",
|
|
112302
114346
|
body: JSON.stringify(body)
|
|
112303
114347
|
});
|
|
@@ -112451,16 +114495,16 @@ async function fsMkdirAction(id, options) {
|
|
|
112451
114495
|
}));
|
|
112452
114496
|
success2(`Directory ${colors.primary(options.path)} created`);
|
|
112453
114497
|
}
|
|
112454
|
-
function snapshotUrl(baseUrl,
|
|
112455
|
-
return `${baseUrl.replace(/\/+$/, "")}/v1/sandbox-snapshots${
|
|
114498
|
+
function snapshotUrl(baseUrl, path14) {
|
|
114499
|
+
return `${baseUrl.replace(/\/+$/, "")}/v1/sandbox-snapshots${path14}`;
|
|
112456
114500
|
}
|
|
112457
|
-
async function snapshotApiRequest(api,
|
|
114501
|
+
async function snapshotApiRequest(api, path14, init = {}) {
|
|
112458
114502
|
const headers = new Headers(init.headers);
|
|
112459
114503
|
headers.set("Authorization", `Bearer ${api.apiKey}`);
|
|
112460
114504
|
if (init.body && !headers.has("Content-Type")) {
|
|
112461
114505
|
headers.set("Content-Type", "application/json");
|
|
112462
114506
|
}
|
|
112463
|
-
const response = await fetch(snapshotUrl(api.baseUrl,
|
|
114507
|
+
const response = await fetch(snapshotUrl(api.baseUrl, path14), { ...init, headers });
|
|
112464
114508
|
if (!response.ok) {
|
|
112465
114509
|
throw await readApiError(response);
|
|
112466
114510
|
}
|
|
@@ -112630,13 +114674,13 @@ async function authClient() {
|
|
|
112630
114674
|
const baseUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
112631
114675
|
return { baseUrl, apiKey };
|
|
112632
114676
|
}
|
|
112633
|
-
async function apiRequest2(api,
|
|
114677
|
+
async function apiRequest2(api, path14, init = {}) {
|
|
112634
114678
|
const headers = new Headers(init.headers);
|
|
112635
114679
|
headers.set("Authorization", `Bearer ${api.apiKey}`);
|
|
112636
114680
|
if (init.body && !headers.has("Content-Type")) {
|
|
112637
114681
|
headers.set("Content-Type", "application/json");
|
|
112638
114682
|
}
|
|
112639
|
-
const response = await fetch(`${api.baseUrl}${
|
|
114683
|
+
const response = await fetch(`${api.baseUrl}${path14}`, { ...init, headers });
|
|
112640
114684
|
if (!response.ok) {
|
|
112641
114685
|
throw await readApiError2(response);
|
|
112642
114686
|
}
|
|
@@ -113107,9 +115151,9 @@ function extractAiEvent(message) {
|
|
|
113107
115151
|
}
|
|
113108
115152
|
if (itemType === "file_change") {
|
|
113109
115153
|
if (type === "item.started") {
|
|
113110
|
-
const
|
|
115154
|
+
const path14 = item.path ?? "";
|
|
113111
115155
|
const op = item.operation ?? "edit";
|
|
113112
|
-
return { kind: "call", toolUseId: id, name: "file", summary: `${op} ${
|
|
115156
|
+
return { kind: "call", toolUseId: id, name: "file", summary: `${op} ${path14}` };
|
|
113113
115157
|
}
|
|
113114
115158
|
return {
|
|
113115
115159
|
kind: "result",
|
|
@@ -114043,8 +116087,8 @@ init_prompts();
|
|
|
114043
116087
|
init_spinner();
|
|
114044
116088
|
init_output();
|
|
114045
116089
|
init_sdk_gen();
|
|
114046
|
-
import { existsSync as
|
|
114047
|
-
import { resolve as resolve8, join as
|
|
116090
|
+
import { existsSync as existsSync16, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
|
|
116091
|
+
import { resolve as resolve8, join as join14 } from "node:path";
|
|
114048
116092
|
import { tmpdir as tmpdir5 } from "node:os";
|
|
114049
116093
|
async function runSetupWizard(options) {
|
|
114050
116094
|
newline();
|
|
@@ -114147,7 +116191,7 @@ async function runSetupWizard(options) {
|
|
|
114147
116191
|
} else {
|
|
114148
116192
|
staticDir = detectedStaticDir ?? "dist";
|
|
114149
116193
|
}
|
|
114150
|
-
if (!
|
|
116194
|
+
if (!existsSync16(resolve8(staticDir))) {
|
|
114151
116195
|
warning2(`Folder not found: ${colors.bold(staticDir)}`);
|
|
114152
116196
|
info2("Build your project first, then re-run, or pass --static-dir <path>.");
|
|
114153
116197
|
return null;
|
|
@@ -114345,7 +116389,7 @@ async function runSetupWizard(options) {
|
|
|
114345
116389
|
info2("Building and deploying...");
|
|
114346
116390
|
newline();
|
|
114347
116391
|
try {
|
|
114348
|
-
const hasDockerfile =
|
|
116392
|
+
const hasDockerfile = existsSync16(resolve8("Dockerfile"));
|
|
114349
116393
|
let dockerfilePath;
|
|
114350
116394
|
let buildArgsList;
|
|
114351
116395
|
if (!hasDockerfile && presetSlug && presetSlug !== "dockerfile") {
|
|
@@ -114373,9 +116417,9 @@ async function runSetupWizard(options) {
|
|
|
114373
116417
|
isGitBased
|
|
114374
116418
|
};
|
|
114375
116419
|
}
|
|
114376
|
-
const tempDir =
|
|
116420
|
+
const tempDir = join14(tmpdir5(), `temps-dockerfile-${Date.now()}`);
|
|
114377
116421
|
mkdirSync2(tempDir, { recursive: true });
|
|
114378
|
-
dockerfilePath =
|
|
116422
|
+
dockerfilePath = join14(tempDir, "Dockerfile");
|
|
114379
116423
|
writeFileSync5(dockerfilePath, dockerfileData.dockerfile);
|
|
114380
116424
|
success2(`Dockerfile generated from ${presetSlug} preset`);
|
|
114381
116425
|
if (dockerfileData.build_args && Object.keys(dockerfileData.build_args).length > 0) {
|
|
@@ -114482,13 +116526,13 @@ async function selectPresetFromAll() {
|
|
|
114482
116526
|
}
|
|
114483
116527
|
function detectPackageManager(dir) {
|
|
114484
116528
|
const projectDir = dir ? resolve8(dir) : process.cwd();
|
|
114485
|
-
if (
|
|
116529
|
+
if (existsSync16(join14(projectDir, "pnpm-lock.yaml")))
|
|
114486
116530
|
return "pnpm";
|
|
114487
|
-
if (
|
|
116531
|
+
if (existsSync16(join14(projectDir, "yarn.lock")))
|
|
114488
116532
|
return "yarn";
|
|
114489
|
-
if (
|
|
116533
|
+
if (existsSync16(join14(projectDir, "bun.lockb")) || existsSync16(join14(projectDir, "bun.lock")))
|
|
114490
116534
|
return "bun";
|
|
114491
|
-
if (
|
|
116535
|
+
if (existsSync16(join14(projectDir, "package-lock.json")))
|
|
114492
116536
|
return "npm";
|
|
114493
116537
|
return "npm";
|
|
114494
116538
|
}
|
|
@@ -114940,27 +116984,27 @@ function registerAiCommands(program2) {
|
|
|
114940
116984
|
|
|
114941
116985
|
// src/config/instances.ts
|
|
114942
116986
|
import { readFile as readFile10, writeFile as writeFile5, mkdir as mkdir5 } from "node:fs/promises";
|
|
114943
|
-
import { existsSync as
|
|
114944
|
-
import { dirname as
|
|
116987
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
116988
|
+
import { dirname as dirname5 } from "node:path";
|
|
114945
116989
|
function getInstancesPath() {
|
|
114946
116990
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
114947
116991
|
return `${home}/.temps/.instances.json`;
|
|
114948
116992
|
}
|
|
114949
116993
|
async function loadInstances() {
|
|
114950
|
-
const
|
|
116994
|
+
const path14 = getInstancesPath();
|
|
114951
116995
|
try {
|
|
114952
|
-
if (
|
|
114953
|
-
const content = await readFile10(
|
|
116996
|
+
if (existsSync17(path14)) {
|
|
116997
|
+
const content = await readFile10(path14, "utf-8");
|
|
114954
116998
|
return JSON.parse(content);
|
|
114955
116999
|
}
|
|
114956
117000
|
} catch {}
|
|
114957
117001
|
return [];
|
|
114958
117002
|
}
|
|
114959
117003
|
async function saveInstances(instances2) {
|
|
114960
|
-
const
|
|
114961
|
-
const dir =
|
|
117004
|
+
const path14 = getInstancesPath();
|
|
117005
|
+
const dir = dirname5(path14);
|
|
114962
117006
|
await mkdir5(dir, { recursive: true });
|
|
114963
|
-
await writeFile5(
|
|
117007
|
+
await writeFile5(path14, JSON.stringify(instances2, null, 2) + `
|
|
114964
117008
|
`, { mode: 384 });
|
|
114965
117009
|
}
|
|
114966
117010
|
async function listInstances() {
|
|
@@ -115044,7 +117088,7 @@ async function listAction9(options) {
|
|
|
115044
117088
|
printTable(instances2, columns, { style: "minimal" });
|
|
115045
117089
|
newline();
|
|
115046
117090
|
}
|
|
115047
|
-
async function
|
|
117091
|
+
async function addAction2(options) {
|
|
115048
117092
|
const name = options.name ?? await promptText({
|
|
115049
117093
|
message: "Instance name",
|
|
115050
117094
|
required: true
|
|
@@ -115054,7 +117098,7 @@ async function addAction(options) {
|
|
|
115054
117098
|
success2(`Instance "${name}" added`);
|
|
115055
117099
|
info2(`Login with: ${colors.bold(`temps login --cloud --url ${url}`)}`);
|
|
115056
117100
|
}
|
|
115057
|
-
async function
|
|
117101
|
+
async function removeAction4(name) {
|
|
115058
117102
|
const instance = await getInstance2(name);
|
|
115059
117103
|
if (!instance) {
|
|
115060
117104
|
error2(`Instance "${name}" not found`);
|
|
@@ -115133,15 +117177,15 @@ async function showAction3(name, options) {
|
|
|
115133
117177
|
function registerInstancesCommands(program2) {
|
|
115134
117178
|
const instances2 = program2.command("instances").alias("instance").description("Manage Temps server instances");
|
|
115135
117179
|
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(
|
|
115137
|
-
instances2.command("remove <name>").alias("rm").description("Remove an instance").action(
|
|
117180
|
+
instances2.command("add").description("Add a new instance").option("-n, --name <name>", "Instance name").option("-u, --url <url>", "Instance URL").action(addAction2);
|
|
117181
|
+
instances2.command("remove <name>").alias("rm").description("Remove an instance").action(removeAction4);
|
|
115138
117182
|
instances2.command("switch <name>").alias("use").description("Switch to a different instance").action(switchAction);
|
|
115139
117183
|
instances2.command("show [name]").description("Show instance details (or current instance)").option("--json", "Output in JSON format").action(showAction3);
|
|
115140
117184
|
}
|
|
115141
117185
|
|
|
115142
117186
|
// src/commands/env-sync/index.ts
|
|
115143
|
-
import * as
|
|
115144
|
-
import * as
|
|
117187
|
+
import * as fs7 from "node:fs";
|
|
117188
|
+
import * as path14 from "node:path";
|
|
115145
117189
|
init_sdk_gen();
|
|
115146
117190
|
init_spinner();
|
|
115147
117191
|
init_prompts();
|
|
@@ -115240,8 +117284,8 @@ async function pull2(file, options) {
|
|
|
115240
117284
|
}
|
|
115241
117285
|
const envContent = exportableVars.map((v) => formatEnvLine(v.key, resolvedValues.get(v.id) ?? "")).join(`
|
|
115242
117286
|
`);
|
|
115243
|
-
const outputPath =
|
|
115244
|
-
if (
|
|
117287
|
+
const outputPath = path14.isAbsolute(outputFile) ? outputFile : path14.resolve(process.cwd(), outputFile);
|
|
117288
|
+
if (fs7.existsSync(outputPath)) {
|
|
115245
117289
|
const overwrite = await promptConfirm({
|
|
115246
117290
|
message: `${outputFile} already exists. Overwrite?`,
|
|
115247
117291
|
default: false
|
|
@@ -115251,7 +117295,7 @@ async function pull2(file, options) {
|
|
|
115251
117295
|
return;
|
|
115252
117296
|
}
|
|
115253
117297
|
}
|
|
115254
|
-
|
|
117298
|
+
fs7.writeFileSync(outputPath, envContent + `
|
|
115255
117299
|
`);
|
|
115256
117300
|
success2(`Pulled ${exportableVars.length} variables to ${outputFile}`);
|
|
115257
117301
|
}
|
|
@@ -115260,12 +117304,12 @@ async function push(file, options) {
|
|
|
115260
117304
|
await setupClient();
|
|
115261
117305
|
const resolved = await requireProjectSlug(options.project);
|
|
115262
117306
|
const inputFile = file ?? ".env";
|
|
115263
|
-
const inputPath =
|
|
115264
|
-
if (!
|
|
117307
|
+
const inputPath = path14.isAbsolute(inputFile) ? inputFile : path14.resolve(process.cwd(), inputFile);
|
|
117308
|
+
if (!fs7.existsSync(inputPath)) {
|
|
115265
117309
|
error2(`File not found: ${inputFile}`);
|
|
115266
117310
|
return;
|
|
115267
117311
|
}
|
|
115268
|
-
const content =
|
|
117312
|
+
const content = fs7.readFileSync(inputPath, "utf-8");
|
|
115269
117313
|
const variables = parseEnvFile2(content);
|
|
115270
117314
|
if (Object.keys(variables).length === 0) {
|
|
115271
117315
|
warning2("No variables found in file");
|
|
@@ -115621,9 +117665,9 @@ async function isCloudAuthenticated() {
|
|
|
115621
117665
|
const key = await credentials.get("cloudApiKey");
|
|
115622
117666
|
return !!key;
|
|
115623
117667
|
}
|
|
115624
|
-
async function cloudFetch(
|
|
117668
|
+
async function cloudFetch(path15, options) {
|
|
115625
117669
|
const apiKey = await requireCloudAuth();
|
|
115626
|
-
const response = await fetch(`${CLOUD_URL}${
|
|
117670
|
+
const response = await fetch(`${CLOUD_URL}${path15}`, {
|
|
115627
117671
|
...options,
|
|
115628
117672
|
headers: {
|
|
115629
117673
|
Authorization: `Bearer ${apiKey}`,
|
|
@@ -115641,8 +117685,8 @@ async function cloudFetch(path8, options) {
|
|
|
115641
117685
|
return;
|
|
115642
117686
|
return JSON.parse(text);
|
|
115643
117687
|
}
|
|
115644
|
-
async function cloudFetchPublic(
|
|
115645
|
-
const response = await fetch(`${CLOUD_URL}${
|
|
117688
|
+
async function cloudFetchPublic(path15) {
|
|
117689
|
+
const response = await fetch(`${CLOUD_URL}${path15}`, {
|
|
115646
117690
|
headers: { "Content-Type": "application/json" }
|
|
115647
117691
|
});
|
|
115648
117692
|
if (!response.ok) {
|
|
@@ -116228,12 +118272,14 @@ function createProgram() {
|
|
|
116228
118272
|
registerMonitorsCommands(program2);
|
|
116229
118273
|
registerWebhooksCommands(program2);
|
|
116230
118274
|
registerContainersCommands(program2);
|
|
118275
|
+
registerClusterCommands(program2);
|
|
116231
118276
|
registerTokensCommands(program2);
|
|
116232
118277
|
registerErrorsCommands(program2);
|
|
116233
118278
|
registerMetricsCommands(program2);
|
|
116234
118279
|
registerTracesCommands(program2);
|
|
116235
118280
|
registerFacetsCommands(program2);
|
|
116236
118281
|
registerOtelForwardCommands(program2);
|
|
118282
|
+
registerOtelCommands(program2);
|
|
116237
118283
|
registerKvCommands(program2);
|
|
116238
118284
|
registerFlagsCommands(program2);
|
|
116239
118285
|
registerDataCommands(program2);
|
|
@@ -116259,6 +118305,7 @@ function createProgram() {
|
|
|
116259
118305
|
registerNotificationPreferencesCommands(program2);
|
|
116260
118306
|
registerSkillsCommands(program2);
|
|
116261
118307
|
registerMcpServersCommands(program2);
|
|
118308
|
+
registerMcpCommands(program2);
|
|
116262
118309
|
registerSecretsCommands(program2);
|
|
116263
118310
|
registerSandboxCommands(program2);
|
|
116264
118311
|
registerWorkflowCommands(program2);
|
|
@@ -116613,12 +118660,14 @@ function createProgram2() {
|
|
|
116613
118660
|
registerMonitorsCommands(program2);
|
|
116614
118661
|
registerWebhooksCommands(program2);
|
|
116615
118662
|
registerContainersCommands(program2);
|
|
118663
|
+
registerClusterCommands(program2);
|
|
116616
118664
|
registerTokensCommands(program2);
|
|
116617
118665
|
registerErrorsCommands(program2);
|
|
116618
118666
|
registerMetricsCommands(program2);
|
|
116619
118667
|
registerTracesCommands(program2);
|
|
116620
118668
|
registerFacetsCommands(program2);
|
|
116621
118669
|
registerOtelForwardCommands(program2);
|
|
118670
|
+
registerOtelCommands(program2);
|
|
116622
118671
|
registerKvCommands(program2);
|
|
116623
118672
|
registerFlagsCommands(program2);
|
|
116624
118673
|
registerDataCommands(program2);
|
|
@@ -116644,6 +118693,7 @@ function createProgram2() {
|
|
|
116644
118693
|
registerNotificationPreferencesCommands(program2);
|
|
116645
118694
|
registerSkillsCommands(program2);
|
|
116646
118695
|
registerMcpServersCommands(program2);
|
|
118696
|
+
registerMcpCommands(program2);
|
|
116647
118697
|
registerSecretsCommands(program2);
|
|
116648
118698
|
registerSandboxCommands(program2);
|
|
116649
118699
|
registerWorkflowCommands(program2);
|