@temps-sdk/cli 0.1.13 → 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.
Files changed (2) hide show
  1. package/dist/index.js +341 -78
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -73276,15 +73276,21 @@ function statusBadge(status) {
73276
73276
  active: source_default.green,
73277
73277
  success: source_default.green,
73278
73278
  healthy: source_default.green,
73279
+ completed: source_default.green,
73280
+ deployed: source_default.green,
73281
+ ready: source_default.green,
73279
73282
  pending: source_default.yellow,
73280
73283
  building: source_default.yellow,
73281
73284
  deploying: source_default.yellow,
73282
73285
  warning: source_default.yellow,
73286
+ built: source_default.yellow,
73283
73287
  stopped: source_default.gray,
73284
73288
  inactive: source_default.gray,
73289
+ paused: source_default.gray,
73285
73290
  failed: source_default.red,
73286
73291
  error: source_default.red,
73287
- unhealthy: source_default.red
73292
+ unhealthy: source_default.red,
73293
+ cancelled: source_default.red
73288
73294
  };
73289
73295
  const colorFn = statusColors[status.toLowerCase()] ?? source_default.white;
73290
73296
  return colorFn(`● ${status}`);
@@ -73818,26 +73824,76 @@ async function createNewServiceOfType(serviceType) {
73818
73824
  async function create(options) {
73819
73825
  await requireAuth();
73820
73826
  await setupClient();
73827
+ const skipPrompts = options.yes ?? false;
73821
73828
  newline();
73822
73829
  console.log(colors.bold(`${icons.sparkles} Create New Project`));
73823
73830
  console.log(colors.muted("─".repeat(40)));
73824
73831
  newline();
73825
73832
  try {
73826
- const connection = await selectGitConnection();
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
+ }
73827
73846
  if (!connection) {
73828
73847
  error("No git connection selected. Please set up a git provider first.");
73829
73848
  return;
73830
73849
  }
73831
- const repository = await selectRepository(connection.id);
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
+ }
73832
73866
  if (!repository) {
73833
73867
  error("No repository selected.");
73834
73868
  return;
73835
73869
  }
73836
- const branch = await selectBranch(connection.id, repository);
73837
- const { preset, directory } = await detectAndSelectPreset(repository.id, branch);
73838
- const projectName = await configureProjectName(repository, directory);
73839
- const serviceIds = await selectStorageServices();
73840
- const envVars = await configureEnvironmentVariables();
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();
73841
73897
  const project = await withSpinner("Creating project...", async () => {
73842
73898
  const { data, error: apiError } = await createProject({
73843
73899
  client,
@@ -73878,13 +73934,18 @@ async function create(options) {
73878
73934
  keyValue("Environment Variables", `${envVars.length} configured`);
73879
73935
  }
73880
73936
  newline();
73881
- const setDefault = await promptConfirm({
73882
- message: "Set as default project?",
73883
- default: true
73884
- });
73885
- if (setDefault) {
73937
+ if (skipPrompts) {
73886
73938
  config.set("defaultProject", project.slug);
73887
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
+ }
73888
73949
  }
73889
73950
  newline();
73890
73951
  info(`View your project: temps projects show ${project.slug}`);
@@ -74535,7 +74596,7 @@ async function updateConfigAction(options) {
74535
74596
  function registerProjectsCommands(program2) {
74536
74597
  const projects = program2.command("projects").alias("project").alias("p").description("Manage projects");
74537
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);
74538
- 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 repository URL").action(create);
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);
74539
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);
74540
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);
74541
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);
@@ -88949,6 +89010,9 @@ async function listPermissionsAction(options) {
88949
89010
  // src/commands/errors/index.ts
88950
89011
  init_sdk_gen();
88951
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";
88952
89016
  var ERROR_STATUSES = ["unresolved", "resolved", "ignored"];
88953
89017
  function registerErrorsCommands(program2) {
88954
89018
  const errors8 = program2.command("errors").alias("error").description("Manage error tracking and error groups");
@@ -88960,6 +89024,12 @@ function registerErrorsCommands(program2) {
88960
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);
88961
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);
88962
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);
88963
89033
  }
88964
89034
  async function listErrorGroupsAction(options) {
88965
89035
  await requireAuth();
@@ -89266,6 +89336,197 @@ async function getErrorTimelineAction(options) {
89266
89336
  printTable(timeSeries, columns, { style: "minimal" });
89267
89337
  newline();
89268
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
+ }
89269
89530
  async function getErrorDashboardAction(options) {
89270
89531
  await requireAuth();
89271
89532
  await setupClient();
@@ -91583,8 +91844,8 @@ async function statsAction(options) {
91583
91844
  { header: "Requests", accessor: (s) => s.request_count.toString(), color: (v) => colors.bold(v) },
91584
91845
  { header: "Errors", accessor: (s) => s.error_count.toString(), color: (v) => parseInt(v, 10) > 0 ? colors.error(v) : colors.muted(v) },
91585
91846
  { header: "Avg Time", accessor: (s) => `${Math.round(s.avg_response_time_ms)}ms` },
91586
- { header: "Req Bytes", accessor: (s) => formatBytes3(s.total_request_bytes), color: (v) => colors.muted(v) },
91587
- { header: "Res Bytes", accessor: (s) => formatBytes3(s.total_response_bytes), color: (v) => colors.muted(v) }
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) }
91588
91849
  ];
91589
91850
  printTable(result.stats, columns, { style: "minimal" });
91590
91851
  const totalRequests = result.stats.reduce((sum, s) => sum + s.request_count, 0);
@@ -91638,8 +91899,8 @@ function printProxyLogDetail(log) {
91638
91899
  newline();
91639
91900
  header("Performance");
91640
91901
  keyValue("Response Time", log.response_time_ms != null ? `${log.response_time_ms}ms` : "-");
91641
- keyValue("Request Size", log.request_size_bytes != null ? formatBytes3(log.request_size_bytes) : "-");
91642
- keyValue("Response Size", log.response_size_bytes != null ? formatBytes3(log.response_size_bytes) : "-");
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) : "-");
91643
91904
  if (log.cache_status) {
91644
91905
  keyValue("Cache Status", log.cache_status);
91645
91906
  }
