@temps-sdk/cli 0.1.26 → 0.1.27

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 +660 -121
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -74347,6 +74347,8 @@ async function saveContexts(contexts) {
74347
74347
  out.expiresAt = c.expiresAt;
74348
74348
  if (c.isActive !== undefined)
74349
74349
  out.isActive = c.isActive;
74350
+ if (c.defaultProject !== undefined)
74351
+ out.defaultProject = c.defaultProject;
74350
74352
  return out;
74351
74353
  });
74352
74354
  await writeFile(path5, JSON.stringify(normalized, null, 2) + `
@@ -74427,6 +74429,19 @@ async function removeContext(name) {
74427
74429
  await saveContexts(filtered);
74428
74430
  return true;
74429
74431
  }
74432
+ async function renameContext(oldName, newName) {
74433
+ const contexts = await loadContexts();
74434
+ if (!contexts.some((c) => c.name === oldName))
74435
+ return false;
74436
+ if (contexts.some((c) => c.name === newName))
74437
+ return false;
74438
+ for (const c of contexts) {
74439
+ if (c.name === oldName)
74440
+ c.name = newName;
74441
+ }
74442
+ await saveContexts(contexts);
74443
+ return true;
74444
+ }
74430
74445
  async function setActiveContext(name) {
74431
74446
  const contexts = await loadContexts();
74432
74447
  if (!contexts.some((c) => c.name === name))
@@ -74448,6 +74463,25 @@ function defaultContextName(url) {
74448
74463
  function contextsPath() {
74449
74464
  return getContextsPath();
74450
74465
  }
74466
+ function getActiveDefaultProjectSync() {
74467
+ return getActiveContextSync()?.defaultProject;
74468
+ }
74469
+ async function setActiveDefaultProject(slug) {
74470
+ const contexts = await loadContexts();
74471
+ const active = pickActiveContext(contexts);
74472
+ if (!active)
74473
+ return false;
74474
+ const target = contexts.find((c) => c.name === active.name);
74475
+ if (!target)
74476
+ return false;
74477
+ if (slug) {
74478
+ target.defaultProject = slug;
74479
+ } else {
74480
+ delete target.defaultProject;
74481
+ }
74482
+ await saveContexts(contexts);
74483
+ return true;
74484
+ }
74451
74485
  function getActiveContextSync() {
74452
74486
  try {
74453
74487
  const path5 = getContextsPath();
@@ -75426,6 +75460,30 @@ async function removeAction(name) {
75426
75460
  info2(`Active context is now ${colors.bold(remaining.name)}.`);
75427
75461
  }
75428
75462
  }
75463
+ async function renameAction(oldName, newName) {
75464
+ if (oldName === newName) {
75465
+ info2("Nothing to do — old and new names are the same.");
75466
+ return;
75467
+ }
75468
+ const result = await renameContext(oldName, newName);
75469
+ if (!result) {
75470
+ const contexts = await listContexts();
75471
+ if (!contexts.some((c) => c.name === oldName)) {
75472
+ error2(`Context "${oldName}" not found.`);
75473
+ if (contexts.length > 0) {
75474
+ info2(`Available: ${contexts.map((c) => c.name).join(", ")}`);
75475
+ }
75476
+ } else {
75477
+ error2(`A context named "${newName}" already exists.`);
75478
+ }
75479
+ return;
75480
+ }
75481
+ const envContext = process.env.TEMPS_CONTEXT?.trim() || null;
75482
+ success2(`Renamed context "${oldName}" → "${newName}"`);
75483
+ if (envContext === oldName) {
75484
+ warning2(`${colors.bold("TEMPS_CONTEXT")}=${oldName} is set in your environment. ` + `Update it to "${newName}" for the change to take effect in this shell.`);
75485
+ }
75486
+ }
75429
75487
  async function currentAction(options) {
75430
75488
  const active = await getActiveContext();
75431
75489
  if (!active) {
@@ -75453,9 +75511,100 @@ function registerContextCommands(program2) {
75453
75511
  ctx.command("list").alias("ls").description("List all configured contexts").option("--json", "Output in JSON format").action(listAction);
75454
75512
  ctx.command("use <name>").alias("switch").description("Switch the active context").action(useAction);
75455
75513
  ctx.command("remove <name>").alias("rm").description("Remove a context (does NOT revoke the key on the server)").action(removeAction);
75514
+ ctx.command("rename <old-name> <new-name>").description("Rename a context").action(renameAction);
75456
75515
  ctx.command("current").description("Print the active context name").option("--json", "Output in JSON format with full details").action(currentAction);
75457
75516
  }
75458
75517
 
75518
+ // src/config/project-config.ts
75519
+ import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4 } from "node:fs/promises";
75520
+ import { existsSync as existsSync3 } from "node:fs";
75521
+ import { join, dirname as dirname3 } from "node:path";
75522
+ var CONFIG_DIR = ".temps";
75523
+ var CONFIG_FILE = "config.json";
75524
+ var GITIGNORE_FILE = ".gitignore";
75525
+ function findProjectConfigDir(startDir) {
75526
+ let dir = startDir ?? process.cwd();
75527
+ while (true) {
75528
+ const configPath = join(dir, CONFIG_DIR, CONFIG_FILE);
75529
+ if (existsSync3(configPath)) {
75530
+ return join(dir, CONFIG_DIR);
75531
+ }
75532
+ const parent = dirname3(dir);
75533
+ if (parent === dir)
75534
+ break;
75535
+ dir = parent;
75536
+ }
75537
+ return null;
75538
+ }
75539
+ async function readProjectConfig() {
75540
+ const configDir = findProjectConfigDir();
75541
+ if (!configDir)
75542
+ return null;
75543
+ try {
75544
+ const configPath = join(configDir, CONFIG_FILE);
75545
+ const content = await readFile4(configPath, "utf-8");
75546
+ return JSON.parse(content);
75547
+ } catch {
75548
+ return null;
75549
+ }
75550
+ }
75551
+ async function writeProjectConfig(config2) {
75552
+ const configDir = join(process.cwd(), CONFIG_DIR);
75553
+ await mkdir4(configDir, { recursive: true });
75554
+ const configPath = join(configDir, CONFIG_FILE);
75555
+ await writeFile4(configPath, JSON.stringify(config2, null, 2) + `
75556
+ `, "utf-8");
75557
+ const gitignorePath = join(configDir, GITIGNORE_FILE);
75558
+ if (!existsSync3(gitignorePath)) {
75559
+ await writeFile4(gitignorePath, `*
75560
+ `, "utf-8");
75561
+ }
75562
+ return configPath;
75563
+ }
75564
+ function hasProjectConfig() {
75565
+ return findProjectConfigDir() !== null;
75566
+ }
75567
+
75568
+ // src/config/resolve-project.ts
75569
+ async function resolveProjectSlug(flagValue) {
75570
+ if (flagValue) {
75571
+ return { slug: flagValue, source: "flag" };
75572
+ }
75573
+ const localConfig = await readProjectConfig();
75574
+ if (localConfig?.projectSlug) {
75575
+ return { slug: localConfig.projectSlug, source: "local-config" };
75576
+ }
75577
+ const envProject = process.env.TEMPS_PROJECT;
75578
+ if (envProject) {
75579
+ return { slug: envProject, source: "env-var" };
75580
+ }
75581
+ const contextDefault = getActiveDefaultProjectSync();
75582
+ if (contextDefault) {
75583
+ return { slug: contextDefault, source: "context-default" };
75584
+ }
75585
+ const defaultProject = config.get("defaultProject");
75586
+ if (defaultProject) {
75587
+ return { slug: defaultProject, source: "global-config" };
75588
+ }
75589
+ return null;
75590
+ }
75591
+ async function setDefaultProject(slug) {
75592
+ const wroteToContext = await setActiveDefaultProject(slug);
75593
+ if (!wroteToContext) {
75594
+ config.set("defaultProject", slug);
75595
+ }
75596
+ }
75597
+ async function requireProjectSlug(flagValue) {
75598
+ const resolved = await resolveProjectSlug(flagValue);
75599
+ if (resolved)
75600
+ return resolved;
75601
+ throw new Error(`No project specified. You can:
75602
+ ` + ` • Pass --project <slug> flag
75603
+ ` + ` • Run "temps link" to link this directory to a project
75604
+ ` + ` • Set TEMPS_PROJECT environment variable
75605
+ ` + ' • Run "temps configure" to set a default project');
75606
+ }
75607
+
75459
75608
  // src/commands/configure.ts
75460
75609
  init_prompts();
75461
75610
  init_output();
@@ -75629,10 +75778,14 @@ function getConfigValue(key) {
75629
75778
  console.error(colors.muted(`Valid keys: ${validKeys.join(", ")}`));
75630
75779
  process.exit(1);
75631
75780
  }
75781
+ if (key === "defaultProject") {
75782
+ console.log(getActiveDefaultProjectSync() ?? config.get("defaultProject") ?? "");
75783
+ return;
75784
+ }
75632
75785
  const value = config.get(key);
75633
75786
  console.log(value ?? "");
75634
75787
  }
75635
- function setConfigValue(key, value) {
75788
+ async function setConfigValue(key, value) {
75636
75789
  const validKeys = [
75637
75790
  "apiUrl",
75638
75791
  "defaultProject",
@@ -75645,6 +75798,11 @@ function setConfigValue(key, value) {
75645
75798
  console.error(colors.muted(`Valid keys: ${validKeys.join(", ")}`));
75646
75799
  process.exit(1);
75647
75800
  }
75801
+ if (key === "defaultProject") {
75802
+ await setDefaultProject(value);
75803
+ success2(`Set ${key} = ${value}`);
75804
+ return;
75805
+ }
75648
75806
  let typedValue = value;
75649
75807
  if (key === "colorEnabled") {
75650
75808
  typedValue = value === "true" || value === "1";
@@ -75818,7 +75976,7 @@ init_output();
75818
75976
  init_sdk_gen();
75819
75977
 
75820
75978
  // src/lib/env-file.ts
75821
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
75979
+ import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
75822
75980
  import { resolve } from "node:path";
75823
75981
  function parseEnvFile(content) {
75824
75982
  const variables = {};
@@ -75844,7 +76002,7 @@ function parseEnvFile(content) {
75844
76002
  }
75845
76003
  function readEnvFile(filePath) {
75846
76004
  const resolved = resolve(filePath);
75847
- if (!existsSync3(resolved)) {
76005
+ if (!existsSync4(resolved)) {
75848
76006
  return null;
75849
76007
  }
75850
76008
  const content = readFileSync3(resolved, "utf-8");
@@ -75856,7 +76014,7 @@ function findEnvFiles(dir) {
75856
76014
  const found = [];
75857
76015
  for (const name of candidates) {
75858
76016
  const fullPath = resolve(cwd, name);
75859
- if (existsSync3(fullPath)) {
76017
+ if (existsSync4(fullPath)) {
75860
76018
  found.push(name);
75861
76019
  }
75862
76020
  }
@@ -76484,7 +76642,7 @@ async function create(options) {
76484
76642
  }
76485
76643
  newline();
76486
76644
  if (skipPrompts) {
76487
- config.set("defaultProject", project.slug);
76645
+ await setDefaultProject(project.slug);
76488
76646
  success2(`Default project set to "${project.slug}"`);
76489
76647
  } else {
76490
76648
  const setDefault = await promptConfirm({
@@ -76492,7 +76650,7 @@ async function create(options) {
76492
76650
  default: true
76493
76651
  });
76494
76652
  if (setDefault) {
76495
- config.set("defaultProject", project.slug);
76653
+ await setDefaultProject(project.slug);
76496
76654
  success2(`Default project set to "${project.slug}"`);
76497
76655
  }
76498
76656
  }
@@ -76592,7 +76750,7 @@ async function createManualProject(options, sourceType, skipPrompts) {
76592
76750
  }
76593
76751
  newline();
76594
76752
  if (skipPrompts) {
76595
- config.set("defaultProject", project.slug);
76753
+ await setDefaultProject(project.slug);
76596
76754
  success2(`Default project set to "${project.slug}"`);
76597
76755
  } else {
76598
76756
  const setDefault = await promptConfirm({
@@ -76600,7 +76758,7 @@ async function createManualProject(options, sourceType, skipPrompts) {
76600
76758
  default: true
76601
76759
  });
76602
76760
  if (setDefault) {
76603
- config.set("defaultProject", project.slug);
76761
+ await setDefaultProject(project.slug);
76604
76762
  success2(`Default project set to "${project.slug}"`);
76605
76763
  }
76606
76764
  }
@@ -76743,86 +76901,6 @@ async function configureEnvironmentVariables() {
76743
76901
  return envVars;
76744
76902
  }
76745
76903
 
76746
- // src/config/project-config.ts
76747
- import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4 } from "node:fs/promises";
76748
- import { existsSync as existsSync4 } from "node:fs";
76749
- import { join, dirname as dirname3 } from "node:path";
76750
- var CONFIG_DIR = ".temps";
76751
- var CONFIG_FILE = "config.json";
76752
- var GITIGNORE_FILE = ".gitignore";
76753
- function findProjectConfigDir(startDir) {
76754
- let dir = startDir ?? process.cwd();
76755
- while (true) {
76756
- const configPath = join(dir, CONFIG_DIR, CONFIG_FILE);
76757
- if (existsSync4(configPath)) {
76758
- return join(dir, CONFIG_DIR);
76759
- }
76760
- const parent = dirname3(dir);
76761
- if (parent === dir)
76762
- break;
76763
- dir = parent;
76764
- }
76765
- return null;
76766
- }
76767
- async function readProjectConfig() {
76768
- const configDir = findProjectConfigDir();
76769
- if (!configDir)
76770
- return null;
76771
- try {
76772
- const configPath = join(configDir, CONFIG_FILE);
76773
- const content = await readFile4(configPath, "utf-8");
76774
- return JSON.parse(content);
76775
- } catch {
76776
- return null;
76777
- }
76778
- }
76779
- async function writeProjectConfig(config2) {
76780
- const configDir = join(process.cwd(), CONFIG_DIR);
76781
- await mkdir4(configDir, { recursive: true });
76782
- const configPath = join(configDir, CONFIG_FILE);
76783
- await writeFile4(configPath, JSON.stringify(config2, null, 2) + `
76784
- `, "utf-8");
76785
- const gitignorePath = join(configDir, GITIGNORE_FILE);
76786
- if (!existsSync4(gitignorePath)) {
76787
- await writeFile4(gitignorePath, `*
76788
- `, "utf-8");
76789
- }
76790
- return configPath;
76791
- }
76792
- function hasProjectConfig() {
76793
- return findProjectConfigDir() !== null;
76794
- }
76795
-
76796
- // src/config/resolve-project.ts
76797
- async function resolveProjectSlug(flagValue) {
76798
- if (flagValue) {
76799
- return { slug: flagValue, source: "flag" };
76800
- }
76801
- const localConfig = await readProjectConfig();
76802
- if (localConfig?.projectSlug) {
76803
- return { slug: localConfig.projectSlug, source: "local-config" };
76804
- }
76805
- const envProject = process.env.TEMPS_PROJECT;
76806
- if (envProject) {
76807
- return { slug: envProject, source: "env-var" };
76808
- }
76809
- const defaultProject = config.get("defaultProject");
76810
- if (defaultProject) {
76811
- return { slug: defaultProject, source: "global-config" };
76812
- }
76813
- return null;
76814
- }
76815
- async function requireProjectSlug(flagValue) {
76816
- const resolved = await resolveProjectSlug(flagValue);
76817
- if (resolved)
76818
- return resolved;
76819
- throw new Error(`No project specified. You can:
76820
- ` + ` • Pass --project <slug> flag
76821
- ` + ` • Run "temps link" to link this directory to a project
76822
- ` + ` • Set TEMPS_PROJECT environment variable
76823
- ` + ' • Run "temps configure" to set a default project');
76824
- }
76825
-
76826
76904
  // src/commands/projects/show.ts
76827
76905
  init_spinner();
76828
76906
  init_output();
@@ -76916,6 +76994,9 @@ async function remove(options) {
76916
76994
  }
76917
76995
  });
76918
76996
  success2(`Project "${projectIdOrName}" deleted`);
76997
+ if (getActiveDefaultProjectSync() === projectIdOrName) {
76998
+ await setDefaultProject(undefined);
76999
+ }
76919
77000
  if (config.get("defaultProject") === projectIdOrName) {
76920
77001
  config.set("defaultProject", undefined);
76921
77002
  }
@@ -82871,6 +82952,13 @@ ${colors.dim("(freshly built)")}` : ""), `${icons.rocket} Deploy Local Image`);
82871
82952
  if (options.tag) {
82872
82953
  queryParams.set("tag", options.tag);
82873
82954
  }
