@temps-sdk/cli 0.1.14 → 0.1.16

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 +353 -77
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -73824,26 +73824,95 @@ 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
- 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 if (options.repo && skipPrompts) {
73844
+ const parts = options.repo.split("/");
73845
+ if (parts.length !== 2 || !parts[0] || !parts[1]) {
73846
+ error("Repository must be in owner/name format (e.g., myorg/myrepo)");
73847
+ return;
73848
+ }
73849
+ const connections = await fetchGitConnections();
73850
+ for (const conn of connections) {
73851
+ const repo = await findRepositoryByName(conn.id, parts[0], parts[1]);
73852
+ if (repo) {
73853
+ connection = conn;
73854
+ info(`Auto-selected git connection: ${conn.account_name}`);
73855
+ break;
73856
+ }
73857
+ }
73858
+ if (!connection) {
73859
+ error(`Repository "${options.repo}" not found in any git connection.`);
73860
+ return;
73861
+ }
73862
+ } else {
73863
+ connection = await selectGitConnection();
73864
+ }
73833
73865
  if (!connection) {
73834
73866
  error("No git connection selected. Please set up a git provider first.");
73835
73867
  return;
73836
73868
  }
73837
- const repository = await selectRepository(connection.id);
73869
+ let repository;
73870
+ if (options.repo) {
73871
+ const parts = options.repo.split("/");
73872
+ if (parts.length !== 2 || !parts[0] || !parts[1]) {
73873
+ error("Repository must be in owner/name format (e.g., myorg/myrepo)");
73874
+ return;
73875
+ }
73876
+ repository = await findRepositoryByName(connection.id, parts[0], parts[1]);
73877
+ if (!repository) {
73878
+ error(`Repository "${options.repo}" not found in connection "${connection.account_name}".`);
73879
+ return;
73880
+ }
73881
+ info(`Using repository: ${repository.owner}/${repository.name}`);
73882
+ } else {
73883
+ repository = await selectRepository(connection.id);
73884
+ }
73838
73885
  if (!repository) {
73839
73886
  error("No repository selected.");
73840
73887
  return;
73841
73888
  }