@@ -91677,7 +91938,7 @@ function printProxyLogDetail(log) {
91677
91938
  }
91678
91939
  newline();
91679
91940
  }
91680
- function formatBytes3(bytes) {
91941
+ function formatBytes4(bytes) {
91681
91942
  if (bytes === 0)
91682
91943
  return "0 B";
91683
91944
  const units = ["B", "KB", "MB", "GB"];
@@ -95124,7 +95385,7 @@ async function syncAndFindRepo(connectionId, owner, repo) {
95124
95385
  client,
95125
95386
  path: { connection_id: connectionId }
95126
95387
  });
95127
- await new Promise((resolve5) => setTimeout(resolve5, 1000));
95388
+ await new Promise((resolve6) => setTimeout(resolve6, 1000));
95128
95389
  return findRepoOnConnection(connectionId, owner, repo);
95129
95390
  } catch {
95130
95391
  return false;
@@ -95527,7 +95788,7 @@ async function syncAndFindRepo2(connectionId, owner, repo) {
95527
95788
  client,
95528
95789
  path: { connection_id: connectionId }
95529
95790
  });
95530
- await new Promise((resolve5) => setTimeout(resolve5, 1000));
95791
+ await new Promise((resolve6) => setTimeout(resolve6, 1000));
95531
95792
  return findRepoOnConnection2(connectionId, owner, repo);