82955
+ const healthCheckPath = options.healthCheckPath?.trim();
82956
+ if (healthCheckPath) {
82957
+ if (!healthCheckPath.startsWith("/")) {
82958
+ throw new Error('--health-check-path must start with "/" (e.g. /api/healthz)');
82959
+ }
82960
+ queryParams.set("health_check_path", healthCheckPath);
82961
+ }
82874
82962
  const finalUrl = queryParams.toString() ? `${uploadUrl}?${queryParams.toString()}` : uploadUrl;
82875
82963
  const file = Bun.file(tempFilePath);
82876
82964
  const filename = `${imageName.replace(/[/:]/g, "-")}.tar`;
@@ -83380,9 +83468,15 @@ async function deployStatic(options) {
83380
83468
  succeedSpinner(`Bundle uploaded: id=${bundle.id}`);
83381
83469
  startSpinner("Starting deployment...");
83382
83470
  const deployUrl = `${apiUrl}/projects/${projectData.id}/environments/${environmentId}/deploy/static`;
83471
+ const healthCheckPath = options.healthCheckPath?.trim();
83472
+ if (healthCheckPath && !healthCheckPath.startsWith("/")) {
83473
+ failSpinner('--health-check-path must start with "/" (e.g. /api/healthz)');
83474
+ return;
83475
+ }
83383
83476
  const deployBody = {
83384
83477
  static_bundle_id: bundle.id,
83385
- metadata: options.metadata ? JSON.parse(options.metadata) : undefined
83478
+ metadata: options.metadata ? JSON.parse(options.metadata) : undefined,
83479
+ ...healthCheckPath ? { health_check_path: healthCheckPath } : {}
83386
83480
  };
83387
83481
  const deployResponse = await fetch(deployUrl, {
83388
83482
  method: "POST",
@@ -83983,6 +84077,14 @@ async function deployImage(options) {
83983
84077
  return;
83984
84078
  }
83985
84079
  }
84080
+ if (options.healthCheckPath) {
84081
+ const p = options.healthCheckPath.trim();
84082
+ if (!p.startsWith("/")) {
84083
+ failSpinner('--health-check-path must start with "/" (e.g. /api/healthz)');
84084
+ return;
84085
+ }
84086
+ deployBody.health_check_path = p;
84087
+ }
83986
84088
  const deployResponse = await fetch(deployUrl, {
83987
84089
  method: "POST",
83988
84090
  headers: {
@@ -84553,9 +84655,9 @@ function registerDeployCommands(program2) {
84553
84655
  }
84554
84656
  return deploy(options);
84555
84657
  });
84556
- program2.command("deploy:static").alias("deploy-static").description("Deploy static files (tar.gz, zip, or directory)").requiredOption("--path <path>", "Path to static files archive or directory").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name", "production").option("--environment-id <id>", "Target environment ID").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts (for automation)").option("--metadata <json>", "Additional metadata (JSON format)").option("--timeout <seconds>", "Timeout in seconds for --wait", "300").action(deployStatic);
84557
- program2.command("deploy:image").alias("deploy-image").description("Deploy a pre-built Docker image").requiredOption("--image <image>", "Docker image reference (e.g., ghcr.io/org/app:v1.0)").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name", "production").option("--environment-id <id>", "Target environment ID").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts (for automation)").option("--metadata <json>", "Additional metadata (JSON format)").option("--timeout <seconds>", "Timeout in seconds for --wait", "300").action(deployImage);
84558
- program2.command("deploy:local-image").alias("deploy-local-image").description("Build and deploy a local Docker image (or deploy existing image with --image)").option("--image <image>", "Use existing local image instead of building (skips build)").option("-f, --dockerfile <path>", "Path to Dockerfile", "Dockerfile").option("-c, --context <path>", "Build context directory", ".").option("--build-arg <arg...>", "Build arguments (can be specified multiple times)").option("--no-build", "Skip building, requires --image").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name", "production").option("--environment-id <id>", "Target environment ID").option("-t, --tag <tag>", "Tag for the built/uploaded image").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts (for automation)").option("--metadata <json>", "Additional metadata (JSON format)").option("--timeout <seconds>", "Timeout in seconds for --wait", "600").action(deployLocalImage);
84658
+ program2.command("deploy:static").alias("deploy-static").description("Deploy static files (tar.gz, zip, or directory)").requiredOption("--path <path>", "Path to static files archive or directory").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name", "production").option("--environment-id <id>", "Target environment ID").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts (for automation)").option("--metadata <json>", "Additional metadata (JSON format)").option("--health-check-path <path>", 'HTTP health-check path (must start with "/", e.g. /api/healthz). Overrides .temps.yaml; also updates the uptime monitor.').option("--timeout <seconds>", "Timeout in seconds for --wait", "300").action(deployStatic);
84659
+ program2.command("deploy:image").alias("deploy-image").description("Deploy a pre-built Docker image").requiredOption("--image <image>", "Docker image reference (e.g., ghcr.io/org/app:v1.0)").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name", "production").option("--environment-id <id>", "Target environment ID").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts (for automation)").option("--metadata <json>", "Additional metadata (JSON format)").option("--health-check-path <path>", 'HTTP health-check path (must start with "/", e.g. /api/healthz). Overrides .temps.yaml; also updates the uptime monitor.').option("--timeout <seconds>", "Timeout in seconds for --wait", "300").action(deployImage);
84660
+ program2.command("deploy:local-image").alias("deploy-local-image").description("Build and deploy a local Docker image (or deploy existing image with --image)").option("--image <image>", "Use existing local image instead of building (skips build)").option("-f, --dockerfile <path>", "Path to Dockerfile", "Dockerfile").option("-c, --context <path>", "Build context directory", ".").option("--build-arg <arg...>", "Build arguments (can be specified multiple times)").option("--no-build", "Skip building, requires --image").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name", "production").option("--environment-id <id>", "Target environment ID").option("-t, --tag <tag>", "Tag for the built/uploaded image").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts (for automation)").option("--metadata <json>", "Additional metadata (JSON format)").option("--health-check-path <path>", 'HTTP health-check path (must start with "/", e.g. /api/healthz). Overrides .temps.yaml; also updates the uptime monitor.').option("--timeout <seconds>", "Timeout in seconds for --wait", "600").action(deployLocalImage);
84559
84661
  const deployments = program2.command("deployments").alias("deploys").description("Manage deployments");