73842
- const branch = await selectBranch(connection.id, repository);
73843
- const { preset, directory } = await detectAndSelectPreset(repository.id, branch);
73844
- const projectName = await configureProjectName(repository, directory);
73845
- const serviceIds = await selectStorageServices();
73846
- const envVars = await configureEnvironmentVariables();
73889
+ let branch;
73890
+ if (options.branch) {
73891
+ branch = options.branch;
73892
+ info(`Using branch: ${branch}`);
73893
+ } else {
73894
+ branch = await selectBranch(connection.id, repository);
73895
+ }
73896
+ let preset;
73897
+ let directory;
73898
+ if (options.preset) {
73899
+ preset = options.preset;
73900
+ directory = options.directory || "./";
73901
+ info(`Using preset: ${preset}, directory: ${directory}`);
73902
+ } else {
73903
+ const detected = await detectAndSelectPreset(repository.id, branch);
73904
+ preset = detected.preset;
73905
+ directory = detected.directory;
73906
+ }
73907
+ let projectName;
73908
+ if (options.name) {
73909
+ projectName = options.name;
73910
+ info(`Using project name: ${projectName}`);
73911
+ } else {
73912
+ projectName = await configureProjectName(repository, directory);
73913
+ }
73914
+ const serviceIds = skipPrompts ? [] : await selectStorageServices();
73915
+ const envVars = skipPrompts ? [] : await configureEnvironmentVariables();
73847
73916
  const project = await withSpinner("Creating project...", async () => {
73848
73917
  const { data, error: apiError } = await createProject({
73849
73918
  client,
@@ -73884,13 +73953,18 @@ async function create(options) {
73884
73953
  keyValue("Environment Variables", `${envVars.length} configured`);
73885
73954
  }
73886
73955
  newline();
73887
- const setDefault = await promptConfirm({
73888
- message: "Set as default project?",
73889
- default: true
73890
- });
73891
- if (setDefault) {
73956
+ if (skipPrompts) {
73892
73957
  config.set("defaultProject", project.slug);
73893
73958
  success(`Default project set to "${project.slug}"`);
73959
+ } else {
73960
+ const setDefault = await promptConfirm({
73961
+ message: "Set as default project?",
73962
+ default: true
73963
+ });
73964
+ if (setDefault) {
73965
+ config.set("defaultProject", project.slug);
73966
+ success(`Default project set to "${project.slug}"`);
73967
+ }
73894
73968
  }
73895
73969
  newline();
73896
73970
  info(`View your project: temps projects show ${project.slug}`);
@@ -74541,7 +74615,7 @@ async function updateConfigAction(options) {
74541
74615
  function registerProjectsCommands(program2) {
74542
74616
  const projects = program2.command("projects").alias("project").alias("p").description("Manage projects");
74543
74617
  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 repository URL").action(create);
74618
+ 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
74619
  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
74620
  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
74621
  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 +89029,9 @@ async function listPermissionsAction(options) {
88955
89029
  // src/commands/errors/index.ts
88956
89030
  init_sdk_gen();
88957
89031
  init_output();
89032
+ import { readFile as readFile4 } from "node:fs/promises";
89033
+ import { existsSync as existsSync8 } from "node:fs";
89034
+ import { resolve as resolve5, basename as basename3 } from "node:path";
88958
89035
  var ERROR_STATUSES = ["unresolved", "resolved", "ignored"];
88959
89036
  function registerErrorsCommands(program2) {
88960
89037
  const errors8 = program2.command("errors").alias("error").description("Manage error tracking and error groups");
@@ -88966,6 +89043,12 @@ function registerErrorsCommands(program2) {
88966
89043
  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
89044
  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
89045
  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);
89046
+ const sourcemaps = errors8.command("sourcemaps").alias("sm").description("Manage source maps for error symbolication");
89047
+ 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);
89048
+ 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);
89049
+ 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);
89050
+ sourcemaps.command("delete").description("Delete all source maps for a release").requiredOption("--project-id <id>", "Project ID").requiredOption("--release <version>", "Release version").action(deleteReleaseSourceMaps);
89051
+ 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
89052
  }
88970
89053
  async function listErrorGroupsAction(options) {
88971
89054
  await requireAuth();
@@ -89272,6 +89355,197 @@ async function getErrorTimelineAction(options) {
89272
89355
  printTable(timeSeries, columns, { style: "minimal" });
89273
89356
  newline();
89274
89357
  }
89358
+ async function uploadSourceMap(options) {
89359
+ await requireAuth();
89360
+ await setupClient();
89361
+ const projectId = parseInt(options.projectId, 10);
89362
+ if (isNaN(projectId)) {
89363
+ warning("Invalid project ID");
89364
+ return;
89365
+ }
89366
+ const resolvedPath = resolve5(options.file);
89367
+ if (!existsSync8(resolvedPath)) {
89368
+ warning(`File does not exist: ${resolvedPath}`);
89369
+ return;
89370
+ }
89371
+ const filename = basename3(resolvedPath);
89372
+ startSpinner(`Uploading source map: ${filename}...`);
89373
+ const apiUrl = normalizeApiUrl(config.get("apiUrl"));
89374
+ const apiKey = await credentials.getApiKey();
89375
+ const uploadUrl = `${apiUrl}/projects/${projectId}/releases/${encodeURIComponent(options.release)}/source-maps`;
89376
+ try {
89377
+ const fileData = await readFile4(resolvedPath);
89378
+ const uint8Data = new Uint8Array(fileData.buffer, fileData.byteOffset, fileData.byteLength);
89379
+ const formData = new FormData;
89380
+ formData.append("file", new Blob([uint8Data], { type: "application/json" }), filename);
89381
+ if (options.filePath) {
89382
+ formData.append("file_path", options.filePath);
89383
+ }
89384
+ if (options.dist) {
89385
+ formData.append("dist", options.dist);
89386
+ }
89387
+ const response = await fetch(uploadUrl, {
89388
+ method: "POST",
89389
+ headers: {
89390
+ Authorization: `Bearer ${apiKey}`
89391
+ },
89392
+ body: formData
89393
+ });
89394
+ if (!response.ok) {
89395
+ const errorText = await response.text();
89396
+ failSpinner(`Upload failed: ${response.status}`);
89397
+ warning(errorText);
89398
+ return;
89399
+ }
89400
+ const result = await response.json();
89401
+ succeedSpinner(`Source map uploaded (id=${result.id})`);
89402
+ newline();
89403
+ keyValue("ID", result.id.toString());
89404
+ keyValue("Release", result.release);
89405
+ keyValue("File Path", result.file_path);
89406
+ keyValue("Size", formatBytes3(result.size_bytes));
89407
+ if (result.dist)
89408
+ keyValue("Dist", result.dist);
89409
+ newline();
89410
+ } catch (err) {
89411
+ failSpinner("Upload failed");
89412
+ throw err;
89413
+ }
89414
+ }
89415
+ async function listSourceMaps(options) {
89416
+ await requireAuth();
89417
+ await setupClient();
89418
+ const projectId = parseInt(options.projectId, 10);
89419
+ if (isNaN(projectId)) {
89420
+ warning("Invalid project ID");
89421
+ return;
89422
+ }
89423
+ const apiUrl = normalizeApiUrl(config.get("apiUrl"));
89424
+ const apiKey = await credentials.getApiKey();
89425
+ const url = `${apiUrl}/projects/${projectId}/releases/${encodeURIComponent(options.release)}/source-maps`;
89426
+ const result = await withSpinner("Fetching source maps...", async () => {
89427
+ const response = await fetch(url, {
89428
+ headers: { Authorization: `Bearer ${apiKey}` }
89429
+ });
89430
+ if (!response.ok) {
89431
+ const errorText = await response.text();
89432
+ throw new Error(`Request failed (${response.status}): ${errorText}`);
89433
+ }
89434
+ return response.json();
89435
+ });
89436
+ if (options.json) {
89437
+ json(result);
89438
+ return;
89439
+ }
89440
+ newline();
89441
+ header(`${icons.info} Source Maps for Release "${options.release}" (${result.total})`);
89442
+ if (result.source_maps.length === 0) {
89443
+ info("No source maps found for this release");
89444
+ newline();
89445
+ return;
89446
+ }
89447
+ const columns = [
89448
+ { header: "ID", key: "id", width: 6 },
89449
+ { header: "File Path", key: "file_path" },
89450
+ { header: "Dist", accessor: (m) => m.dist ?? "-" },
89451
+ { header: "Size", accessor: (m) => formatBytes3(m.size_bytes) },
89452
+ { header: "Uploaded", accessor: (m) => formatRelativeTime(m.created_at) }
89453
+ ];
89454
+ printTable(result.source_maps, columns, { style: "minimal" });
89455
+ newline();
89456
+ }
89457
+ async function listSourceMapReleases(options) {
89458
+ await requireAuth();
89459
+ await setupClient();
89460
+ const projectId = parseInt(options.projectId, 10);
89461
+ if (isNaN(projectId)) {
89462
+ warning("Invalid project ID");
89463
+ return;
89464
+ }
89465
+ const apiUrl = normalizeApiUrl(config.get("apiUrl"));
89466
+ const apiKey = await credentials.getApiKey();
89467
+ const url = `${apiUrl}/projects/${projectId}/source-map-releases`;
89468
+ const result = await withSpinner("Fetching releases...", async () => {
89469
+ const response = await fetch(url, {
89470
+ headers: { Authorization: `Bearer ${apiKey}` }
89471
+ });
89472
+ if (!response.ok) {
89473
+ const errorText = await response.text();
89474
+ throw new Error(`Request failed (${response.status}): ${errorText}`);
89475
+ }
89476
+ return response.json();
89477
+ });
89478
+ if (options.json) {
89479
+ json(result);
89480
+ return;
89481
+ }
89482
+ newline();
89483
+ header(`${icons.info} Releases with Source Maps for Project ${projectId}`);
89484
+ if (result.releases.length === 0) {
89485
+ info("No releases with source maps found");
89486
+ newline();
89487
+ return;
89488
+ }
89489
+ for (const release of result.releases) {
89490
+ info(` ${colors.bold(release)}`);
89491
+ }
89492
+ newline();
89493
+ }
89494
+ async function deleteReleaseSourceMaps(options) {
89495
+ await requireAuth();
89496
+ await setupClient();
89497
+ const projectId = parseInt(options.projectId, 10);
89498
+ if (isNaN(projectId)) {
89499
+ warning("Invalid project ID");
89500
+ return;
89501
+ }
89502
+ const apiUrl = normalizeApiUrl(config.get("apiUrl"));
89503
+ const apiKey = await credentials.getApiKey();
89504
+ const url = `${apiUrl}/projects/${projectId}/releases/${encodeURIComponent(options.release)}/source-maps`;
89505
+ const result = await withSpinner(`Deleting source maps for release "${options.release}"...`, async () => {
89506
+ const response = await fetch(url, {
89507
+ method: "DELETE",
89508
+ headers: { Authorization: `Bearer ${apiKey}` }
89509
+ });
89510
+ if (!response.ok) {
89511
+ const errorText = await response.text();
89512
+ throw new Error(`Request failed (${response.status}): ${errorText}`);
89513
+ }
89514
+ return response.json();
89515
+ });
89516
+ success(`Deleted ${result.deleted} source map(s) for release "${options.release}"`);
89517
+ }
89518
+ async function deleteSourceMap(options) {
89519
+ await requireAuth();
89520
+ await setupClient();
89521
+ const projectId = parseInt(options.projectId, 10);
89522
+ const sourceMapId = parseInt(options.sourceMapId, 10);
89523
+ if (isNaN(projectId) || isNaN(sourceMapId)) {
89524
+ warning("Invalid project ID or source map ID");
89525
+ return;
89526
+ }
89527
+ const apiUrl = normalizeApiUrl(config.get("apiUrl"));
89528
+ const apiKey = await credentials.getApiKey();
89529
+ const url = `${apiUrl}/projects/${projectId}/source-maps/${sourceMapId}`;
89530
+ await withSpinner(`Deleting source map #${sourceMapId}...`, async () => {
89531
+ const response = await fetch(url, {
89532
+ method: "DELETE",
89533
+ headers: { Authorization: `Bearer ${apiKey}` }
89534
+ });
89535
+ if (!response.ok && response.status !== 204) {
89536
+ const errorText = await response.text();
89537
+ throw new Error(`Request failed (${response.status}): ${errorText}`);
89538
+ }
89539
+ });
89540
+ success(`Source map #${sourceMapId} deleted`);
89541
+ }
89542
+ function formatBytes3(bytes) {
89543
+ if (bytes < 1024)
89544
+ return `${bytes} B`;
89545
+ if (bytes < 1024 * 1024)
89546
+ return `${(bytes / 1024).toFixed(1)} KB`;
89547
+ return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
89548
+ }
89275
89549
  async function getErrorDashboardAction(options) {
89276
89550
  await requireAuth();
89277
89551
  await setupClient();
@@ -91589,8 +91863,8 @@ async function statsAction(options) {
91589
91863
  { header: "Requests", accessor: (s) => s.request_count.toString(), color: (v) => colors.bold(v) },
91590
91864
  { header: "Errors", accessor: (s) => s.error_count.toString(), color: (v) => parseInt(v, 10) > 0 ? colors.error(v) : colors.muted(v) },
91591
91865
  { header: "Avg Time", accessor: (s) => `${Math.round(s.avg_response_time_ms)}ms` },
91592
- { header: "Req Bytes", accessor: (s) => formatBytes3(s.total_request_bytes), color: (v) => colors.muted(v) },
91593
- { header: "Res Bytes", accessor: (s) => formatBytes3(s.total_response_bytes), color: (v) => colors.muted(v) }
91866
+ { header: "Req Bytes", accessor: (s) => formatBytes4(s.total_request_bytes), color: (v) => colors.muted(v) },
91867
+ { header: "Res Bytes", accessor: (s) => formatBytes4(s.total_response_bytes), color: (v) => colors.muted(v) }
91594
91868
  ];
91595
91869
  printTable(result.stats, columns, { style: "minimal" });
91596
91870
  const totalRequests = result.stats.reduce((sum, s) => sum + s.request_count, 0);
@@ -91644,8 +91918,8 @@ function printProxyLogDetail(log) {
91644
91918
  newline();
91645
91919
  header("Performance");
91646
91920
  keyValue("Response Time", log.response_time_ms != null ? `${log.response_time_ms}ms` : "-");
91647
- keyValue("Request Size", log.request_size_bytes != null ? formatBytes3(log.request_size_bytes) : "-");
91648
- keyValue("Response Size", log.response_size_bytes != null ? formatBytes3(log.response_size_bytes) : "-");
91921
+ keyValue("Request Size", log.request_size_bytes != null ? formatBytes4(log.request_size_bytes) : "-");
91922
+ keyValue("Response Size", log.response_size_bytes != null ? formatBytes4(log.response_size_bytes) : "-");
91649
91923
  if (log.cache_status) {
91650
91924
  keyValue("Cache Status", log.cache_status);
91651
91925
  }
@@ -91683,7 +91957,7 @@ function printProxyLogDetail(log) {
91683
91957
  }
91684
91958
  newline();
91685
91959
  }
91686
- function formatBytes3(bytes) {
91960
+ function formatBytes4(bytes) {
91687
91961
  if (bytes === 0)
91688
91962
  return "0 B";
91689
91963
  const units = ["B", "KB", "MB", "GB"];
@@ -95130,7 +95404,7 @@ async function syncAndFindRepo(connectionId, owner, repo) {
95130
95404
  client,
95131
95405
  path: { connection_id: connectionId }
95132
95406
  });
95133
- await new Promise((resolve5) => setTimeout(resolve5, 1000));
95407
+ await new Promise((resolve6) => setTimeout(resolve6, 1000));
95134
95408
  return findRepoOnConnection(connectionId, owner, repo);
95135
95409
  } catch {
95136
95410
  return false;
@@ -95533,7 +95807,7 @@ async function syncAndFindRepo2(connectionId, owner, repo) {
95533
95807
  client,
95534
95808
  path: { connection_id: connectionId }
95535
95809
  });
95536
- await new Promise((resolve5) => setTimeout(resolve5, 1000));
95810
+ await new Promise((resolve6) => setTimeout(resolve6, 1000));
95537
95811
  return findRepoOnConnection2(connectionId, owner, repo);
95538
95812
  } catch {
95539
95813
  return false;
@@ -96915,10 +97189,10 @@ function registerLinkCommand(program2) {
96915
97189
  }
96916
97190
 
96917
97191
  // src/lib/detect-project.ts
96918
- import { existsSync as existsSync8 } from "node:fs";
96919
- import { readFile as readFile4 } from "node:fs/promises";
97192
+ import { existsSync as existsSync9 } from "node:fs";
97193
+ import { readFile as readFile5 } from "node:fs/promises";
96920
97194
  import { execSync } from "node:child_process";
96921
- import { join as join3, basename as basename3 } from "node:path";
97195
+ import { join as join3, basename as basename4 } from "node:path";
96922
97196
  var PRESET_RULES = [
96923
97197
  {
96924
97198
  files: ["next.config.js", "next.config.ts", "next.config.mjs"],
@@ -96994,7 +97268,7 @@ var PRESET_RULES = [
96994
97268
  function detectPreset(dir) {
96995
97269
  const projectDir = dir ?? process.cwd();
96996
97270
  for (const rule of PRESET_RULES) {
96997
- const matched = rule.files.some((file) => existsSync8(join3(projectDir, file)));
97271
+ const matched = rule.files.some((file) => existsSync9(join3(projectDir, file)));
96998
97272
  if (matched) {
96999
97273
  return {
97000
97274
  slug: rule.slug,
@@ -97003,14 +97277,14 @@ function detectPreset(dir) {
97003
97277
  };
97004
97278
  }
97005
97279
  }
97006
- if (existsSync8(join3(projectDir, "package.json"))) {
97280
+ if (existsSync9(join3(projectDir, "package.json"))) {
97007
97281
  return {
97008
97282
  slug: "nodejs",
97009
97283
  label: "Node.js",
97010
97284
  confidence: "low"
97011
97285
  };
97012
97286
  }
97013
- if (existsSync8(join3(projectDir, "index.html"))) {
97287
+ if (existsSync9(join3(projectDir, "index.html"))) {
97014
97288
  return {
97015
97289
  slug: "static",
97016
97290
  label: "Static Site",
@@ -97022,9 +97296,9 @@ function detectPreset(dir) {
97022
97296
  async function refinePythonPreset(dir) {
97023
97297
  const projectDir = dir ?? process.cwd();
97024
97298
  const reqPath = join3(projectDir, "requirements.txt");
97025
- if (existsSync8(reqPath)) {
97299
+ if (existsSync9(reqPath)) {
97026
97300
  try {
97027
- const content = await readFile4(reqPath, "utf-8");
97301
+ const content = await readFile5(reqPath, "utf-8");
97028
97302
  const lower = content.toLowerCase();
97029
97303
  if (lower.includes("fastapi"))
97030
97304
  return { slug: "fastapi", label: "FastAPI", confidence: "high" };
@@ -97035,9 +97309,9 @@ async function refinePythonPreset(dir) {
97035
97309
  } catch {}
97036
97310
  }
97037
97311
  const pyprojectPath = join3(projectDir, "pyproject.toml");
97038
- if (existsSync8(pyprojectPath)) {
97312
+ if (existsSync9(pyprojectPath)) {
97039
97313
  try {
97040
- const content = await readFile4(pyprojectPath, "utf-8");
97314
+ const content = await readFile5(pyprojectPath, "utf-8");
97041
97315
  const lower = content.toLowerCase();
97042
97316
  if (lower.includes("fastapi"))
97043
97317
  return { slug: "fastapi", label: "FastAPI", confidence: "high" };
@@ -97113,9 +97387,9 @@ async function detectServiceHints(dir) {
97113
97387
  const envFiles = [".env", ".env.example", ".env.local", ".env.development"];
97114
97388
  for (const envFile of envFiles) {
97115
97389
  const envPath = join3(projectDir, envFile);
97116
- if (existsSync8(envPath)) {
97390
+ if (existsSync9(envPath)) {
97117
97391
  try {
97118
- const content = await readFile4(envPath, "utf-8");
97392
+ const content = await readFile5(envPath, "utf-8");
97119
97393
  const upper = content.toUpperCase();
97120
97394
  if (upper.includes("DATABASE_URL") || upper.includes("POSTGRES") || upper.includes("PG_")) {
97121
97395
  hints.add("postgres");
@@ -97133,9 +97407,9 @@ async function detectServiceHints(dir) {
97133
97407
  }
97134
97408
  }
97135
97409
  const prismaPath = join3(projectDir, "prisma", "schema.prisma");
97136
- if (existsSync8(prismaPath)) {
97410
+ if (existsSync9(prismaPath)) {
97137
97411
  try {
97138
- const content = await readFile4(prismaPath, "utf-8");
97412
+ const content = await readFile5(prismaPath, "utf-8");
97139
97413
  if (content.includes("postgresql") || content.includes("postgres")) {
97140
97414
  hints.add("postgres");
97141
97415
  }
@@ -97146,7 +97420,7 @@ async function detectServiceHints(dir) {
97146
97420
  }
97147
97421
  const drizzleFiles = ["drizzle.config.ts", "drizzle.config.js"];
97148
97422
  for (const drizzleFile of drizzleFiles) {
97149
- if (existsSync8(join3(projectDir, drizzleFile))) {
97423
+ if (existsSync9(join3(projectDir, drizzleFile))) {
97150
97424
  hints.add("postgres");
97151
97425
  break;
97152
97426
  }
@@ -97156,9 +97430,9 @@ async function detectServiceHints(dir) {
97156
97430
  async function suggestProjectName(dir) {
97157
97431
  const projectDir = dir ?? process.cwd();
97158
97432
  const pkgPath = join3(projectDir, "package.json");
97159
- if (existsSync8(pkgPath)) {
97433
+ if (existsSync9(pkgPath)) {
97160
97434
  try {
97161
- const content = await readFile4(pkgPath, "utf-8");
97435
+ const content = await readFile5(pkgPath, "utf-8");
97162
97436
  const pkg = JSON.parse(content);
97163
97437
  if (pkg.name && typeof pkg.name === "string") {
97164
97438
  const name = pkg.name.replace(/^@[^/]+\//, "");
@@ -97172,7 +97446,7 @@ async function suggestProjectName(dir) {
97172
97446
  if (remote) {
97173
97447
  return sanitizeProjectName(remote.repo);
97174
97448
  }
97175
- return sanitizeProjectName(basename3(projectDir));
97449
+ return sanitizeProjectName(basename4(projectDir));
97176
97450
  }
97177
97451
  function sanitizeProjectName(name) {
97178
97452
  return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 60);
@@ -97182,8 +97456,8 @@ function sanitizeProjectName(name) {
97182
97456
  init_prompts();
97183
97457
  init_output();
97184
97458
  init_sdk_gen();
97185
- import { existsSync as existsSync9, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
97186
- import { resolve as resolve5, join as join4 } from "node:path";
97459
+ import { existsSync as existsSync10, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2 } from "node:fs";
97460
+ import { resolve as resolve6, join as join4 } from "node:path";
97187
97461
  import { tmpdir as tmpdir3 } from "node:os";
97188
97462
  async function runSetupWizard(options) {
97189
97463
  newline();
@@ -97411,7 +97685,7 @@ async function runSetupWizard(options) {
97411
97685
  deploymentId = deployment.id;
97412
97686
  break;
97413
97687
  }
97414
- await new Promise((resolve6) => setTimeout(resolve6, 2000));
97688
+ await new Promise((resolve7) => setTimeout(resolve7, 2000));
97415
97689
  }
97416
97690
  if (deploymentId) {
97417
97691
  const result = await watchDeployment({
@@ -97436,7 +97710,7 @@ async function runSetupWizard(options) {
97436
97710
  info("Building and deploying...");
97437
97711
  newline();
97438
97712
  try {
97439
- const hasDockerfile = existsSync9(resolve5("Dockerfile"));
97713
+ const hasDockerfile = existsSync10(resolve6("Dockerfile"));
97440
97714
  let dockerfilePath;
97441
97715
  let buildArgsList;
97442
97716
  if (!hasDockerfile && presetSlug && presetSlug !== "dockerfile") {
@@ -97570,14 +97844,14 @@ async function selectPresetFromAll() {
97570
97844
  });
97571
97845
  }
97572
97846
  function detectPackageManager(dir) {
97573
- const projectDir = dir ? resolve5(dir) : process.cwd();
97574
- if (existsSync9(join4(projectDir, "pnpm-lock.yaml")))
97847
+ const projectDir = dir ? resolve6(dir) : process.cwd();
97848
+ if (existsSync10(join4(projectDir, "pnpm-lock.yaml")))
97575
97849
  return "pnpm";
97576
- if (existsSync9(join4(projectDir, "yarn.lock")))
97850
+ if (existsSync10(join4(projectDir, "yarn.lock")))
97577
97851
  return "yarn";
97578
- if (existsSync9(join4(projectDir, "bun.lockb")) || existsSync9(join4(projectDir, "bun.lock")))
97852
+ if (existsSync10(join4(projectDir, "bun.lockb")) || existsSync10(join4(projectDir, "bun.lock")))
97579
97853
  return "bun";
97580
- if (existsSync9(join4(projectDir, "package-lock.json")))
97854
+ if (existsSync10(join4(projectDir, "package-lock.json")))
97581
97855
  return "npm";
97582
97856
  return "npm";
97583
97857
  }
@@ -97920,8 +98194,8 @@ function registerStatusCommand(program2) {
97920
98194
  }
97921
98195
 
97922
98196
  // src/config/instances.ts
97923
- import { readFile as readFile5, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
97924
- import { existsSync as existsSync10 } from "node:fs";
98197
+ import { readFile as readFile6, writeFile as writeFile3, mkdir as mkdir3 } from "node:fs/promises";
98198
+ import { existsSync as existsSync11 } from "node:fs";
97925
98199
  import { dirname as dirname3 } from "node:path";
97926
98200
  function getInstancesPath() {
97927
98201
  const home = process.env.HOME || process.env.USERPROFILE || "~";
@@ -97930,8 +98204,8 @@ function getInstancesPath() {
97930
98204
  async function loadInstances() {
97931
98205
  const path7 = getInstancesPath();
97932
98206
  try {
97933
- if (existsSync10(path7)) {
97934
- const content = await readFile5(path7, "utf-8");
98207
+ if (existsSync11(path7)) {
98208
+ const content = await readFile6(path7, "utf-8");
97935
98209
  return JSON.parse(content);
97936
98210
  }
97937
98211
  } catch {}
@@ -98977,7 +99251,7 @@ function openBrowser2(url) {
98977
99251
  } catch {}
98978
99252
  }
98979
99253
  function sleep(ms) {
98980
- return new Promise((resolve7) => setTimeout(resolve7, ms));
99254
+ return new Promise((resolve8) => setTimeout(resolve8, ms));
98981
99255
  }
98982
99256
  async function cloudLogin() {
98983
99257
  const cloudUrl = getCloudUrl();
@@ -99230,7 +99504,10 @@ function extractCommandInfo(cmd, parentName = "") {
99230
99504
  usage: cmd.usage()
99231
99505
  };
99232
99506
  }
99233
- function generateMarkdown(commands, level = 2) {
99507
+ function escapeForMdx(text) {
99508
+ return text.replace(/('[^']*\{[^']*')/g, "`$1`");
99509
+ }
99510
+ function generateMarkdown(commands, level = 2, format2 = "markdown") {
99234
99511
  let md = "";
99235
99512
  for (const cmd of commands) {
99236
99513
  const heading = "#".repeat(level);
@@ -99254,7 +99531,10 @@ function generateMarkdown(commands, level = 2) {
99254
99531
  for (const opt of cmd.options) {
99255
99532
  const defaultVal = opt.defaultValue !== undefined ? `\`${opt.defaultValue}\`` : "-";
99256
99533
  const required = opt.required ? "Yes" : "No";
99257
- const escapedDesc = opt.description.replace(/\|/g, "\\|");
99534
+ let escapedDesc = opt.description.replace(/\|/g, "\\|");
99535
+ if (format2 === "mdx") {
99536
+ escapedDesc = escapeForMdx(escapedDesc);
99537
+ }
99258
99538
  md += `| \`${opt.flags}\` | ${escapedDesc} | ${defaultVal} | ${required} |
99259
99539
  `;
99260
99540
  }
@@ -99272,7 +99552,7 @@ function generateMarkdown(commands, level = 2) {
99272
99552
  }
99273
99553
  md += `
99274
99554
  `;
99275
- md += generateMarkdown(cmd.subcommands, level + 1);
99555
+ md += generateMarkdown(cmd.subcommands, level + 1, format2);
99276
99556
  }
99277
99557
  }
99278
99558
  return md;
@@ -99294,11 +99574,7 @@ function generateHeader(format2 = "markdown") {
99294
99574
  ## Installation
99295
99575
 
99296
99576
  \`\`\`bash
99297
- # Install globally
99298
- npm install -g @temps/cli
99299
-
99300
- # Or use with npx
99301
- npx @temps/cli [command]
99577
+ bunx @temps-sdk/cli [command]
99302
99578
  \`\`\`
99303
99579
 
99304
99580
  ## Authentication
@@ -99307,10 +99583,10 @@ Before using most commands, you need to authenticate:
99307
99583
 
99308
99584
  \`\`\`bash
99309
99585
  # Login with API key
99310
- temps login
99586
+ bunx @temps-sdk/cli login
99311
99587
 
99312
99588
  # Or configure with wizard
99313
- temps configure
99589
+ bunx @temps-sdk/cli configure
99314
99590
  \`\`\`
99315
99591
 
99316
99592
  ## Global Options
@@ -99336,48 +99612,48 @@ function generateFooter() {
99336
99612
 
99337
99613
  \`\`\`bash
99338
99614
  # Login to Temps
99339
- temps login
99615
+ bunx @temps-sdk/cli login
99340
99616
 
99341
99617
  # Create a new project
99342
- temps projects create --name my-app
99618
+ bunx @temps-sdk/cli projects create --name my-app
99343
99619
 
99344
99620
  # Deploy to production
99345
- temps deploy --project my-app --environment production
99621
+ bunx @temps-sdk/cli deploy --project my-app --environment production
99346
99622
 
99347
99623
  # View deployment logs
99348
- temps logs --project my-app --follow
99624
+ bunx @temps-sdk/cli logs --project my-app --follow
99349
99625
 
99350
99626
  # Stream runtime container logs
99351
- temps runtime-logs --project my-app
99627
+ bunx @temps-sdk/cli runtime-logs --project my-app
99352
99628
 
99353
99629
  # List containers
99354
- temps containers list --project-id 1 --environment-id 1
99630
+ bunx @temps-sdk/cli containers list --project-id 1 --environment-id 1
99355
99631
  \`\`\`
99356
99632
 
99357
99633
  ### Managing Environments
99358
99634
 
99359
99635
  \`\`\`bash
99360
99636
  # List environments
99361
- temps environments list --project my-app
99637
+ bunx @temps-sdk/cli environments list --project my-app
99362
99638
 
99363
99639
  # Set environment variables
99364
- temps environments vars set --project my-app --key DATABASE_URL --value "postgres://..."
99640
+ bunx @temps-sdk/cli environments vars set --project my-app --key DATABASE_URL --value "postgres://..."
99365
99641
 
99366
99642
  # View environment variables
99367
- temps environments vars list --project my-app
99643
+ bunx @temps-sdk/cli environments vars list --project my-app
99368
99644
  \`\`\`
99369
99645
 
99370
99646
  ### Managing Domains
99371
99647
 
99372
99648
  \`\`\`bash
99373
99649
  # Add a custom domain
99374
- temps domains add --project my-app --domain app.example.com
99650
+ bunx @temps-sdk/cli domains add --project my-app --domain app.example.com
99375
99651
 
99376
99652
  # List domains
99377
- temps domains list --project my-app
99653
+ bunx @temps-sdk/cli domains list --project my-app
99378
99654
 
99379
99655
  # Remove a domain
99380
- temps domains remove --project my-app --domain app.example.com
99656
+ bunx @temps-sdk/cli domains remove --project my-app --domain app.example.com
99381
99657
  \`\`\`
99382
99658
 
99383
99659
  ## Environment Variables
@@ -99395,9 +99671,9 @@ The CLI respects the following environment variables:
99395
99671
 
99396
99672
  Configuration is stored in:
99397
99673
  - **Config file**: \`~/.temps/config.json\`
99398
- - **Credentials**: \`~/.temps/.secrets\`
99674
+ - **Credentials**: Stored securely in \`~/.temps/\` with restricted file permissions
99399
99675
 
99400
- Use \`temps configure show\` to view current configuration.
99676
+ Use \`bunx @temps-sdk/cli configure show\` to view current configuration.
99401
99677
 
99402
99678
  ## Support
99403
99679
 
@@ -99414,7 +99690,7 @@ async function generateDocs(options) {
99414
99690
  } else {
99415
99691
  const format2 = options.format === "mdx" ? "mdx" : "markdown";
99416
99692
  output = generateHeader(format2);
99417
- output += generateMarkdown(commands);
99693
+ output += generateMarkdown(commands, 2, format2);
99418
99694
  output += generateFooter();
99419
99695
  }
99420
99696
  if (options.output) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temps-sdk/cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "CLI for Temps deployment platform",
5
5
  "type": "module",
6
6
  "bin": {