95532
95793
  } catch {
95533
95794
  return false;
@@ -96909,10 +97170,10 @@ function registerLinkCommand(program2) {
96909
97170
  }
96910
97171
 
96911
97172
  // src/lib/detect-project.ts
96912
- import { existsSync as existsSync8 } from "node:fs";
96913
- import { readFile as readFile4 } from "node:fs/promises";
97173
+ import { existsSync as existsSync9 } from "node:fs";
97174
+ import { readFile as readFile5 } from "node:fs/promises";
96914
97175
  import { execSync } from "node:child_process";
96915
- import { join as join3, basename as basename3 } from "node:path";
97176
+ import { join as join3, basename as basename4 } from "node:path";
96916
97177
  var PRESET_RULES = [
96917
97178
  {
96918
97179
  files: ["next.config.js", "next.config.ts", "next.config.mjs"],
@@ -96988,7 +97249,7 @@ var PRESET_RULES = [
96988
97249
  function detectPreset(dir) {
96989
97250
  const projectDir = dir ?? process.cwd();
96990
97251
  for (const rule of PRESET_RULES) {
96991
- const matched = rule.files.some((file) => existsSync8(join3(projectDir, file)));
97252
+ const matched = rule.files.some((file) => existsSync9(join3(projectDir, file)));
96992
97253
  if (matched) {
96993
97254
  return {
96994
97255
  slug: rule.slug,
@@ -96997,14 +97258,14 @@ function detectPreset(dir) {
96997
97258
  };
96998
97259
  }
96999
97260
  }
97000
- if (existsSync8(join3(projectDir, "package.json"))) {
97261
+ if (existsSync9(join3(projectDir, "package.json"))) {
97001
97262
  return {
97002
97263
  slug: "nodejs",
97003
97264
  label: "Node.js",
97004
97265
  confidence: "low"
97005
97266
  };
97006
97267
  }
97007
- if (existsSync8(join3(projectDir, "index.html"))) {
97268
+ if (existsSync9(join3(projectDir, "index.html"))) {
97008
97269
  return {
97009
97270
  slug: "static",
97010
97271
  label: "Static Site",
@@ -97016,9 +97277,9 @@ function detectPreset(dir) {
97016
97277
  async function refinePythonPreset(dir) {
97017
97278
  const projectDir = dir ?? process.cwd();
97018
97279
  const reqPath = join3(projectDir, "requirements.txt");
97019
- if (existsSync8(reqPath)) {
97280
+ if (existsSync9(reqPath)) {
97020
97281
  try {
97021
- const content = await readFile4(reqPath, "utf-8");
97282
+ const content = await readFile5(reqPath, "utf-8");
97022
97283
  const lower = content.toLowerCase();
97023
97284
  if (lower.includes("fastapi"))
97024
97285
  return { slug: "fastapi", label: "FastAPI", confidence: "high" };
@@ -97029,9 +97290,9 @@ async function refinePythonPreset(dir) {
97029
97290
  } catch {}
97030
97291
  }
97031
97292
  const pyprojectPath = join3(projectDir, "pyproject.toml");
97032
- if (existsSync8(pyprojectPath)) {
97293
+ if (existsSync9(pyprojectPath)) {
97033
97294
  try {
97034
- const content = await readFile4(pyprojectPath, "utf-8");
97295
+ const content = await readFile5(pyprojectPath, "utf-8");
97035
97296
  const lower = content.toLowerCase();
97036
97297
  if (lower.includes("fastapi"))
97037
97298
  return { slug: "fastapi", label: "FastAPI", confidence: "high" };
@@ -97107,9 +97368,9 @@ async function detectServiceHints(dir) {
97107
97368
  const envFiles = [".env", ".env.example", ".env.local", ".env.development"];
97108
97369
  for (const envFile of envFiles) {
97109
97370
  const envPath = join3(projectDir, envFile);
97110
- if (existsSync8(envPath)) {
97371
+ if (existsSync9(envPath)) {
97111
97372
  try {
97112
- const content = await readFile4(envPath, "utf-8");
97373
+ const content = await readFile5(envPath, "utf-8");
97113
97374
  const upper = content.toUpperCase();
97114
97375
  if (upper.includes("DATABASE_URL") || upper.includes("POSTGRES") || upper.includes("PG_")) {
97115
97376
  hints.add("postgres");
@@ -97127,9 +97388,9 @@ async function detectServiceHints(dir) {
97127
97388
  }
97128
97389
  }
97129
97390
  const prismaPath = join3(projectDir, "prisma", "schema.prisma");
97130
- if (existsSync8(prismaPath)) {
97391
+ if (existsSync9(prismaPath)) {
97131
97392
  try {
97132
- const content = await readFile4(prismaPath, "utf-8");
97393
+ const content = await readFile5(prismaPath, "utf-8");
97133
97394
  if (content.includes("postgresql") || content.includes("postgres")) {
97134
97395
  hints.add("postgres");
97135
97396
  }
@@ -97140,7 +97401,7 @@ async function detectServiceHints(dir) {
97140
97401
  }
97141
97402
  const drizzleFiles = ["drizzle.config.ts", "drizzle.config.js"];
97142
97403
  for (const drizzleFile of drizzleFiles) {
97143
- if (existsSync8(join3(projectDir, drizzleFile))) {
97404
+ if (existsSync9(join3(projectDir, drizzleFile))) {
97144
97405
  hints.add("postgres");
97145
97406
  break;
97146
97407
  }
@@ -97150,9 +97411,9 @@ async function detectServiceHints(dir) {
97150
97411
  async function suggestProjectName(dir) {
97151
97412
  const projectDir = dir ?? process.cwd();
97152
97413
  const pkgPath = join3(projectDir, "package.json");
97153
- if (existsSync8(pkgPath)) {
97414
+ if (existsSync9(pkgPath)) {
97154
97415
  try {
97155
- const content = await readFile4(pkgPath, "utf-8");
97416
+ const content = await readFile5(pkgPath, "utf-8");
97156
97417
  const pkg = JSON.parse(content);
97157
97418
  if (pkg.name && typeof pkg.name === "string") {
97158
97419
  const name = pkg.name.replace(/^@[^/]+\//, "");
@@ -97166,7 +97427,7 @@ async function suggestProjectName(dir) {
97166
97427
  if (remote) {
97167
97428
  return sanitizeProjectName(remote.repo);
97168
97429
  }
97169
- return sanitizeProjectName(basename3(projectDir));
97430
+ return sanitizeProjectName(basename4(projectDir));
97170
97431
  }
97171
97432
  function sanitizeProjectName(name) {
97172
97433
  return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
@@ -97176,8 +97437,8 @@ function sanitizeProjectName(name) {
97176
97437
  init_prompts();
97177
97438
  init_output();
97178
97439
  init_sdk_gen();
97179
- import { existsSync as existsSync9, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
97180
- import { resolve as resolve5, join as join4 } from "node:path";
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";
97181
97442
  import { tmpdir as tmpdir3 } from "node:os";
97182
97443
  async function runSetupWizard(options) {
97183
97444
  newline();
@@ -97405,7 +97666,7 @@ async function runSetupWizard(options) {
97405
97666
  deploymentId = deployment.id;
97406
97667
  break;
97407
97668
  }
97408
- await new Promise((resolve6) => setTimeout(resolve6, 2000));
97669
+ await new Promise((resolve7) => setTimeout(resolve7, 2000));
97409
97670
  }
97410
97671
  if (deploymentId) {
97411
97672
  const result = await watchDeployment({
@@ -97430,7 +97691,7 @@ async function runSetupWizard(options) {
97430
97691
  info("Building and deploying...");
97431
97692
  newline();
97432
97693
  try {
97433
- const hasDockerfile = existsSync9(resolve5("Dockerfile"));
97694
+ const hasDockerfile = existsSync10(resolve6("Dockerfile"));
97434
97695
  let dockerfilePath;
97435
97696
  let buildArgsList;
97436
97697
  if (!hasDockerfile && presetSlug && presetSlug !== "dockerfile") {
@@ -97564,14 +97825,14 @@ async function selectPresetFromAll() {
97564
97825
  });
97565
97826
  }
97566
97827
  function detectPackageManager(dir) {
97567
- const projectDir = dir ? resolve5(dir) : process.cwd();
97568
- if (existsSync9(join4(projectDir, "pnpm-lock.yaml")))
97828
+ const projectDir = dir ? resolve6(dir) : process.cwd();
97829
+ if (existsSync10(join4(projectDir, "pnpm-lock.yaml")))
97569
97830
  return "pnpm";
97570
- if (existsSync9(join4(projectDir, "yarn.lock")))
97831
+ if (existsSync10(join4(projectDir, "yarn.lock")))
97571
97832
  return "yarn";
97572
- if (existsSync9(join4(projectDir, "bun.lockb")) || existsSync9(join4(projectDir, "bun.lock")))
97833
+ if (existsSync10(join4(projectDir, "bun.lockb")) || existsSync10(join4(projectDir, "bun.lock")))
97573
97834
  return "bun";
97574
- if (existsSync9(join4(projectDir, "package-lock.json")))
97835
+ if (existsSync10(join4(projectDir, "package-lock.json")))
97575
97836
  return "npm";
97576
97837
  return "npm";
97577
97838
  }
@@ -97914,8 +98175,8 @@ function registerStatusCommand(program2) {
97914
98175
  }
97915
98176
 
97916
98177
  // src/config/instances.ts
97917
- import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
97918
- import { existsSync as existsSync10 } from "node:fs";
98178
+ import { readFile as readFile6, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
98179
+ import { existsSync as existsSync11 } from "node:fs";
97919
98180
  import { dirname as dirname3 } from "node:path";
97920
98181
  function getInstancesPath() {
97921
98182
  const home = process.env.HOME || process.env.USERPROFILE || "~";
@@ -97924,8 +98185,8 @@ function getInstancesPath() {
97924
98185
  async function loadInstances() {
97925
98186
  const path7 = getInstancesPath();
97926
98187
  try {
97927
- if (existsSync10(path7)) {
97928
- const content = await readFile5(path7, "utf-8");
98188
+ if (existsSync11(path7)) {
98189
+ const content = await readFile6(path7, "utf-8");
97929
98190
  return JSON.parse(content);
97930
98191
  }
97931
98192
  } catch {}
@@ -98971,7 +99232,7 @@ function openBrowser2(url) {
98971
99232
  } catch {}
98972
99233
  }
98973
99234
  function sleep(ms) {
98974
- return new Promise((resolve7) => setTimeout(resolve7, ms));
99235
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
98975
99236
  }
98976
99237
  async function cloudLogin() {
98977
99238
  const cloudUrl = getCloudUrl();
@@ -99224,7 +99485,10 @@ function extractCommandInfo(cmd, parentName = "") {
99224
99485
  usage: cmd.usage()
99225
99486
  };
99226
99487
  }
99227
- function generateMarkdown(commands, level = 2) {
99488
+ function escapeForMdx(text) {
99489
+ return text.replace(/('[^']*\{[^']*')/g, "`$1`");
99490
+ }
99491
+ function generateMarkdown(commands, level = 2, format2 = "markdown") {
99228
99492
  let md = "";
99229
99493
  for (const cmd of commands) {
99230
99494
  const heading = "#".repeat(level);
@@ -99248,7 +99512,10 @@ function generateMarkdown(commands, level = 2) {
99248
99512
  for (const opt of cmd.options) {
99249
99513
  const defaultVal = opt.defaultValue !== undefined ? `\`${opt.defaultValue}\`` : "-";
99250
99514
  const required = opt.required ? "Yes" : "No";
99251
- const escapedDesc = opt.description.replace(/\|/g, "\\|");
99515
+ let escapedDesc = opt.description.replace(/\|/g, "\\|");
99516
+ if (format2 === "mdx") {
99517
+ escapedDesc = escapeForMdx(escapedDesc);
99518
+ }
99252
99519
  md += `| \`${opt.flags}\` | ${escapedDesc} | ${defaultVal} | ${required} |
99253
99520
  `;
99254
99521
  }
@@ -99266,7 +99533,7 @@ function generateMarkdown(commands, level = 2) {
99266
99533
  }
99267
99534
  md += `
99268
99535
  `;
99269
- md += generateMarkdown(cmd.subcommands, level + 1);
99536
+ md += generateMarkdown(cmd.subcommands, level + 1, format2);
99270
99537
  }
99271
99538
  }
99272
99539
  return md;
@@ -99288,11 +99555,7 @@ function generateHeader(format2 = "markdown") {
99288
99555
  ## Installation
99289
99556
 
99290
99557
  \`\`\`bash
99291
- # Install globally
99292
- npm install -g @temps/cli
99293
-
99294
- # Or use with npx
99295
- npx @temps/cli [command]
99558
+ bunx @temps-sdk/cli [command]
99296
99559
  \`\`\`
99297
99560
 
99298
99561
  ## Authentication
@@ -99301,10 +99564,10 @@ Before using most commands, you need to authenticate:
99301
99564
 
99302
99565
  \`\`\`bash
99303
99566
  # Login with API key
99304
- temps login
99567
+ bunx @temps-sdk/cli login
99305
99568
 
99306
99569
  # Or configure with wizard
99307
- temps configure
99570
+ bunx @temps-sdk/cli configure
99308
99571
  \`\`\`
99309
99572
 
99310
99573
  ## Global Options
@@ -99330,48 +99593,48 @@ function generateFooter() {
99330
99593
 
99331
99594
  \`\`\`bash
99332
99595
  # Login to Temps
99333
- temps login
99596
+ bunx @temps-sdk/cli login
99334
99597
 
99335
99598
  # Create a new project
99336
- temps projects create --name my-app
99599
+ bunx @temps-sdk/cli projects create --name my-app
99337
99600
 
99338
99601
  # Deploy to production
99339
- temps deploy --project my-app --environment production
99602
+ bunx @temps-sdk/cli deploy --project my-app --environment production
99340
99603
 
99341
99604
  # View deployment logs
99342
- temps logs --project my-app --follow
99605
+ bunx @temps-sdk/cli logs --project my-app --follow
99343
99606
 
99344
99607
  # Stream runtime container logs
99345
- temps runtime-logs --project my-app
99608
+ bunx @temps-sdk/cli runtime-logs --project my-app
99346
99609
 
99347
99610
  # List containers
99348
- temps containers list --project-id 1 --environment-id 1
99611
+ bunx @temps-sdk/cli containers list --project-id 1 --environment-id 1
99349
99612
  \`\`\`
99350
99613
 
99351
99614
  ### Managing Environments
99352
99615
 
99353
99616
  \`\`\`bash
99354
99617
  # List environments
99355
- temps environments list --project my-app
99618
+ bunx @temps-sdk/cli environments list --project my-app
99356
99619
 
99357
99620
  # Set environment variables
99358
- 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://..."
99359
99622
 
99360
99623
  # View environment variables
99361
- temps environments vars list --project my-app
99624
+ bunx @temps-sdk/cli environments vars list --project my-app
99362
99625
  \`\`\`
99363
99626
 
99364
99627
  ### Managing Domains
99365
99628
 
99366
99629
  \`\`\`bash
99367
99630
  # Add a custom domain
99368
- temps domains add --project my-app --domain app.example.com
99631
+ bunx @temps-sdk/cli domains add --project my-app --domain app.example.com
99369
99632
 
99370
99633
  # List domains
99371
- temps domains list --project my-app
99634
+ bunx @temps-sdk/cli domains list --project my-app
99372
99635
 
99373
99636
  # Remove a domain
99374
- temps domains remove --project my-app --domain app.example.com
99637
+ bunx @temps-sdk/cli domains remove --project my-app --domain app.example.com
99375
99638
  \`\`\`
99376
99639
 
99377
99640
  ## Environment Variables
@@ -99389,9 +99652,9 @@ The CLI respects the following environment variables:
99389
99652
 
99390
99653
  Configuration is stored in:
99391
99654
  - **Config file**: \`~/.temps/config.json\`
99392
- - **Credentials**: \`~/.temps/.secrets\`
99655
+ - **Credentials**: Stored securely in \`~/.temps/\` with restricted file permissions
99393
99656
 
99394
- Use \`temps configure show\` to view current configuration.
99657
+ Use \`bunx @temps-sdk/cli configure show\` to view current configuration.
99395
99658
 
99396
99659
  ## Support
99397
99660
 
@@ -99408,7 +99671,7 @@ async function generateDocs(options) {
99408
99671
  } else {
99409
99672
  const format2 = options.format === "mdx" ? "mdx" : "markdown";
99410
99673
  output = generateHeader(format2);
99411
- output += generateMarkdown(commands);
99674
+ output += generateMarkdown(commands, 2, format2);
99412
99675
  output += generateFooter();
99413
99676
  }
99414
99677
  if (options.output) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temps-sdk/cli",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "CLI for Temps deployment platform",
5
5
  "type": "module",
6
6
  "bin": {