84560
84662
  deployments.command("list").alias("ls").description("List deployments").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Filter by environment name (client-side)").option("--environment-id <id>", "Filter by environment ID (server-side)").option("-n, --limit <number>", "Limit results", "10").option("--page <n>", "Page number").option("--per-page <n>", "Items per page").option("--json", "Output in JSON format").action(list2);
84561
84663
  deployments.command("status").description("Show deployment status").option("-p, --project <project>", "Project slug or ID (required)").option("-d, --deployment-id <id>", "Deployment ID (required)").option("--json", "Output in JSON format").action(status);
@@ -90673,7 +90775,7 @@ var CHECK_INTERVALS = [
90673
90775
  function registerMonitorsCommands(program2) {
90674
90776
  const monitors = program2.command("monitors").alias("monitoring").description("Manage uptime monitors for status pages");
90675
90777
  monitors.command("list").alias("ls").description("List all monitors for a project").requiredOption("--project-id <id>", "Project ID").option("--json", "Output in JSON format").action(listMonitorsAction);
90676
- monitors.command("create").alias("add").description("Create a new monitor for a project").requiredOption("--project-id <id>", "Project ID").option("-n, --name <name>", "Monitor name").option("-t, --type <type>", "Monitor type (http, tcp, ping)").option("-i, --interval <seconds>", "Check interval in seconds (60, 300, 600, 900, 1800)").option("--environment-id <id>", "Environment ID (default: 0 for production)").option("-y, --yes", "Skip confirmation prompts (for automation)").action(createMonitorAction);
90778
+ monitors.command("create").alias("add").description("Create a new monitor for a project").requiredOption("--project-id <id>", "Project ID").option("-n, --name <name>", "Monitor name").option("-t, --type <type>", "Monitor type (http, tcp, ping)").option("-i, --interval <seconds>", "Check interval in seconds (60, 300, 600, 900, 1800)").option("--check-path <path>", 'HTTP health-check path (must start with "/", e.g. /api/healthz). Defaults to "/" for HTTP monitors.').option("--environment-id <id>", "Environment ID (default: 0 for production)").option("-y, --yes", "Skip confirmation prompts (for automation)").action(createMonitorAction);
90677
90779
  monitors.command("show").description("Show monitor details and current status").requiredOption("--id <id>", "Monitor ID").option("--json", "Output in JSON format").action(showMonitor);
90678
90780
  monitors.command("remove").alias("rm").description("Delete a monitor").requiredOption("--id <id>", "Monitor ID").option("-f, --force", "Skip confirmation").option("-y, --yes", "Skip confirmation prompts (alias for --force)").action(removeMonitor);
90679
90781
  monitors.command("status").description("Get current status — all monitors for a project, or a single monitor by ID").option("--id <id>", "Monitor ID (omit to show all monitors for the project)").option("-p, --project <slug>", "Project slug (auto-detected from .temps/config.json or TEMPS_PROJECT)").option("--json", "Output in JSON format").action(getMonitorStatusAction);
@@ -90765,6 +90867,10 @@ async function createMonitorAction(options) {
90765
90867
  });
90766
90868
  environmentId = options.environmentId ? parseInt(options.environmentId, 10) : 0;
90767
90869
  }
