@temps-sdk/cli 0.1.14 → 0.1.15
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 +334 -77
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -73824,26 +73824,76 @@ async function createNewServiceOfType(serviceType) {
|
|
|
73824
73824
|
async function create(options) {
|
|
73825
73825
|
await requireAuth();
|
|
73826
73826
|
await setupClient();
|
|
73827
|
+
const skipPrompts = options.yes ?? false;
|
|
73827
73828
|
newline();
|
|
73828
73829
|
console.log(colors.bold(`${icons.sparkles} Create New Project`));
|
|
73829
73830
|
console.log(colors.muted("─".repeat(40)));
|
|
73830
73831
|
newline();
|
|
73831
73832
|
try {
|
|
73832
|
-
|
|
73833
|
+
let connection;
|
|
73834
|
+
if (options.connection) {
|
|
73835
|
+
const connections = await fetchGitConnections();
|
|
73836
|
+
const connId = parseInt(options.connection, 10);
|
|
73837
|
+
connection = connections.find((c) => c.id === connId);
|
|
73838
|
+
if (!connection) {
|
|
73839
|
+
error(`Git connection with ID ${options.connection} not found.`);
|
|
73840
|
+
return;
|
|
73841
|
+
}
|
|
73842
|
+
info(`Using git connection: ${connection.account_name}`);
|
|
73843
|
+
} else {
|
|
73844
|
+
connection = await selectGitConnection();
|
|
73845
|
+
}
|
|
73833
73846
|
if (!connection) {
|
|
73834
73847
|
error("No git connection selected. Please set up a git provider first.");
|
|
73835
73848
|
return;
|
|
73836
73849
|
}
|
|
73837
|
-
|
|
73850
|
+
let repository;
|
|
73851
|
+
if (options.repo) {
|
|
73852
|
+
const parts = options.repo.split("/");
|
|
73853
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
73854
|
+
error("Repository must be in owner/name format (e.g., myorg/myrepo)");
|
|
73855
|
+
return;
|
|
73856
|
+
}
|
|
73857
|
+
repository = await findRepositoryByName(connection.id, parts[0], parts[1]);
|
|
73858
|
+
if (!repository) {
|
|
73859
|
+
error(`Repository "${options.repo}" not found in connection "${connection.account_name}".`);
|
|
73860
|
+
return;
|
|
73861
|
+
}
|
|
73862
|
+
info(`Using repository: ${repository.owner}/${repository.name}`);
|
|
73863
|
+
} else {
|
|
73864
|
+
repository = await selectRepository(connection.id);
|
|
73865
|
+
}
|
|
73838
73866
|
if (!repository) {
|
|
73839
73867
|
error("No repository selected.");
|
|
73840
73868
|
return;
|
|
73841
73869
|
}
|
|
73842
|
-
|
|
73843
|
-
|
|
73844
|
-
|
|
73845
|
-
|
|
73846
|
-
|
|
73870
|
+
let branch;
|
|
73871
|
+
if (options.branch) {
|
|
73872
|
+
branch = options.branch;
|
|
73873
|
+
info(`Using branch: ${branch}`);
|
|
73874
|
+
} else {
|
|
73875
|
+
branch = await selectBranch(connection.id, repository);
|
|
73876
|
+
}
|
|
73877
|
+
let preset;
|
|
73878
|
+
let directory;
|
|
73879
|
+
if (options.preset) {
|
|
73880
|
+
preset = options.preset;
|
|
73881
|
+
directory = options.directory || "./";
|
|
73882
|
+
info(`Using preset: ${preset}, directory: ${directory}`);
|
|
73883
|
+
} else {
|
|
73884
|
+
const detected = await detectAndSelectPreset(repository.id, branch);
|
|
73885
|
+
preset = detected.preset;
|
|
73886
|
+
directory = detected.directory;
|
|
73887
|
+
}
|
|
73888
|
+
let projectName;
|
|
73889
|
+
if (options.name) {
|
|
73890
|
+
projectName = options.name;
|
|
73891
|
+
info(`Using project name: ${projectName}`);
|
|
73892
|
+
} else {
|
|
73893
|
+
projectName = await configureProjectName(repository, directory);
|
|
73894
|
+
}
|
|
73895
|
+
const serviceIds = skipPrompts ? [] : await selectStorageServices();
|
|
73896
|
+
const envVars = skipPrompts ? [] : await configureEnvironmentVariables();
|
|
73847
73897
|
const project = await withSpinner("Creating project...", async () => {
|
|
73848
73898
|
const { data, error: apiError } = await createProject({
|
|
73849
73899
|
client,
|
|
@@ -73884,13 +73934,18 @@ async function create(options) {
|
|
|
73884
73934
|
keyValue("Environment Variables", `${envVars.length} configured`);
|
|
73885
73935
|
}
|
|
73886
73936
|
newline();
|
|
73887
|
-
|
|
73888
|
-
message: "Set as default project?",
|
|
73889
|
-
default: true
|
|
73890
|
-
});
|
|
73891
|
-
if (setDefault) {
|
|
73937
|
+
if (skipPrompts) {
|
|
73892
73938
|
config.set("defaultProject", project.slug);
|
|
73893
73939
|
success(`Default project set to "${project.slug}"`);
|
|
73940
|
+
} else {
|
|
73941
|
+
const setDefault = await promptConfirm({
|
|
73942
|
+
message: "Set as default project?",
|
|
73943
|
+
default: true
|
|
73944
|
+
});
|
|
73945
|
+
if (setDefault) {
|
|
73946
|
+
config.set("defaultProject", project.slug);
|
|
73947
|
+
success(`Default project set to "${project.slug}"`);
|
|
73948
|
+
}
|
|
73894
73949
|
}
|
|
73895
73950
|
newline();
|
|
73896
73951
|
info(`View your project: temps projects show ${project.slug}`);
|
|
@@ -74541,7 +74596,7 @@ async function updateConfigAction(options) {
|
|
|
74541
74596
|
function registerProjectsCommands(program2) {
|
|
74542
74597
|
const projects = program2.command("projects").alias("project").alias("p").description("Manage projects");
|
|
74543
74598
|
projects.command("list").alias("ls").description("List all projects").option("--json", "Output in JSON format").option("--page <n>", "Page number").option("--per-page <n>", "Items per page").action(list);
|
|
74544
|
-
projects.command("create").alias("new").description("Create a new project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("--repo <repository>", "Git
|
|
74599
|
+
projects.command("create").alias("new").description("Create a new project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("--repo <repository>", "Repository in owner/name format").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("-y, --yes", "Skip optional prompts (services, env vars, set-default)").action(create);
|
|
74545
74600
|
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);
|
|
74546
74601
|
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);
|
|
74547
74602
|
projects.command("settings").description("Update project settings (slug, attack mode, preview environments)").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("--json", "Output in JSON format").option("-y, --yes", "Skip prompts (for automation)").action(updateSettingsAction);
|
|
@@ -88955,6 +89010,9 @@ async function listPermissionsAction(options) {
|
|
|
88955
89010
|
// src/commands/errors/index.ts
|
|
88956
89011
|
init_sdk_gen();
|
|
88957
89012
|
init_output();
|
|
89013
|
+
import { readFile as readFile4 } from "node:fs/promises";
|
|
89014
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
89015
|
+
import { resolve as resolve5, basename as basename3 } from "node:path";
|
|
88958
89016
|
var ERROR_STATUSES = ["unresolved", "resolved", "ignored"];
|
|
88959
89017
|
function registerErrorsCommands(program2) {
|
|
88960
89018
|
const errors8 = program2.command("errors").alias("error").description("Manage error tracking and error groups");
|
|
@@ -88966,6 +89024,12 @@ function registerErrorsCommands(program2) {
|
|
|
88966
89024
|
errors8.command("stats").description("Get error statistics for a project").requiredOption("--project-id <id>", "Project ID").option("--json", "Output in JSON format").action(getErrorStatsAction);
|
|
88967
89025
|
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);
|
|
88968
89026
|
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);
|
|
89027
|
+
const sourcemaps = errors8.command("sourcemaps").alias("sm").description("Manage source maps for error symbolication");
|
|
89028
|
+
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(uploadSourceMap);
|
|
89029
|
+
sourcemaps.command("list").alias("ls").description("List source maps for a release").requiredOption("--project-id <id>", "Project ID").requiredOption("--release <version>", "Release version").option("--json", "Output in JSON format").action(listSourceMaps);
|
|
89030
|
+
sourcemaps.command("releases").description("List all releases that have source maps").requiredOption("--project-id <id>", "Project ID").option("--json", "Output in JSON format").action(listSourceMapReleases);
|
|
89031
|
+
sourcemaps.command("delete").description("Delete all source maps for a release").requiredOption("--project-id <id>", "Project ID").requiredOption("--release <version>", "Release version").action(deleteReleaseSourceMaps);
|
|
89032
|
+
sourcemaps.command("delete-one").description("Delete a specific source map by ID").requiredOption("--project-id <id>", "Project ID").requiredOption("--source-map-id <id>", "Source map ID").action(deleteSourceMap);
|
|
88969
89033
|
}
|
|
88970
89034
|
async function listErrorGroupsAction(options) {
|
|
88971
89035
|
await requireAuth();
|
|
@@ -89272,6 +89336,197 @@ async function getErrorTimelineAction(options) {
|
|
|
89272
89336
|
printTable(timeSeries, columns, { style: "minimal" });
|
|
89273
89337
|
newline();
|
|
89274
89338
|
}
|
|
89339
|
+
async function uploadSourceMap(options) {
|
|
89340
|
+
await requireAuth();
|
|
89341
|
+
await setupClient();
|
|
89342
|
+
const projectId = parseInt(options.projectId, 10);
|
|
89343
|
+
if (isNaN(projectId)) {
|
|
89344
|
+
warning("Invalid project ID");
|
|
89345
|
+
return;
|
|
89346
|
+
}
|
|
89347
|
+
const resolvedPath = resolve5(options.file);
|
|
89348
|
+
if (!existsSync8(resolvedPath)) {
|
|
89349
|
+
warning(`File does not exist: ${resolvedPath}`);
|
|
89350
|
+
return;
|
|
89351
|
+
}
|
|
89352
|
+
const filename = basename3(resolvedPath);
|
|
89353
|
+
startSpinner(`Uploading source map: ${filename}...`);
|
|
89354
|
+
const apiUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
89355
|
+
const apiKey = await credentials.getApiKey();
|
|
89356
|
+
const uploadUrl = `${apiUrl}/projects/${projectId}/releases/${encodeURIComponent(options.release)}/source-maps`;
|
|
89357
|
+
try {
|
|
89358
|
+
const fileData = await readFile4(resolvedPath);
|
|
89359
|
+
const uint8Data = new Uint8Array(fileData.buffer, fileData.byteOffset, fileData.byteLength);
|
|
89360
|
+
const formData = new FormData;
|
|
89361
|
+
formData.append("file", new Blob([uint8Data], { type: "application/json" }), filename);
|
|
89362
|
+
if (options.filePath) {
|
|
89363
|
+
formData.append("file_path", options.filePath);
|
|
89364
|
+
}
|
|
89365
|
+
if (options.dist) {
|
|
89366
|
+
formData.append("dist", options.dist);
|
|
89367
|
+
}
|
|
89368
|
+
const response = await fetch(uploadUrl, {
|
|
89369
|
+
method: "POST",
|
|
89370
|
+
headers: {
|
|
89371
|
+
Authorization: `Bearer ${apiKey}`
|
|
89372
|
+
},
|
|
89373
|
+
body: formData
|
|
89374
|
+
});
|
|
89375
|
+
if (!response.ok) {
|
|
89376
|
+
const errorText = await response.text();
|
|
89377
|
+
failSpinner(`Upload failed: ${response.status}`);
|
|
89378
|
+
warning(errorText);
|
|
89379
|
+
return;
|
|
89380
|
+
}
|
|
89381
|
+
const result = await response.json();
|
|
89382
|
+
succeedSpinner(`Source map uploaded (id=${result.id})`);
|
|
89383
|
+
newline();
|
|
89384
|
+
keyValue("ID", result.id.toString());
|
|
89385
|
+
keyValue("Release", result.release);
|
|
89386
|
+
keyValue("File Path", result.file_path);
|
|
89387
|
+
keyValue("Size", formatBytes3(result.size_bytes));
|
|
89388
|
+
if (result.dist)
|
|
89389
|
+
keyValue("Dist", result.dist);
|
|
89390
|
+
newline();
|
|
89391
|
+
} catch (err) {
|
|
89392
|
+
failSpinner("Upload failed");
|
|
89393
|
+
throw err;
|
|
89394
|
+
}
|
|
89395
|
+
}
|
|
89396
|
+
async function listSourceMaps(options) {
|
|
89397
|
+
await requireAuth();
|
|
89398
|
+
await setupClient();
|
|
89399
|
+
const projectId = parseInt(options.projectId, 10);
|
|
89400
|
+
if (isNaN(projectId)) {
|
|
89401
|
+
warning("Invalid project ID");
|
|
89402
|
+
return;
|
|
89403
|
+
}
|
|
89404
|
+
const apiUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
89405
|
+
const apiKey = await credentials.getApiKey();
|
|
89406
|
+
const url = `${apiUrl}/projects/${projectId}/releases/${encodeURIComponent(options.release)}/source-maps`;
|
|
89407
|
+
const result = await withSpinner("Fetching source maps...", async () => {
|
|
89408
|
+
const response = await fetch(url, {
|
|
89409
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
89410
|
+
});
|
|
89411
|
+
if (!response.ok) {
|
|
89412
|
+
const errorText = await response.text();
|
|
89413
|
+
throw new Error(`Request failed (${response.status}): ${errorText}`);
|
|
89414
|
+
}
|
|
89415
|
+
return response.json();
|
|
89416
|
+
});
|
|
89417
|
+
if (options.json) {
|
|
89418
|
+
json(result);
|
|
89419
|
+
return;
|
|
89420
|
+
}
|
|
89421
|
+
newline();
|
|
89422
|
+
header(`${icons.info} Source Maps for Release "${options.release}" (${result.total})`);
|
|
89423
|
+
if (result.source_maps.length === 0) {
|
|
89424
|
+
info("No source maps found for this release");
|
|
89425
|
+
newline();
|
|
89426
|
+
return;
|
|
89427
|
+
}
|
|
89428
|
+
const columns = [
|
|
89429
|
+
{ header: "ID", key: "id", width: 6 },
|
|
89430
|
+
{ header: "File Path", key: "file_path" },
|
|
89431
|
+
{ header: "Dist", accessor: (m) => m.dist ?? "-" },
|
|
89432
|
+
{ header: "Size", accessor: (m) => formatBytes3(m.size_bytes) },
|
|
89433
|
+
{ header: "Uploaded", accessor: (m) => formatRelativeTime(m.created_at) }
|
|
89434
|
+
];
|
|
89435
|
+
printTable(result.source_maps, columns, { style: "minimal" });
|
|
89436
|
+
newline();
|
|
89437
|
+
}
|
|
89438
|
+
async function listSourceMapReleases(options) {
|
|
89439
|
+
await requireAuth();
|
|
89440
|
+
await setupClient();
|
|
89441
|
+
const projectId = parseInt(options.projectId, 10);
|
|
89442
|
+
if (isNaN(projectId)) {
|
|
89443
|
+
warning("Invalid project ID");
|
|
89444
|
+
return;
|
|
89445
|
+
}
|
|
89446
|
+
const apiUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
89447
|
+
const apiKey = await credentials.getApiKey();
|
|
89448
|
+
const url = `${apiUrl}/projects/${projectId}/source-map-releases`;
|
|
89449
|
+
const result = await withSpinner("Fetching releases...", async () => {
|
|
89450
|
+
const response = await fetch(url, {
|
|
89451
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
89452
|
+
});
|
|
89453
|
+
if (!response.ok) {
|
|
89454
|
+
const errorText = await response.text();
|
|
89455
|
+
throw new Error(`Request failed (${response.status}): ${errorText}`);
|
|
89456
|
+
}
|
|
89457
|
+
return response.json();
|
|
89458
|
+
});
|
|
89459
|
+
if (options.json) {
|
|
89460
|
+
json(result);
|
|
89461
|
+
return;
|
|
89462
|
+
}
|
|
89463
|
+
newline();
|
|
89464
|
+
header(`${icons.info} Releases with Source Maps for Project ${projectId}`);
|
|
89465
|
+
if (result.releases.length === 0) {
|
|
89466
|
+
info("No releases with source maps found");
|
|
89467
|
+
newline();
|
|
89468
|
+
return;
|
|
89469
|
+
}
|
|
89470
|
+
for (const release of result.releases) {
|
|
89471
|
+
info(` ${colors.bold(release)}`);
|
|
89472
|
+
}
|
|
89473
|
+
newline();
|
|
89474
|
+
}
|
|
89475
|
+
async function deleteReleaseSourceMaps(options) {
|
|
89476
|
+
await requireAuth();
|
|
89477
|
+
await setupClient();
|
|
89478
|
+
const projectId = parseInt(options.projectId, 10);
|
|
89479
|
+
if (isNaN(projectId)) {
|
|
89480
|
+
warning("Invalid project ID");
|
|
89481
|
+
return;
|
|
89482
|
+
}
|
|
89483
|
+
const apiUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
89484
|
+
const apiKey = await credentials.getApiKey();
|
|
89485
|
+
const url = `${apiUrl}/projects/${projectId}/releases/${encodeURIComponent(options.release)}/source-maps`;
|
|
89486
|
+
const result = await withSpinner(`Deleting source maps for release "${options.release}"...`, async () => {
|
|
89487
|
+
const response = await fetch(url, {
|
|
89488
|
+
method: "DELETE",
|
|
89489
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
89490
|
+
});
|
|
89491
|
+
if (!response.ok) {
|
|
89492
|
+
const errorText = await response.text();
|
|
89493
|
+
throw new Error(`Request failed (${response.status}): ${errorText}`);
|
|
89494
|
+
}
|
|
89495
|
+
return response.json();
|
|
89496
|
+
});
|
|
89497
|
+
success(`Deleted ${result.deleted} source map(s) for release "${options.release}"`);
|
|
89498
|
+
}
|
|
89499
|
+
async function deleteSourceMap(options) {
|
|
89500
|
+
await requireAuth();
|
|
89501
|
+
await setupClient();
|
|
89502
|
+
const projectId = parseInt(options.projectId, 10);
|
|
89503
|
+
const sourceMapId = parseInt(options.sourceMapId, 10);
|
|
89504
|
+
if (isNaN(projectId) || isNaN(sourceMapId)) {
|
|
89505
|
+
warning("Invalid project ID or source map ID");
|
|
89506
|
+
return;
|
|
89507
|
+
}
|
|
89508
|
+
const apiUrl = normalizeApiUrl(config.get("apiUrl"));
|
|
89509
|
+
const apiKey = await credentials.getApiKey();
|
|
89510
|
+
const url = `${apiUrl}/projects/${projectId}/source-maps/${sourceMapId}`;
|
|
89511
|
+
await withSpinner(`Deleting source map #${sourceMapId}...`, async () => {
|
|
89512
|
+
const response = await fetch(url, {
|
|
89513
|
+
method: "DELETE",
|
|
89514
|
+
headers: { Authorization: `Bearer ${apiKey}` }
|
|
89515
|
+
});
|
|
89516
|
+
if (!response.ok && response.status !== 204) {
|
|
89517
|
+
const errorText = await response.text();
|
|
89518
|
+
throw new Error(`Request failed (${response.status}): ${errorText}`);
|
|
89519
|
+
}
|
|
89520
|
+
});
|
|
89521
|
+
success(`Source map #${sourceMapId} deleted`);
|
|
89522
|
+
}
|
|
89523
|
+
function formatBytes3(bytes) {
|
|
89524
|
+
if (bytes < 1024)
|
|
89525
|
+
return `${bytes} B`;
|
|
89526
|
+
if (bytes < 1024 * 1024)
|
|
89527
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
89528
|
+
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
|
|
89529
|
+
}
|
|
89275
89530
|
async function getErrorDashboardAction(options) {
|
|
89276
89531
|
await requireAuth();
|
|
89277
89532
|
await setupClient();
|
|
@@ -91589,8 +91844,8 @@ async function statsAction(options) {
|
|
|
91589
91844
|
{ header: "Requests", accessor: (s) => s.request_count.toString(), color: (v) => colors.bold(v) },
|
|
91590
91845
|
{ header: "Errors", accessor: (s) => s.error_count.toString(), color: (v) => parseInt(v, 10) > 0 ? colors.error(v) : colors.muted(v) },
|
|
91591
91846
|
{ header: "Avg Time", accessor: (s) => `${Math.round(s.avg_response_time_ms)}ms` },
|
|
91592
|
-
{ header: "Req Bytes", accessor: (s) =>
|
|
91593
|
-
{ header: "Res Bytes", accessor: (s) =>
|
|
91847
|
+
{ header: "Req Bytes", accessor: (s) => formatBytes4(s.total_request_bytes), color: (v) => colors.muted(v) },
|
|
91848
|
+
{ header: "Res Bytes", accessor: (s) => formatBytes4(s.total_response_bytes), color: (v) => colors.muted(v) }
|
|
91594
91849
|
];
|
|
91595
91850
|
printTable(result.stats, columns, { style: "minimal" });
|
|
91596
91851
|
const totalRequests = result.stats.reduce((sum, s) => sum + s.request_count, 0);
|
|
@@ -91644,8 +91899,8 @@ function printProxyLogDetail(log) {
|
|
|
91644
91899
|
newline();
|
|
91645
91900
|
header("Performance");
|
|
91646
91901
|
keyValue("Response Time", log.response_time_ms != null ? `${log.response_time_ms}ms` : "-");
|
|
91647
|
-
keyValue("Request Size", log.request_size_bytes != null ?
|
|
91648
|
-
keyValue("Response Size", log.response_size_bytes != null ?
|
|
91902
|
+
keyValue("Request Size", log.request_size_bytes != null ? formatBytes4(log.request_size_bytes) : "-");
|
|
91903
|
+
keyValue("Response Size", log.response_size_bytes != null ? formatBytes4(log.response_size_bytes) : "-");
|
|
91649
91904
|
if (log.cache_status) {
|
|
91650
91905
|
keyValue("Cache Status", log.cache_status);
|
|
91651
91906
|
}
|
|
@@ -91683,7 +91938,7 @@ function printProxyLogDetail(log) {
|
|
|
91683
91938
|
}
|
|
91684
91939
|
newline();
|
|
91685
91940
|
}
|
|
91686
|
-
function
|
|
91941
|
+
function formatBytes4(bytes) {
|
|
91687
91942
|
if (bytes === 0)
|
|
91688
91943
|
return "0 B";
|
|
91689
91944
|
const units = ["B", "KB", "MB", "GB"];
|
|
@@ -95130,7 +95385,7 @@ async function syncAndFindRepo(connectionId, owner, repo) {
|
|
|
95130
95385
|
client,
|
|
95131
95386
|
path: { connection_id: connectionId }
|
|
95132
95387
|
});
|
|
95133
|
-
await new Promise((
|
|
95388
|
+
await new Promise((resolve6) => setTimeout(resolve6, 1000));
|
|
95134
95389
|
return findRepoOnConnection(connectionId, owner, repo);
|
|
95135
95390
|
} catch {
|
|
95136
95391
|
return false;
|
|
@@ -95533,7 +95788,7 @@ async function syncAndFindRepo2(connectionId, owner, repo) {
|
|
|
95533
95788
|
client,
|
|
95534
95789
|
path: { connection_id: connectionId }
|
|
95535
95790
|
});
|
|
95536
|
-
await new Promise((
|
|
95791
|
+
await new Promise((resolve6) => setTimeout(resolve6, 1000));
|
|
95537
95792
|
return findRepoOnConnection2(connectionId, owner, repo);
|
|
95538
95793
|
} catch {
|
|
95539
95794
|
return false;
|
|
@@ -96915,10 +97170,10 @@ function registerLinkCommand(program2) {
|
|
|
96915
97170
|
}
|
|
96916
97171
|
|
|
96917
97172
|
// src/lib/detect-project.ts
|
|
96918
|
-
import { existsSync as
|
|
96919
|
-
import { readFile as
|
|
97173
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
97174
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
96920
97175
|
import { execSync } from "node:child_process";
|
|
96921
|
-
import { join as join3, basename as
|
|
97176
|
+
import { join as join3, basename as basename4 } from "node:path";
|
|
96922
97177
|
var PRESET_RULES = [
|
|
96923
97178
|
{
|
|
96924
97179
|
files: ["next.config.js", "next.config.ts", "next.config.mjs"],
|
|
@@ -96994,7 +97249,7 @@ var PRESET_RULES = [
|
|
|
96994
97249
|
function detectPreset(dir) {
|
|
96995
97250
|
const projectDir = dir ?? process.cwd();
|
|
96996
97251
|
for (const rule of PRESET_RULES) {
|
|
96997
|
-
const matched = rule.files.some((file) =>
|
|
97252
|
+
const matched = rule.files.some((file) => existsSync9(join3(projectDir, file)));
|
|
96998
97253
|
if (matched) {
|
|
96999
97254
|
return {
|
|
97000
97255
|
slug: rule.slug,
|
|
@@ -97003,14 +97258,14 @@ function detectPreset(dir) {
|
|
|
97003
97258
|
};
|
|
97004
97259
|
}
|
|
97005
97260
|
}
|
|
97006
|
-
if (
|
|
97261
|
+
if (existsSync9(join3(projectDir, "package.json"))) {
|
|
97007
97262
|
return {
|
|
97008
97263
|
slug: "nodejs",
|
|
97009
97264
|
label: "Node.js",
|
|
97010
97265
|
confidence: "low"
|
|
97011
97266
|
};
|
|
97012
97267
|
}
|
|
97013
|
-
if (
|
|
97268
|
+
if (existsSync9(join3(projectDir, "index.html"))) {
|
|
97014
97269
|
return {
|
|
97015
97270
|
slug: "static",
|
|
97016
97271
|
label: "Static Site",
|
|
@@ -97022,9 +97277,9 @@ function detectPreset(dir) {
|
|
|
97022
97277
|
async function refinePythonPreset(dir) {
|
|
97023
97278
|
const projectDir = dir ?? process.cwd();
|
|
97024
97279
|
const reqPath = join3(projectDir, "requirements.txt");
|
|
97025
|
-
if (
|
|
97280
|
+
if (existsSync9(reqPath)) {
|
|
97026
97281
|
try {
|
|
97027
|
-
const content = await
|
|
97282
|
+
const content = await readFile5(reqPath, "utf-8");
|
|
97028
97283
|
const lower = content.toLowerCase();
|
|
97029
97284
|
if (lower.includes("fastapi"))
|
|
97030
97285
|
return { slug: "fastapi", label: "FastAPI", confidence: "high" };
|
|
@@ -97035,9 +97290,9 @@ async function refinePythonPreset(dir) {
|
|
|
97035
97290
|
} catch {}
|
|
97036
97291
|
}
|
|
97037
97292
|
const pyprojectPath = join3(projectDir, "pyproject.toml");
|
|
97038
|
-
if (
|
|
97293
|
+
if (existsSync9(pyprojectPath)) {
|
|
97039
97294
|
try {
|
|
97040
|
-
const content = await
|
|
97295
|
+
const content = await readFile5(pyprojectPath, "utf-8");
|
|
97041
97296
|
const lower = content.toLowerCase();
|
|
97042
97297
|
if (lower.includes("fastapi"))
|
|
97043
97298
|
return { slug: "fastapi", label: "FastAPI", confidence: "high" };
|
|
@@ -97113,9 +97368,9 @@ async function detectServiceHints(dir) {
|
|
|
97113
97368
|
const envFiles = [".env", ".env.example", ".env.local", ".env.development"];
|
|
97114
97369
|
for (const envFile of envFiles) {
|
|
97115
97370
|
const envPath = join3(projectDir, envFile);
|
|
97116
|
-
if (
|
|
97371
|
+
if (existsSync9(envPath)) {
|
|
97117
97372
|
try {
|
|
97118
|
-
const content = await
|
|
97373
|
+
const content = await readFile5(envPath, "utf-8");
|
|
97119
97374
|
const upper = content.toUpperCase();
|
|
97120
97375
|
if (upper.includes("DATABASE_URL") || upper.includes("POSTGRES") || upper.includes("PG_")) {
|
|
97121
97376
|
hints.add("postgres");
|
|
@@ -97133,9 +97388,9 @@ async function detectServiceHints(dir) {
|
|
|
97133
97388
|
}
|
|
97134
97389
|
}
|
|
97135
97390
|
const prismaPath = join3(projectDir, "prisma", "schema.prisma");
|
|
97136
|
-
if (
|
|
97391
|
+
if (existsSync9(prismaPath)) {
|
|
97137
97392
|
try {
|
|
97138
|
-
const content = await
|
|
97393
|
+
const content = await readFile5(prismaPath, "utf-8");
|
|
97139
97394
|
if (content.includes("postgresql") || content.includes("postgres")) {
|
|
97140
97395
|
hints.add("postgres");
|
|
97141
97396
|
}
|
|
@@ -97146,7 +97401,7 @@ async function detectServiceHints(dir) {
|
|
|
97146
97401
|
}
|
|
97147
97402
|
const drizzleFiles = ["drizzle.config.ts", "drizzle.config.js"];
|
|
97148
97403
|
for (const drizzleFile of drizzleFiles) {
|
|
97149
|
-
if (
|
|
97404
|
+
if (existsSync9(join3(projectDir, drizzleFile))) {
|
|
97150
97405
|
hints.add("postgres");
|
|
97151
97406
|
break;
|
|
97152
97407
|
}
|
|
@@ -97156,9 +97411,9 @@ async function detectServiceHints(dir) {
|
|
|
97156
97411
|
async function suggestProjectName(dir) {
|
|
97157
97412
|
const projectDir = dir ?? process.cwd();
|
|
97158
97413
|
const pkgPath = join3(projectDir, "package.json");
|
|
97159
|
-
if (
|
|
97414
|
+
if (existsSync9(pkgPath)) {
|
|
97160
97415
|
try {
|
|
97161
|
-
const content = await
|
|
97416
|
+
const content = await readFile5(pkgPath, "utf-8");
|
|
97162
97417
|
const pkg = JSON.parse(content);
|
|
97163
97418
|
if (pkg.name && typeof pkg.name === "string") {
|
|
97164
97419
|
const name = pkg.name.replace(/^@[^/]+\//, "");
|
|
@@ -97172,7 +97427,7 @@ async function suggestProjectName(dir) {
|
|
|
97172
97427
|
if (remote) {
|
|
97173
97428
|
return sanitizeProjectName(remote.repo);
|
|
97174
97429
|
}
|
|
97175
|
-
return sanitizeProjectName(
|
|
97430
|
+
return sanitizeProjectName(basename4(projectDir));
|
|
97176
97431
|
}
|
|
97177
97432
|
function sanitizeProjectName(name) {
|
|
97178
97433
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
|
|
@@ -97182,8 +97437,8 @@ function sanitizeProjectName(name) {
|
|
|
97182
97437
|
init_prompts();
|
|
97183
97438
|
init_output();
|
|
97184
97439
|
init_sdk_gen();
|
|
97185
|
-
import { existsSync as
|
|
97186
|
-
import { resolve as
|
|
97440
|
+
import { existsSync as existsSync10, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
|
|
97441
|
+
import { resolve as resolve6, join as join4 } from "node:path";
|
|
97187
97442
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
97188
97443
|
async function runSetupWizard(options) {
|
|
97189
97444
|
newline();
|
|
@@ -97411,7 +97666,7 @@ async function runSetupWizard(options) {
|
|
|
97411
97666
|
deploymentId = deployment.id;
|
|
97412
97667
|
break;
|
|
97413
97668
|
}
|
|
97414
|
-
await new Promise((
|
|
97669
|
+
await new Promise((resolve7) => setTimeout(resolve7, 2000));
|
|
97415
97670
|
}
|
|
97416
97671
|
if (deploymentId) {
|
|
97417
97672
|
const result = await watchDeployment({
|
|
@@ -97436,7 +97691,7 @@ async function runSetupWizard(options) {
|
|
|
97436
97691
|
info("Building and deploying...");
|
|
97437
97692
|
newline();
|
|
97438
97693
|
try {
|
|
97439
|
-
const hasDockerfile =
|
|
97694
|
+
const hasDockerfile = existsSync10(resolve6("Dockerfile"));
|
|
97440
97695
|
let dockerfilePath;
|
|
97441
97696
|
let buildArgsList;
|
|
97442
97697
|
if (!hasDockerfile && presetSlug && presetSlug !== "dockerfile") {
|
|
@@ -97570,14 +97825,14 @@ async function selectPresetFromAll() {
|
|
|
97570
97825
|
});
|
|
97571
97826
|
}
|
|
97572
97827
|
function detectPackageManager(dir) {
|
|
97573
|
-
const projectDir = dir ?
|
|
97574
|
-
if (
|
|
97828
|
+
const projectDir = dir ? resolve6(dir) : process.cwd();
|
|
97829
|
+
if (existsSync10(join4(projectDir, "pnpm-lock.yaml")))
|
|
97575
97830
|
return "pnpm";
|
|
97576
|
-
if (
|
|
97831
|
+
if (existsSync10(join4(projectDir, "yarn.lock")))
|
|
97577
97832
|
return "yarn";
|
|
97578
|
-
if (
|
|
97833
|
+
if (existsSync10(join4(projectDir, "bun.lockb")) || existsSync10(join4(projectDir, "bun.lock")))
|
|
97579
97834
|
return "bun";
|
|
97580
|
-
if (
|
|
97835
|
+
if (existsSync10(join4(projectDir, "package-lock.json")))
|
|
97581
97836
|
return "npm";
|
|
97582
97837
|
return "npm";
|
|
97583
97838
|
}
|
|
@@ -97920,8 +98175,8 @@ function registerStatusCommand(program2) {
|
|
|
97920
98175
|
}
|
|
97921
98176
|
|
|
97922
98177
|
// src/config/instances.ts
|
|
97923
|
-
import { readFile as
|
|
97924
|
-
import { existsSync as
|
|
98178
|
+
import { readFile as readFile6, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
|
|
98179
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
97925
98180
|
import { dirname as dirname3 } from "node:path";
|
|
97926
98181
|
function getInstancesPath() {
|
|
97927
98182
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
@@ -97930,8 +98185,8 @@ function getInstancesPath() {
|
|
|
97930
98185
|
async function loadInstances() {
|
|
97931
98186
|
const path7 = getInstancesPath();
|
|
97932
98187
|
try {
|
|
97933
|
-
if (
|
|
97934
|
-
const content = await
|
|
98188
|
+
if (existsSync11(path7)) {
|
|
98189
|
+
const content = await readFile6(path7, "utf-8");
|
|
97935
98190
|
return JSON.parse(content);
|
|
97936
98191
|
}
|
|
97937
98192
|
} catch {}
|
|
@@ -98977,7 +99232,7 @@ function openBrowser2(url) {
|
|
|
98977
99232
|
} catch {}
|
|
98978
99233
|
}
|
|
98979
99234
|
function sleep(ms) {
|
|
98980
|
-
return new Promise((
|
|
99235
|
+
return new Promise((resolve8) => setTimeout(resolve8, ms));
|
|
98981
99236
|
}
|
|
98982
99237
|
async function cloudLogin() {
|
|
98983
99238
|
const cloudUrl = getCloudUrl();
|
|
@@ -99230,7 +99485,10 @@ function extractCommandInfo(cmd, parentName = "") {
|
|
|
99230
99485
|
usage: cmd.usage()
|
|
99231
99486
|
};
|
|
99232
99487
|
}
|
|
99233
|
-
function
|
|
99488
|
+
function escapeForMdx(text) {
|
|
99489
|
+
return text.replace(/('[^']*\{[^']*')/g, "`$1`");
|
|
99490
|
+
}
|
|
99491
|
+
function generateMarkdown(commands, level = 2, format2 = "markdown") {
|
|
99234
99492
|
let md = "";
|
|
99235
99493
|
for (const cmd of commands) {
|
|
99236
99494
|
const heading = "#".repeat(level);
|
|
@@ -99254,7 +99512,10 @@ function generateMarkdown(commands, level = 2) {
|
|
|
99254
99512
|
for (const opt of cmd.options) {
|
|
99255
99513
|
const defaultVal = opt.defaultValue !== undefined ? `\`${opt.defaultValue}\`` : "-";
|
|
99256
99514
|
const required = opt.required ? "Yes" : "No";
|
|
99257
|
-
|
|
99515
|
+
let escapedDesc = opt.description.replace(/\|/g, "\\|");
|
|
99516
|
+
if (format2 === "mdx") {
|
|
99517
|
+
escapedDesc = escapeForMdx(escapedDesc);
|
|
99518
|
+
}
|
|
99258
99519
|
md += `| \`${opt.flags}\` | ${escapedDesc} | ${defaultVal} | ${required} |
|
|
99259
99520
|
`;
|
|
99260
99521
|
}
|
|
@@ -99272,7 +99533,7 @@ function generateMarkdown(commands, level = 2) {
|
|
|
99272
99533
|
}
|
|
99273
99534
|
md += `
|
|
99274
99535
|
`;
|
|
99275
|
-
md += generateMarkdown(cmd.subcommands, level + 1);
|
|
99536
|
+
md += generateMarkdown(cmd.subcommands, level + 1, format2);
|
|
99276
99537
|
}
|
|
99277
99538
|
}
|
|
99278
99539
|
return md;
|
|
@@ -99294,11 +99555,7 @@ function generateHeader(format2 = "markdown") {
|
|
|
99294
99555
|
## Installation
|
|
99295
99556
|
|
|
99296
99557
|
\`\`\`bash
|
|
99297
|
-
|
|
99298
|
-
npm install -g @temps/cli
|
|
99299
|
-
|
|
99300
|
-
# Or use with npx
|
|
99301
|
-
npx @temps/cli [command]
|
|
99558
|
+
bunx @temps-sdk/cli [command]
|
|
99302
99559
|
\`\`\`
|
|
99303
99560
|
|
|
99304
99561
|
## Authentication
|
|
@@ -99307,10 +99564,10 @@ Before using most commands, you need to authenticate:
|
|
|
99307
99564
|
|
|
99308
99565
|
\`\`\`bash
|
|
99309
99566
|
# Login with API key
|
|
99310
|
-
temps login
|
|
99567
|
+
bunx @temps-sdk/cli login
|
|
99311
99568
|
|
|
99312
99569
|
# Or configure with wizard
|
|
99313
|
-
temps configure
|
|
99570
|
+
bunx @temps-sdk/cli configure
|
|
99314
99571
|
\`\`\`
|
|
99315
99572
|
|
|
99316
99573
|
## Global Options
|
|
@@ -99336,48 +99593,48 @@ function generateFooter() {
|
|
|
99336
99593
|
|
|
99337
99594
|
\`\`\`bash
|
|
99338
99595
|
# Login to Temps
|
|
99339
|
-
temps login
|
|
99596
|
+
bunx @temps-sdk/cli login
|
|
99340
99597
|
|
|
99341
99598
|
# Create a new project
|
|
99342
|
-
temps projects create --name my-app
|
|
99599
|
+
bunx @temps-sdk/cli projects create --name my-app
|
|
99343
99600
|
|
|
99344
99601
|
# Deploy to production
|
|
99345
|
-
temps deploy --project my-app --environment production
|
|
99602
|
+
bunx @temps-sdk/cli deploy --project my-app --environment production
|
|
99346
99603
|
|
|
99347
99604
|
# View deployment logs
|
|
99348
|
-
temps logs --project my-app --follow
|
|
99605
|
+
bunx @temps-sdk/cli logs --project my-app --follow
|
|
99349
99606
|
|
|
99350
99607
|
# Stream runtime container logs
|
|
99351
|
-
temps runtime-logs --project my-app
|
|
99608
|
+
bunx @temps-sdk/cli runtime-logs --project my-app
|
|
99352
99609
|
|
|
99353
99610
|
# List containers
|
|
99354
|
-
temps containers list --project-id 1 --environment-id 1
|
|
99611
|
+
bunx @temps-sdk/cli containers list --project-id 1 --environment-id 1
|
|
99355
99612
|
\`\`\`
|
|
99356
99613
|
|
|
99357
99614
|
### Managing Environments
|
|
99358
99615
|
|
|
99359
99616
|
\`\`\`bash
|
|
99360
99617
|
# List environments
|
|
99361
|
-
temps environments list --project my-app
|
|
99618
|
+
bunx @temps-sdk/cli environments list --project my-app
|
|
99362
99619
|
|
|
99363
99620
|
# Set environment variables
|
|
99364
|
-
temps environments vars set --project my-app --key DATABASE_URL --value "postgres://..."
|
|
99621
|
+
bunx @temps-sdk/cli environments vars set --project my-app --key DATABASE_URL --value "postgres://..."
|
|
99365
99622
|
|
|
99366
99623
|
# View environment variables
|
|
99367
|
-
temps environments vars list --project my-app
|
|
99624
|
+
bunx @temps-sdk/cli environments vars list --project my-app
|
|
99368
99625
|
\`\`\`
|
|
99369
99626
|
|
|
99370
99627
|
### Managing Domains
|
|
99371
99628
|
|
|
99372
99629
|
\`\`\`bash
|
|
99373
99630
|
# Add a custom domain
|
|
99374
|
-
temps domains add --project my-app --domain app.example.com
|
|
99631
|
+
bunx @temps-sdk/cli domains add --project my-app --domain app.example.com
|
|
99375
99632
|
|
|
99376
99633
|
# List domains
|
|
99377
|
-
temps domains list --project my-app
|
|
99634
|
+
bunx @temps-sdk/cli domains list --project my-app
|
|
99378
99635
|
|
|
99379
99636
|
# Remove a domain
|
|
99380
|
-
temps domains remove --project my-app --domain app.example.com
|
|
99637
|
+
bunx @temps-sdk/cli domains remove --project my-app --domain app.example.com
|
|
99381
99638
|
\`\`\`
|
|
99382
99639
|
|
|
99383
99640
|
## Environment Variables
|
|
@@ -99395,9 +99652,9 @@ The CLI respects the following environment variables:
|
|
|
99395
99652
|
|
|
99396
99653
|
Configuration is stored in:
|
|
99397
99654
|
- **Config file**: \`~/.temps/config.json\`
|
|
99398
|
-
- **Credentials**: \`~/.temps
|
|
99655
|
+
- **Credentials**: Stored securely in \`~/.temps/\` with restricted file permissions
|
|
99399
99656
|
|
|
99400
|
-
Use \`temps configure show\` to view current configuration.
|
|
99657
|
+
Use \`bunx @temps-sdk/cli configure show\` to view current configuration.
|
|
99401
99658
|
|
|
99402
99659
|
## Support
|
|
99403
99660
|
|
|
@@ -99414,7 +99671,7 @@ async function generateDocs(options) {
|
|
|
99414
99671
|
} else {
|
|
99415
99672
|
const format2 = options.format === "mdx" ? "mdx" : "markdown";
|
|
99416
99673
|
output = generateHeader(format2);
|
|
99417
|
-
output += generateMarkdown(commands);
|
|
99674
|
+
output += generateMarkdown(commands, 2, format2);
|
|
99418
99675
|
output += generateFooter();
|
|
99419
99676
|
}
|
|
99420
99677
|
if (options.output) {
|