90870
+ const checkPath = options.checkPath?.trim();
90871
+ if (checkPath && !checkPath.startsWith("/")) {
90872
+ throw new Error(`--check-path must start with "/" (got "${checkPath}")`);
90873
+ }
90768
90874
  await withSpinner("Creating monitor...", async () => {
90769
90875
  const { error: error3 } = await createMonitor({
90770
90876
  client,
@@ -90773,7 +90879,8 @@ async function createMonitorAction(options) {
90773
90879
  name,
90774
90880
  monitor_type: monitorType,
90775
90881
  check_interval_seconds: checkInterval,
90776
- environment_id: environmentId
90882
+ environment_id: environmentId,
90883
+ ...checkPath ? { check_path: checkPath } : {}
90777
90884
  }
90778
90885
  });
90779
90886
  if (error3) {
@@ -103265,6 +103372,354 @@ function registerRevenueCommands(program2) {
103265
103372
  });
103266
103373
  }
103267
103374
 
103375
+ // src/commands/session-replay/index.ts
103376
+ init_source();
103377
+ init_sdk_gen();
103378
+ init_spinner();
103379
+ init_output();
103380
+ function formatDuration4(ms) {
103381
+ if (ms == null)
103382
+ return source_default.gray("—");
103383
+ const s = Math.round(ms / 1000);
103384
+ if (s < 60)
103385
+ return `${s}s`;
103386
+ const m = Math.floor(s / 60);
103387
+ const rem = s % 60;
103388
+ return rem > 0 ? `${m}m ${rem}s` : `${m}m`;
103389
+ }
103390
+ function deviceIcon(device) {
103391
+ if (!device)
103392
+ return "?";
103393
+ const d = device.toLowerCase();
103394
+ if (d.includes("mobile"))
103395
+ return "\uD83D\uDCF1";
103396
+ if (d.includes("tablet"))
103397
+ return "\uD83D\uDCDF";
103398
+ return "\uD83D\uDDA5";
103399
+ }
103400
+ function paginationFooter(page, perPage, total) {
103401
+ const totalPages = Math.ceil(total / perPage);
103402
+ if (totalPages > 1) {
103403
+ info2(`Page ${source_default.bold(page)} of ${source_default.bold(totalPages)} · ${source_default.bold(total)} total sessions`);
103404
+ if (page < totalPages) {
103405
+ info2(`Use ${source_default.cyan("--page " + (page + 1))} to see the next page`);
103406
+ }
103407
+ } else {
103408
+ info2(`${source_default.bold(total)} session${total !== 1 ? "s" : ""}`);
103409
+ }
103410
+ }
103411
+ async function listSessions(options) {
103412
+ await requireAuth();
103413
+ await setupClient();
103414
+ const resolved = await requireProjectSlug(options.project);
103415
+ if (resolved.source !== "flag") {
103416
+ info2(`Using project ${colors.bold(resolved.slug)} (from ${resolved.source})`);
103417
+ }
103418
+ const { data: projectData, error: projectError } = await getProjectBySlug({
103419
+ client,
103420
+ path: { slug: resolved.slug }
103421
+ });
103422
+ if (projectError || !projectData)
103423
+ throw new Error(`Project "${resolved.slug}" not found`);
103424
+ const projectId = projectData.id;
103425
+ const page = options.page ? parseInt(options.page, 10) : 1;
103426
+ const perPage = options.perPage ? parseInt(options.perPage, 10) : 25;
103427
+ const environmentId = options.environmentId ? parseInt(options.environmentId, 10) : undefined;
103428
+ const result2 = await withSpinner("Fetching session replays…", async () => {
103429
+ const { data, error: error3 } = await getProjectSessionReplays({
103430
+ client,
103431
+ query: {
103432
+ project_id: projectId,
103433
+ page,
103434
+ per_page: perPage,
103435
+ ...environmentId != null && { environment_id: environmentId }
103436
+ }
103437
+ });
103438
+ if (error3)
103439
+ throw new Error(getErrorMessage(error3));
103440
+ return data;
103441
+ });
103442
+ const sessions = result2?.sessions ?? [];
103443
+ const total = result2?.total_count ?? sessions.length;
103444
+ if (options.json) {
103445
+ json(result2);
103446
+ return;
103447
+ }
103448
+ if (sessions.length === 0) {
103449
+ info2("No session replays found.");
103450
+ return;
103451
+ }
103452
+ header(`Session Replays · ${resolved.slug}`);
103453
+ newline();
103454
+ const columns = [
103455
+ {
103456
+ header: "ID",
103457
+ accessor: (s) => s.session_replay_id.slice(0, 8),
103458
+ width: 10
103459
+ },
103460
+ {
103461
+ header: "Dev",
103462
+ accessor: (s) => deviceIcon(s.device_type),
103463
+ width: 5
103464
+ },
103465
+ {
103466
+ header: "Browser",
103467
+ accessor: (s) => [s.browser, s.browser_version].filter(Boolean).join(" ") || "—",
103468
+ width: 18
103469
+ },
103470
+ {
103471
+ header: "OS",
103472
+ accessor: (s) => s.operating_system ?? "—",
103473
+ width: 14
103474
+ },
103475
+ {
103476
+ header: "Duration",
103477
+ accessor: (s) => formatDuration4(s.duration),
103478
+ align: "right",
103479
+ width: 10
103480
+ },
103481
+ {
103482
+ header: "Country",
103483
+ accessor: (s) => s.visitor_country_code ?? "—",
103484
+ width: 8
103485
+ },
103486
+ {
103487
+ header: "URL",
103488
+ accessor: (s) => s.url ? s.url.replace(/^https?:\/\/[^/]+/, "") || "/" : "—",
103489
+ width: 28
103490
+ },
103491
+ {
103492
+ header: "Started",
103493
+ accessor: (s) => s.created_at ? formatRelativeTime(s.created_at) : "—",
103494
+ width: 14
103495
+ },
103496
+ {
103497
+ header: "Visitor",
103498
+ accessor: (s) => `#${s.visitor_id}`,
103499
+ width: 10
103500
+ }
103501
+ ];
103502
+ printTable(sessions, columns, { style: "minimal" });
103503
+ newline();
103504
+ paginationFooter(page, perPage, total);
103505
+ }
103506
+ async function listVisitorSessions(visitorId, options) {
103507
+ await requireAuth();
103508
+ await setupClient();
103509
+ const vid = parseInt(visitorId, 10);
103510
+ if (isNaN(vid))
103511
+ throw new Error("--visitor-id must be a number");
103512
+ const page = options.page ? parseInt(options.page, 10) : 1;
103513
+ const perPage = options.perPage ? parseInt(options.perPage, 10) : 25;
103514
+ const result2 = await withSpinner(`Fetching sessions for visitor #${vid}…`, async () => {
103515
+ const { data, error: error3 } = await getVisitorSessions({
103516
+ client,
103517
+ path: { visitor_id: vid },
103518
+ query: { page, per_page: perPage }
103519
+ });
103520
+ if (error3)
103521
+ throw new Error(getErrorMessage(error3));
103522
+ return data;
103523
+ });
103524
+ const sessions = result2?.sessions ?? [];
103525
+ const total = result2?.total_count ?? sessions.length;
103526
+ if (options.json) {
103527
+ json(result2);
103528
+ return;
103529
+ }
103530
+ if (sessions.length === 0) {
103531
+ info2(`No sessions found for visitor #${vid}.`);
103532
+ return;
103533
+ }
103534
+ header(`Sessions · Visitor #${vid}`);
103535
+ newline();
103536
+ const columns = [
103537
+ { header: "ID", accessor: (s) => s.session_replay_id.slice(0, 8), width: 10 },
103538
+ { header: "Dev", accessor: (s) => deviceIcon(s.device_type), width: 5 },
103539
+ { header: "Browser", accessor: (s) => s.browser ?? "—", width: 16 },
103540
+ { header: "Duration", accessor: (s) => formatDuration4(s.duration), align: "right", width: 10 },
103541
+ { header: "URL", accessor: (s) => s.url ? s.url.replace(/^https?:\/\/[^/]+/, "") || "/" : "—", width: 32 },
103542
+ { header: "Started", accessor: (s) => s.created_at ? formatRelativeTime(s.created_at) : "—", width: 14 }
103543
+ ];
103544
+ printTable(sessions, columns, { style: "minimal" });
103545
+ newline();
103546
+ paginationFooter(page, perPage, total);
103547
+ }
103548
+ async function showSession(visitorId, sessionId, options) {
103549
+ await requireAuth();
103550
+ await setupClient();
103551
+ const vid = parseInt(visitorId, 10);
103552
+ const sid = parseInt(sessionId, 10);
103553
+ if (isNaN(vid))
103554
+ throw new Error("visitor-id must be a number");
103555
+ if (isNaN(sid))
103556
+ throw new Error("session-id must be a number");
103557
+ const result2 = await withSpinner("Fetching session…", async () => {
103558
+ const { data, error: error3 } = await getSessionReplay({
103559
+ client,
103560
+ path: { visitor_id: vid, session_id: sid }
103561
+ });
103562
+ if (error3)
103563
+ throw new Error(getErrorMessage(error3));
103564
+ return data;
103565
+ });
103566
+ const s = result2?.session;
103567
+ if (!s)
103568
+ throw new Error("Session not found");
103569
+ if (options.json) {
103570
+ json(result2);
103571
+ return;
103572
+ }
103573
+ header(`Session ${s.session_replay_id}`);
103574
+ newline();
103575
+ keyValue("Session ID", s.session_replay_id);
103576
+ keyValue("Visitor ID", String(s.visitor_id));
103577
+ keyValue("Duration", formatDuration4(s.duration));
103578
+ keyValue("URL", s.url ?? "—");
103579
+ keyValue("Browser", [s.browser, s.browser_version].filter(Boolean).join(" ") || "—");
103580
+ keyValue("OS", [s.operating_system, s.operating_system_version].filter(Boolean).join(" ") || "—");
103581
+ keyValue("Device", s.device_type ?? "—");
103582
+ keyValue("Viewport", s.viewport_width && s.viewport_height ? `${s.viewport_width}×${s.viewport_height}` : "—");
103583
+ keyValue("Screen", s.screen_width && s.screen_height ? `${s.screen_width}×${s.screen_height}` : "—");
103584
+ keyValue("Language", s.language ?? "—");
103585
+ keyValue("Timezone", s.timezone ?? "—");
103586
+ keyValue("Country", [s.visitor_country, s.visitor_country_code ? `(${s.visitor_country_code})` : null].filter(Boolean).join(" ") || "—");
103587
+ keyValue("City", s.visitor_city ?? "—");
103588
+ keyValue("Region", s.visitor_region ?? "—");
103589
+ keyValue("Started", s.created_at ? formatRelativeTime(s.created_at) : "—");
103590
+ keyValue("First seen", formatRelativeTime(s.visitor_first_seen));
103591
+ keyValue("Last seen", formatRelativeTime(s.visitor_last_seen));
103592
+ }
103593
+ function eventTypeName(type) {
103594
+ const names = {
103595
+ 0: "DomContentLoaded",
103596
+ 1: "Load",
103597
+ 2: "FullSnapshot",
103598
+ 3: "IncrementalSnapshot",
103599
+ 4: "Meta",
103600
+ 5: "Custom",
103601
+ 6: "Plugin"
103602
+ };
103603
+ if (type == null)
103604
+ return "—";
103605
+ return names[type] ?? `Type${type}`;
103606
+ }
103607
+ async function downloadEvents(visitorId, sessionId, options) {
103608
+ await requireAuth();
103609
+ await setupClient();
103610
+ const vid = parseInt(visitorId, 10);
103611
+ const sid = parseInt(sessionId, 10);
103612
+ if (isNaN(vid))
103613
+ throw new Error("visitor-id must be a number");
103614
+ if (isNaN(sid))
103615
+ throw new Error("session-id must be a number");
103616
+ const result2 = await withSpinner("Fetching session events…", async () => {
103617
+ const { data, error: error3 } = await getSessionReplayEvents({
103618
+ client,
103619
+ path: { visitor_id: vid, session_id: sid }
103620
+ });
103621
+ if (error3)
103622
+ throw new Error(getErrorMessage(error3));
103623
+ return data;
103624
+ });
103625
+ const allEvents = result2?.events ?? [];
103626
+ const session = result2?.session;
103627
+ if (options.json) {
103628
+ json(result2);
103629
+ return;
103630
+ }
103631
+ if (options.output) {
103632
+ const { writeFileSync: writeFileSync5 } = await import("node:fs");
103633
+ const payload = JSON.stringify(result2, null, 2);
103634
+ writeFileSync5(options.output, payload, "utf8");
103635
+ success2(`Wrote ${allEvents.length} events to ${source_default.cyan(options.output)}`);
103636
+ return;
103637
+ }
103638
+ const pageSize = options.limit ? parseInt(options.limit, 10) : 50;
103639
+ const page = options.page ? parseInt(options.page, 10) : 1;
103640
+ const start = (page - 1) * pageSize;
103641
+ const events = allEvents.slice(start, start + pageSize);
103642
+ const totalPages = Math.ceil(allEvents.length / pageSize);
103643
+ header(`Events · Session ${session?.session_replay_id?.slice(0, 8) ?? sid}`);
103644
+ if (session) {
103645
+ newline();
103646
+ keyValue("URL", session.url ?? "—");
103647
+ keyValue("Duration", formatDuration4(session.duration));
103648
+ keyValue("Total events", String(allEvents.length));
103649
+ }
103650
+ newline();
103651
+ if (allEvents.length === 0) {
103652
+ info2("No events recorded for this session.");
103653
+ return;
103654
+ }
103655
+ let rowIndex = start;
103656
+ const columns = [
103657
+ { header: "#", accessor: () => String(++rowIndex), width: 5, align: "right" },
103658
+ { header: "ID", key: "id", width: 8 },
103659
+ { header: "Type", accessor: (e) => eventTypeName(e.event_type), width: 20 },
103660
+ {
103661
+ header: "Timestamp",
103662
+ accessor: (e) => {
103663
+ const d = new Date(e.timestamp);
103664
+ return isNaN(d.getTime()) ? String(e.timestamp) : d.toISOString().replace("T", " ").slice(0, 23);
103665
+ },
103666
+ width: 24
103667
+ },
103668
+ {
103669
+ header: "Data (preview)",
103670
+ accessor: (e) => {
103671
+ const s = JSON.stringify(e.data);
103672
+ return s.length > 60 ? s.slice(0, 57) + "…" : s;
103673
+ },
103674
+ width: 60
103675
+ }
103676
+ ];
103677
+ printTable(events, columns, { style: "minimal" });
103678
+ newline();
103679
+ if (totalPages > 1) {
103680
+ info2(`Page ${source_default.bold(page)} of ${source_default.bold(totalPages)} · ${source_default.bold(allEvents.length)} total events`);
103681
+ if (page < totalPages) {
103682
+ info2(`Use ${source_default.cyan("--page " + (page + 1))} to see the next page`);
103683
+ }
103684
+ newline();
103685
+ info2(`To download all events: ${source_default.cyan(`bunx @temps-sdk/cli session-replay events ${visitorId} ${sessionId} --output events.json`)}`);
103686
+ }
103687
+ }
103688
+ async function deleteSession(visitorId, sessionId, options) {
103689
+ await requireAuth();
103690
+ await setupClient();
103691
+ const vid = parseInt(visitorId, 10);
103692
+ if (isNaN(vid))
103693
+ throw new Error("visitor-id must be a number");
103694
+ if (!options.yes) {
103695
+ const { promptConfirm: promptConfirm3 } = await Promise.resolve().then(() => (init_prompts(), exports_prompts));
103696
+ const ok = await promptConfirm3({
103697
+ message: `Delete session ${source_default.cyan(sessionId)} for visitor #${vid}? This cannot be undone.`
103698
+ });
103699
+ if (!ok) {
103700
+ info2("Cancelled.");
103701
+ return;
103702
+ }
103703
+ }
103704
+ await withSpinner("Deleting session…", async () => {
103705
+ const { error: error3 } = await deleteSessionReplay({
103706
+ client,
103707
+ path: { visitor_id: vid, session_id: sessionId }
103708
+ });
103709
+ if (error3)
103710
+ throw new Error(getErrorMessage(error3));
103711
+ });
103712
+ success2(`Session ${source_default.cyan(sessionId)} deleted.`);
103713
+ }
103714
+ function registerSessionReplayCommands(program2) {
103715
+ const sr = program2.command("session-replay").aliases(["sessions", "replay"]).description("Manage session replay recordings");
103716
+ sr.command("list").aliases(["ls"]).description("List session replays for a project").option("-p, --project <project>", "Project slug or ID").option("--environment-id <id>", "Filter by environment ID").option("--page <n>", "Page number (default: 1)", "1").option("--per-page <n>", "Sessions per page (default: 25, max: 100)", "25").option("--json", "Output raw JSON").action(listSessions);
103717
+ sr.command("visitor <visitor-id>").description("List session replays for a specific visitor").option("--page <n>", "Page number (default: 1)", "1").option("--per-page <n>", "Sessions per page (default: 25)", "25").option("--json", "Output raw JSON").action(listVisitorSessions);
103718
+ sr.command("show <visitor-id> <session-id>").description("Show session metadata (use numeric session ID from list)").option("--json", "Output raw JSON").action(showSession);
103719
+ sr.command("events <visitor-id> <session-id>").description("Download or page through all rrweb events for a session").option("--page <n>", "Page of events to display (default: 1)", "1").option("--limit <n>", "Events per page (default: 50)", "50").option("--output <file>", "Write all events as JSON to a file (skips paged display)").option("--json", "Print all events as JSON to stdout").action(downloadEvents);
103720
+ sr.command("delete <visitor-id> <session-id>").aliases(["rm"]).description("Delete a session replay").option("-y, --yes", "Skip confirmation prompt").action(deleteSession);
103721
+ }
103722
+
103268
103723
  // src/commands/init/index.ts
103269
103724
  init_sdk_gen();
103270
103725
  init_prompts();
@@ -103619,6 +104074,24 @@ async function refinePythonPreset(dir) {
103619
104074
  }
103620
104075
  return { slug: "python", label: "Python", confidence: "low" };
103621
104076
  }
104077
+ var STATIC_DIR_CANDIDATES = ["dist", "build", "out", "public", "_site", "output"];
104078
+ function detectStaticDir(dir) {
104079
+ const projectDir = dir ?? process.cwd();
104080
+ for (const candidate of STATIC_DIR_CANDIDATES) {
104081
+ if (existsSync11(join5(projectDir, candidate, "index.html"))) {
104082
+ return candidate;
104083
+ }
104084
+ }
104085
+ for (const candidate of STATIC_DIR_CANDIDATES) {
104086
+ if (existsSync11(join5(projectDir, candidate))) {
104087
+ return candidate;
104088
+ }
104089
+ }
104090
+ if (existsSync11(join5(projectDir, "index.html"))) {
104091
+ return ".";
104092
+ }
104093
+ return null;
104094
+ }
103622
104095
  function detectGitRemote(dir) {
103623
104096
  try {
103624
104097
  const url = execSync2("git remote get-url origin", {
@@ -103798,7 +104271,8 @@ async function runSetupWizard(options) {
103798
104271
  required: true,
103799
104272
  validate: (v) => v.length >= 2 ? true : "Name must be at least 2 characters"
103800
104273
  }));
103801
- let isGitBased = !options.manual;
104274
+ let isGitBased = !options.manual && !options.static;
104275
+ let isStatic = !!options.static;
103802
104276
  let connectionId = null;
103803
104277
  let repository = null;
103804
104278
  let branch = gitBranch;
@@ -103807,7 +104281,12 @@ async function runSetupWizard(options) {
103807
104281
  let gitUrl = null;
103808
104282
  let presetSlug = detectedPreset?.slug ?? "dockerfile";
103809
104283
  let directory = "./";
103810
- if (options.manual) {
104284
+ const detectedStaticDir = options.staticDir ?? detectStaticDir() ?? undefined;
104285
+ if (options.static) {
104286
+ isStatic = true;
104287
+ isGitBased = false;
104288
+ info2("Static deployment mode selected");
104289
+ } else if (options.manual) {
103811
104290
  isGitBased = false;
103812
104291
  info2("Manual deployment mode selected");
103813
104292
  } else if (options.yes && gitRemote) {
@@ -103821,6 +104300,11 @@ async function runSetupWizard(options) {
103821
104300
  value: "git",
103822
104301
  description: gitRemote ? `Using ${gitRemote.owner}/${gitRemote.repo}` : "Requires a git connection"
103823
104302
  },
104303
+ {
104304
+ name: "Static (upload a pre-built folder)",
104305
+ value: "static",
104306
+ description: detectedStaticDir ? `Detected ./${detectedStaticDir}` : "Upload HTML/CSS/JS — no Docker, no git"
104307
+ },
103824
104308
  {
103825
104309
  name: "Manual (upload Docker images from CLI)",
103826
104310
  value: "manual",
@@ -103830,6 +104314,27 @@ async function runSetupWizard(options) {
103830
104314
  default: "git"
103831
104315
  });
103832
104316
  isGitBased = deployMethod === "git";
104317
+ isStatic = deployMethod === "static";
104318
+ }
104319
+ let staticDir = detectedStaticDir ?? "./";
104320
+ if (isStatic) {
104321
+ presetSlug = "dockerfile";
104322
+ if (options.staticDir) {
104323
+ staticDir = options.staticDir;
104324
+ } else if (!options.yes) {
104325
+ staticDir = await promptText({
104326
+ message: "Folder to upload (built static output)",
104327
+ default: detectedStaticDir ?? "dist",
104328
+ required: true
104329
+ });
104330
+ } else {
104331
+ staticDir = detectedStaticDir ?? "dist";
104332
+ }
104333
+ if (!existsSync12(resolve7(staticDir))) {
104334
+ warning2(`Folder not found: ${colors.bold(staticDir)}`);
104335
+ info2("Build your project first, then re-run, or pass --static-dir <path>.");
104336
+ return null;
104337
+ }
103833
104338
  }
103834
104339
  if (isGitBased) {
103835
104340
  const gitSetup = await setupGitConnection(gitRemote, options.yes);
@@ -103867,7 +104372,7 @@ async function runSetupWizard(options) {
103867
104372
  }
103868
104373
  }
103869
104374
  }
103870
- if (!isGitBased && !options.preset) {
104375
+ if (!isGitBased && !isStatic && !options.preset) {
103871
104376
  if (detectedPreset) {
103872
104377
  if (!options.yes) {
103873
104378
  const useDetected = await promptConfirm({
@@ -103896,14 +104401,15 @@ async function runSetupWizard(options) {
103896
104401
  }
103897
104402
  newline();
103898
104403
  const serviceNames = serviceIds.length > 0 ? `${serviceIds.length} service(s) linked` : "None";
104404
+ const deployLabel = isGitBased ? "Automatic (on push)" : isStatic ? "Static (folder upload)" : "Manual (CLI upload)";
103899
104405
  box([
103900
104406
  `Project: ${colors.bold(projectName)}`,
103901
- `Preset: ${colors.bold(presetSlug)}`,
103902
- `Directory: ${colors.bold(directory)}`,
104407
+ isStatic ? null : `Preset: ${colors.bold(presetSlug)}`,
104408
+ isStatic ? `Folder: ${colors.bold(staticDir)}` : `Directory: ${colors.bold(directory)}`,
103903
104409
  isGitBased && repoOwner && repoName ? `Repository: ${colors.bold(`${repoOwner}/${repoName}`)}` : null,
103904
- `Branch: ${colors.bold(branch)}`,
104410
+ isStatic ? null : `Branch: ${colors.bold(branch)}`,
103905
104411
  `Services: ${colors.bold(serviceNames)}`,
103906
- `Deploy: ${colors.bold(isGitBased ? "Automatic (on push)" : "Manual (CLI upload)")}`
104412
+ `Deploy: ${colors.bold(deployLabel)}`
103907
104413
  ].filter(Boolean).join(`
103908
104414
  `), `${icons.rocket} Deployment Preview`);
103909
104415
  newline();
@@ -103930,7 +104436,8 @@ async function runSetupWizard(options) {
103930
104436
  git_url: gitUrl,
103931
104437
  git_provider_connection_id: connectionId,
103932
104438
  automatic_deploy: isGitBased,
103933
- source_type: isGitBased ? "git" : "manual",
104439
+ source_type: isGitBased ? "git" : isStatic ? "static_files" : "manual",
104440
+ project_type: isStatic ? "static" : "docker",
103934
104441
  storage_service_ids: serviceIds
103935
104442
  }
103936
104443
  });
@@ -103953,7 +104460,21 @@ async function runSetupWizard(options) {
103953
104460
  keyValue("Dashboard", colors.primary(dashboardUrl));
103954
104461
  keyValue("Config", colors.muted(configPath));
103955
104462
  newline();
103956
- if (isGitBased) {
104463
+ if (isStatic) {
104464
+ info2(`Uploading ${colors.bold(staticDir)} and deploying...`);
104465
+ newline();
104466
+ try {
104467
+ await deployStatic({
104468
+ path: staticDir,
104469
+ project: project.slug,
104470
+ yes: true
104471
+ });
104472
+ } catch {
104473
+ newline();
104474
+ warning2("Static deploy failed. You can retry with:");
104475
+ info2(` ${colors.muted(`temps deploy:static -p ${project.slug} --path ${staticDir}`)}`);
104476
+ }
104477
+ } else if (isGitBased) {
103957
104478
  info2("Triggering first deployment...");
103958
104479
  newline();
103959
104480
  try {
@@ -104168,6 +104689,8 @@ async function up(projectArg, options) {
104168
104689
  preset: options.preset,
104169
104690
  branch: options.branch,
104170
104691
  manual: options.manual,
104692
+ static: options.static,
104693
+ staticDir: options.staticDir,
104171
104694
  noServices: options.noServices,
104172
104695
  yes: options.yes
104173
104696
  });
@@ -104184,18 +104707,32 @@ async function up(projectArg, options) {
104184
104707
  let project;
104185
104708
  let environments = [];
104186
104709
  try {
104187
- const { data, error: error4 } = await getProjectBySlug({
104710
+ const { data, error: error3 } = await getProjectBySlug({
104188
104711
  client,
104189
104712
  path: { slug: resolved.slug }
104190
104713
  });
104191
- if (error4 || !data) {
104192
- const rawApiUrl = config.get("apiUrl");
104193
- const baseUrl = client.getConfig().baseUrl ?? rawApiUrl;
104194
- failSpinner(`Project "${resolved.slug}" not found`);
104195
- info2(`API: ${colors.muted(`${baseUrl}/projects/by-slug/${resolved.slug}`)}`);
104196
- if (error4) {
104197
- info2(`Error: ${getErrorMessage(error4)}`);
104714
+ if (error3 || !data) {
104715
+ if (resolved.source === "flag") {
104716
+ const rawApiUrl = config.get("apiUrl");
104717
+ const baseUrl = client.getConfig().baseUrl ?? rawApiUrl;
104718
+ failSpinner(`Project "${resolved.slug}" not found`);
104719
+ info2(`API: ${colors.muted(`${baseUrl}/projects/by-slug/${resolved.slug}`)}`);
104720
+ if (error3) {
104721
+ info2(`Error: ${getErrorMessage(error3)}`);
104722
+ }
104723
+ return;
104198
104724
  }
104725
+ failSpinner(`No project "${resolved.slug}" on this server (from ${resolved.source})`);
104726
+ info2("Setting up a new project instead...");
104727
+ newline();
104728
+ const result2 = await runSetupWizard({
104729
+ name: options.name,
104730
+ preset: options.preset,
104731
+ branch: options.branch,
104732
+ manual: options.manual,
104733
+ noServices: options.noServices,
104734
+ yes: options.yes
104735
+ });
104199
104736
  return;
104200
104737
  }
104201
104738
  project = data;
@@ -104380,7 +104917,7 @@ async function up(projectArg, options) {
104380
104917
  }
104381
104918
  }
104382
104919
  function registerUpCommand(program2) {
104383
- program2.command("up [project]").description("Deploy the current project (runs setup wizard if not linked)").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name").option("-b, --branch <branch>", "Git branch to deploy (auto-detected from cwd)").option("-n, --name <name>", "Project name (for new projects)").option("--preset <preset>", "Framework preset slug (skip auto-detection)").option("--manual", "Use manual deployment mode (no git)").option("--no-services", "Skip external service setup").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts").action((projectArg, opts) => {
104920
+ program2.command("up [project]").description("Deploy the current project (runs setup wizard if not linked)").option("-p, --project <project>", "Project slug or ID").option("-e, --environment <env>", "Target environment name").option("-b, --branch <branch>", "Git branch to deploy (auto-detected from cwd)").option("-n, --name <name>", "Project name (for new projects)").option("--preset <preset>", "Framework preset slug (skip auto-detection)").option("--manual", "Use manual deployment mode (no git)").option("--static", "Deploy a pre-built static folder (no Docker, no git)").option("--static-dir <dir>", "Folder to upload for static deploys (auto-detected by default)").option("--no-services", "Skip external service setup").option("--no-wait", "Do not wait for deployment to complete").option("-y, --yes", "Skip confirmation prompts").action((projectArg, opts) => {
104384
104921
  if (projectArg && !opts.project) {
104385
104922
  opts.project = projectArg;
104386
104923
  }
@@ -104397,11 +104934,11 @@ async function status2(projectArg, options) {
104397
104934
  await setupClient();
104398
104935
  const resolved = await requireProjectSlug(projectArg ?? options.project);
104399
104936
  const projectData = await withSpinner("Fetching project status...", async () => {
104400
- const { data, error: error4 } = await getProjectBySlug({
104937
+ const { data, error: error3 } = await getProjectBySlug({
104401
104938
  client,
104402
104939
  path: { slug: resolved.slug }
104403
104940
  });
104404
- if (error4 || !data) {
104941
+ if (error3 || !data) {
104405
104942
  throw new Error(`Project "${resolved.slug}" not found`);
104406
104943
  }
104407
104944
  return data;
@@ -104699,11 +105236,11 @@ init_spinner();
104699
105236
  init_prompts();
104700
105237
  init_output();
104701
105238
  async function resolveProjectId8(slug) {
104702
- const { data, error: error4 } = await getProjectBySlug({
105239
+ const { data, error: error3 } = await getProjectBySlug({
104703
105240
  client,
104704
105241
  path: { slug }
104705
105242
  });
104706
- if (error4 || !data) {
105243
+ if (error3 || !data) {
104707
105244
  throw new Error(`Project "${slug}" not found`);
104708
105245
  }
104709
105246
  return data.id;
@@ -105062,12 +105599,12 @@ async function exec3(_command, options) {
105062
105599
  const targetEnv = options.environment ? environments.find((e) => e.name.toLowerCase() === options.environment.toLowerCase() || e.slug === options.environment) : environments[0];
105063
105600
  if (!targetEnv)
105064
105601
  return [];
105065
- const { data, error: error4 } = await listContainers({
105602
+ const { data, error: error3 } = await listContainers({
105066
105603
  client,
105067
105604
  path: { project_id: project.id, environment_id: targetEnv.id }
105068
105605
  });
105069
- if (error4)
105070
- throw new Error(getErrorMessage(error4));
105606
+ if (error3)
105607
+ throw new Error(getErrorMessage(error3));
105071
105608
  return data?.containers ?? [];
105072
105609
  });
105073
105610
  if (containers.length > 0) {
@@ -105758,6 +106295,7 @@ function createProgram() {
105758
106295
  registerSandboxCommands(program2);
105759
106296
  registerWorkflowCommands(program2);
105760
106297
  registerRevenueCommands(program2);
106298
+ registerSessionReplayCommands(program2);
105761
106299
  registerInitCommand(program2);
105762
106300
  registerLinkCommand(program2);
105763
106301
  registerUpCommand(program2);
@@ -106095,6 +106633,7 @@ function createProgram2() {
106095
106633
  registerSandboxCommands(program2);
106096
106634
  registerWorkflowCommands(program2);
106097
106635
  registerRevenueCommands(program2);
106636
+ registerSessionReplayCommands(program2);
106098
106637
  registerInitCommand(program2);
106099
106638
  registerLinkCommand(program2);
106100
106639
  registerUpCommand(program2);
@@ -106136,8 +106675,8 @@ async function run() {
106136
106675
  const program2 = createProgram2();
106137
106676
  try {
106138
106677
  await program2.parseAsync(process.argv);
106139
- } catch (error4) {
106140
- handleError(error4);
106678
+ } catch (error3) {
106679
+ handleError(error3);
106141
106680
  }
106142
106681
  }
106143
106682
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temps-sdk/cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "CLI for Temps deployment platform",
5
5
  "type": "module",
6
6
  "bin": {