@temps-sdk/cli 0.1.25 → 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 +682 -134
  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();
@@ -74681,18 +74715,24 @@ function normalizeApiUrl(url) {
74681
74715
  }
74682
74716
  return normalized;
74683
74717
  }
74684
- async function setupClient(baseUrlOverride) {
74718
+ var pinnedApiKey;
74719
+ var interceptorRegistered = false;
74720
+ async function setupClient(baseUrlOverride, apiKeyOverride) {
74685
74721
  const apiUrl = normalizeApiUrl(baseUrlOverride ?? config.get("apiUrl"));
74722
+ pinnedApiKey = apiKeyOverride;
74686
74723
  client.setConfig({
74687
74724
  baseUrl: apiUrl
74688
74725
  });
74689
- client.interceptors.request.use(async (request) => {
74690
- const apiKey = await credentials.getApiKey();
74691
- if (apiKey) {
74692
- request.headers.set("Authorization", `Bearer ${apiKey}`);
74693
- }
74694
- return request;
74695
- });
74726
+ if (!interceptorRegistered) {
74727
+ interceptorRegistered = true;
74728
+ client.interceptors.request.use(async (request) => {
74729
+ const apiKey = pinnedApiKey ?? await credentials.getApiKey();
74730
+ if (apiKey) {
74731
+ request.headers.set("Authorization", `Bearer ${apiKey}`);
74732
+ }
74733
+ return request;
74734
+ });
74735
+ }
74696
74736
  }
74697
74737
  function getWebUrl() {
74698
74738
  return config.get("apiUrl").replace(/\/+$/, "").replace(/\/api$/, "");
@@ -74971,8 +75011,7 @@ async function loginWithApiKey(apiKey, opts = {}) {
74971
75011
  debugLog(`api-key login resolved apiUrl: ${baseUrl}`);
74972
75012
  debugLog(`raw url arg: ${opts.url ?? "(none, using config apiUrl)"}`);
74973
75013
  }
74974
- await credentials.set("apiKey", key);
74975
- await setupClient(baseUrl);
75014
+ await setupClient(baseUrl, key);
74976
75015
  try {
74977
75016
  const result = await withSpinner("Validating API key...", async () => {
74978
75017
  const { data, error: error3 } = await getCurrentUser({ client });
@@ -74999,9 +75038,13 @@ async function loginWithApiKey(apiKey, opts = {}) {
74999
75038
  keyPrefix: key.slice(0, 8)
75000
75039
  });
75001
75040
  displayWelcome(result.email, ctxName, baseUrl);
75002
- } catch {
75003
- await credentials.clear();
75004
- throw new AuthenticationError("Invalid API key");
75041
+ } catch (err) {
75042
+ if (debug && err instanceof Error) {
75043
+ debugLog(`api-key validation failed: ${err.message}`);
75044
+ }
75045
+ throw new AuthenticationError(err instanceof AuthenticationError ? err.message : `Invalid API key (validated against ${baseUrl})`);
75046
+ } finally {
75047
+ await setupClient(baseUrl);
75005
75048
  }
75006
75049
  }
75007
75050
  function displayWelcome(email, contextName, baseUrl, meta) {
@@ -75417,6 +75460,30 @@ async function removeAction(name) {
75417
75460
  info2(`Active context is now ${colors.bold(remaining.name)}.`);
75418
75461
  }
75419
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
+ }
75420
75487
  async function currentAction(options) {
75421
75488
  const active = await getActiveContext();
75422
75489
  if (!active) {
@@ -75444,9 +75511,100 @@ function registerContextCommands(program2) {
75444
75511
  ctx.command("list").alias("ls").description("List all configured contexts").option("--json", "Output in JSON format").action(listAction);
75445
75512
  ctx.command("use <name>").alias("switch").description("Switch the active context").action(useAction);
75446
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);
75447
75515
  ctx.command("current").description("Print the active context name").option("--json", "Output in JSON format with full details").action(currentAction);
75448
75516
  }
75449
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
+
75450
75608
  // src/commands/configure.ts
75451
75609
  init_prompts();
75452
75610
  init_output();
@@ -75620,10 +75778,14 @@ function getConfigValue(key) {
75620
75778
  console.error(colors.muted(`Valid keys: ${validKeys.join(", ")}`));
75621
75779
  process.exit(1);
75622
75780
  }
75781
+ if (key === "defaultProject") {
75782
+ console.log(getActiveDefaultProjectSync() ?? config.get("defaultProject") ?? "");
75783
+ return;
75784
+ }
75623
75785
  const value = config.get(key);
75624
75786
  console.log(value ?? "");
75625
75787
  }
75626
- function setConfigValue(key, value) {
75788
+ async function setConfigValue(key, value) {
75627
75789
  const validKeys = [
75628
75790
  "apiUrl",
75629
75791
  "defaultProject",
@@ -75636,6 +75798,11 @@ function setConfigValue(key, value) {
75636
75798
  console.error(colors.muted(`Valid keys: ${validKeys.join(", ")}`));
75637
75799
  process.exit(1);
75638
75800
  }
75801
+ if (key === "defaultProject") {
75802
+ await setDefaultProject(value);
75803
+ success2(`Set ${key} = ${value}`);
75804
+ return;
75805
+ }
75639
75806
  let typedValue = value;
75640
75807
  if (key === "colorEnabled") {
75641
75808
  typedValue = value === "true" || value === "1";
@@ -75809,7 +75976,7 @@ init_output();
75809
75976
  init_sdk_gen();
75810
75977
 
75811
75978
  // src/lib/env-file.ts
75812
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
75979
+ import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
75813
75980
  import { resolve } from "node:path";
75814
75981
  function parseEnvFile(content) {
75815
75982
  const variables = {};
@@ -75835,7 +76002,7 @@ function parseEnvFile(content) {
75835
76002
  }
75836
76003
  function readEnvFile(filePath) {
75837
76004
  const resolved = resolve(filePath);
75838
- if (!existsSync3(resolved)) {
76005
+ if (!existsSync4(resolved)) {
75839
76006
  return null;
75840
76007
  }
75841
76008
  const content = readFileSync3(resolved, "utf-8");
@@ -75847,7 +76014,7 @@ function findEnvFiles(dir) {
75847
76014
  const found = [];
75848
76015
  for (const name of candidates) {
75849
76016
  const fullPath = resolve(cwd, name);
75850
- if (existsSync3(fullPath)) {
76017
+ if (existsSync4(fullPath)) {
75851
76018
  found.push(name);
75852
76019
  }
75853
76020
  }
@@ -76475,7 +76642,7 @@ async function create(options) {
76475
76642
  }
76476
76643
  newline();
76477
76644
  if (skipPrompts) {
76478
- config.set("defaultProject", project.slug);
76645
+ await setDefaultProject(project.slug);
76479
76646
  success2(`Default project set to "${project.slug}"`);
76480
76647
  } else {
76481
76648
  const setDefault = await promptConfirm({
@@ -76483,7 +76650,7 @@ async function create(options) {
76483
76650
  default: true
76484
76651
  });
76485
76652
  if (setDefault) {
76486
- config.set("defaultProject", project.slug);
76653
+ await setDefaultProject(project.slug);
76487
76654
  success2(`Default project set to "${project.slug}"`);
76488
76655
  }
76489
76656
  }
@@ -76583,7 +76750,7 @@ async function createManualProject(options, sourceType, skipPrompts) {
76583
76750
  }
76584
76751
  newline();
76585
76752
  if (skipPrompts) {
76586
- config.set("defaultProject", project.slug);
76753
+ await setDefaultProject(project.slug);
76587
76754
  success2(`Default project set to "${project.slug}"`);
76588
76755
  } else {
76589
76756
  const setDefault = await promptConfirm({
@@ -76591,7 +76758,7 @@ async function createManualProject(options, sourceType, skipPrompts) {
76591
76758
  default: true
76592
76759
  });
76593
76760
  if (setDefault) {
76594
- config.set("defaultProject", project.slug);
76761
+ await setDefaultProject(project.slug);
76595
76762
  success2(`Default project set to "${project.slug}"`);
76596
76763
  }
76597
76764
  }
@@ -76734,86 +76901,6 @@ async function configureEnvironmentVariables() {
76734
76901
  return envVars;
76735
76902
  }
76736
76903
 
76737
- // src/config/project-config.ts
76738
- import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4 } from "node:fs/promises";
76739
- import { existsSync as existsSync4 } from "node:fs";
76740
- import { join, dirname as dirname3 } from "node:path";
76741
- var CONFIG_DIR = ".temps";
76742
- var CONFIG_FILE = "config.json";
76743
- var GITIGNORE_FILE = ".gitignore";
76744
- function findProjectConfigDir(startDir) {
76745
- let dir = startDir ?? process.cwd();
76746
- while (true) {
76747
- const configPath = join(dir, CONFIG_DIR, CONFIG_FILE);
76748
- if (existsSync4(configPath)) {
76749
- return join(dir, CONFIG_DIR);
76750
- }
76751
- const parent = dirname3(dir);
76752
- if (parent === dir)
76753
- break;
76754
- dir = parent;
76755
- }
76756
- return null;
76757
- }
76758
- async function readProjectConfig() {
76759
- const configDir = findProjectConfigDir();
76760
- if (!configDir)
76761
- return null;
76762
- try {
76763
- const configPath = join(configDir, CONFIG_FILE);
76764
- const content = await readFile4(configPath, "utf-8");
76765
- return JSON.parse(content);
76766
- } catch {
76767
- return null;
76768
- }
76769
- }
76770
- async function writeProjectConfig(config2) {
76771
- const configDir = join(process.cwd(), CONFIG_DIR);
76772
- await mkdir4(configDir, { recursive: true });
76773
- const configPath = join(configDir, CONFIG_FILE);
76774
- await writeFile4(configPath, JSON.stringify(config2, null, 2) + `
76775
- `, "utf-8");
76776
- const gitignorePath = join(configDir, GITIGNORE_FILE);
76777
- if (!existsSync4(gitignorePath)) {
76778
- await writeFile4(gitignorePath, `*
76779
- `, "utf-8");
76780
- }
76781
- return configPath;
76782
- }
76783
- function hasProjectConfig() {
76784
- return findProjectConfigDir() !== null;
76785
- }
76786
-
76787
- // src/config/resolve-project.ts
76788
- async function resolveProjectSlug(flagValue) {
76789
- if (flagValue) {
76790
- return { slug: flagValue, source: "flag" };
76791
- }
76792
- const localConfig = await readProjectConfig();
76793
- if (localConfig?.projectSlug) {
76794
- return { slug: localConfig.projectSlug, source: "local-config" };
76795
- }
76796
- const envProject = process.env.TEMPS_PROJECT;
76797
- if (envProject) {
76798
- return { slug: envProject, source: "env-var" };
76799
- }
76800
- const defaultProject = config.get("defaultProject");
76801
- if (defaultProject) {
76802
- return { slug: defaultProject, source: "global-config" };
76803
- }
76804
- return null;
76805
- }
76806
- async function requireProjectSlug(flagValue) {
76807
- const resolved = await resolveProjectSlug(flagValue);
76808
- if (resolved)
76809
- return resolved;
76810
- throw new Error(`No project specified. You can:
76811
- ` + ` • Pass --project <slug> flag
76812
- ` + ` • Run "temps link" to link this directory to a project
76813
- ` + ` • Set TEMPS_PROJECT environment variable
76814
- ` + ' • Run "temps configure" to set a default project');
76815
- }
76816
-
76817
76904
  // src/commands/projects/show.ts
76818
76905
  init_spinner();
76819
76906
  init_output();
@@ -76907,6 +76994,9 @@ async function remove(options) {
76907
76994
  }
76908
76995
  });
76909
76996
  success2(`Project "${projectIdOrName}" deleted`);
76997
+ if (getActiveDefaultProjectSync() === projectIdOrName) {
76998
+ await setDefaultProject(undefined);
76999
+ }
76910
77000
  if (config.get("defaultProject") === projectIdOrName) {
76911
77001
  config.set("defaultProject", undefined);
76912
77002
  }
@@ -82862,6 +82952,13 @@ ${colors.dim("(freshly built)")}` : ""), `${icons.rocket} Deploy Local Image`);
82862
82952
  if (options.tag) {
82863
82953
  queryParams.set("tag", options.tag);
82864
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
+ }
82865
82962
  const finalUrl = queryParams.toString() ? `${uploadUrl}?${queryParams.toString()}` : uploadUrl;
82866
82963
  const file = Bun.file(tempFilePath);
82867
82964
  const filename = `${imageName.replace(/[/:]/g, "-")}.tar`;
@@ -83371,9 +83468,15 @@ async function deployStatic(options) {
83371
83468
  succeedSpinner(`Bundle uploaded: id=${bundle.id}`);
83372
83469
  startSpinner("Starting deployment...");
83373
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
+ }
83374
83476
  const deployBody = {
83375
83477
  static_bundle_id: bundle.id,
83376
- metadata: options.metadata ? JSON.parse(options.metadata) : undefined
83478
+ metadata: options.metadata ? JSON.parse(options.metadata) : undefined,
83479
+ ...healthCheckPath ? { health_check_path: healthCheckPath } : {}
83377
83480
  };
83378
83481
  const deployResponse = await fetch(deployUrl, {
83379
83482
  method: "POST",
@@ -83974,6 +84077,14 @@ async function deployImage(options) {
83974
84077
  return;
83975
84078
  }
83976
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
+ }
83977
84088
  const deployResponse = await fetch(deployUrl, {
83978
84089
  method: "POST",
83979
84090
  headers: {
@@ -84544,9 +84655,9 @@ function registerDeployCommands(program2) {
84544
84655
  }
84545
84656
  return deploy(options);
84546
84657
  });
84547
- 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);
84548
- 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);
84549
- 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);
84550
84661
  const deployments = program2.command("deployments").alias("deploys").description("Manage deployments");
84551
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);
84552
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);
@@ -90664,7 +90775,7 @@ var CHECK_INTERVALS = [
90664
90775
  function registerMonitorsCommands(program2) {
90665
90776
  const monitors = program2.command("monitors").alias("monitoring").description("Manage uptime monitors for status pages");
90666
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);
90667
- 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);
90668
90779
  monitors.command("show").description("Show monitor details and current status").requiredOption("--id <id>", "Monitor ID").option("--json", "Output in JSON format").action(showMonitor);
90669
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);
90670
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);
@@ -90756,6 +90867,10 @@ async function createMonitorAction(options) {
90756
90867
  });
90757
90868
  environmentId = options.environmentId ? parseInt(options.environmentId, 10) : 0;
90758
90869
  }
90870
+ const checkPath = options.checkPath?.trim();
90871
+ if (checkPath && !checkPath.startsWith("/")) {
90872
+ throw new Error(`--check-path must start with "/" (got "${checkPath}")`);
90873
+ }
90759
90874
  await withSpinner("Creating monitor...", async () => {
90760
90875
  const { error: error3 } = await createMonitor({
90761
90876
  client,
@@ -90764,7 +90879,8 @@ async function createMonitorAction(options) {
90764
90879
  name,
90765
90880
  monitor_type: monitorType,
90766
90881
  check_interval_seconds: checkInterval,
90767
- environment_id: environmentId
90882
+ environment_id: environmentId,
90883
+ ...checkPath ? { check_path: checkPath } : {}
90768
90884
  }
90769
90885
  });
90770
90886
  if (error3) {
@@ -103256,6 +103372,354 @@ function registerRevenueCommands(program2) {
103256
103372
  });
103257
103373
  }
103258
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
+
103259
103723
  // src/commands/init/index.ts
103260
103724
  init_sdk_gen();
103261
103725
  init_prompts();
@@ -103610,6 +104074,24 @@ async function refinePythonPreset(dir) {
103610
104074
  }
103611
104075
  return { slug: "python", label: "Python", confidence: "low" };
103612
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
+ }
103613
104095
  function detectGitRemote(dir) {
103614
104096
  try {
103615
104097
  const url = execSync2("git remote get-url origin", {
@@ -103789,7 +104271,8 @@ async function runSetupWizard(options) {
103789
104271
  required: true,
103790
104272
  validate: (v) => v.length >= 2 ? true : "Name must be at least 2 characters"
103791
104273
  }));
103792
- let isGitBased = !options.manual;
104274
+ let isGitBased = !options.manual && !options.static;
104275
+ let isStatic = !!options.static;
103793
104276
  let connectionId = null;
103794
104277
  let repository = null;
103795
104278
  let branch = gitBranch;
@@ -103798,7 +104281,12 @@ async function runSetupWizard(options) {
103798
104281
  let gitUrl = null;
103799
104282
  let presetSlug = detectedPreset?.slug ?? "dockerfile";
103800
104283
  let directory = "./";
103801
- 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) {
103802
104290
  isGitBased = false;
103803
104291
  info2("Manual deployment mode selected");
103804
104292
  } else if (options.yes && gitRemote) {
@@ -103812,6 +104300,11 @@ async function runSetupWizard(options) {
103812
104300
  value: "git",
103813
104301
  description: gitRemote ? `Using ${gitRemote.owner}/${gitRemote.repo}` : "Requires a git connection"
103814
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
+ },
103815
104308
  {
103816
104309
  name: "Manual (upload Docker images from CLI)",
103817
104310
  value: "manual",
@@ -103821,6 +104314,27 @@ async function runSetupWizard(options) {
103821
104314
  default: "git"
103822
104315
  });
103823
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
+ }
103824
104338
  }
103825
104339
  if (isGitBased) {
103826
104340
  const gitSetup = await setupGitConnection(gitRemote, options.yes);
@@ -103858,7 +104372,7 @@ async function runSetupWizard(options) {
103858
104372
  }
103859
104373
  }
103860
104374
  }
103861
- if (!isGitBased && !options.preset) {
104375
+ if (!isGitBased && !isStatic && !options.preset) {
103862
104376
  if (detectedPreset) {
103863
104377
  if (!options.yes) {
103864
104378
  const useDetected = await promptConfirm({
@@ -103887,14 +104401,15 @@ async function runSetupWizard(options) {
103887
104401
  }
103888
104402
  newline();
103889
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)";
103890
104405
  box([
103891
104406
  `Project: ${colors.bold(projectName)}`,
103892
- `Preset: ${colors.bold(presetSlug)}`,
103893
- `Directory: ${colors.bold(directory)}`,
104407
+ isStatic ? null : `Preset: ${colors.bold(presetSlug)}`,
104408
+ isStatic ? `Folder: ${colors.bold(staticDir)}` : `Directory: ${colors.bold(directory)}`,
103894
104409
  isGitBased && repoOwner && repoName ? `Repository: ${colors.bold(`${repoOwner}/${repoName}`)}` : null,
103895
- `Branch: ${colors.bold(branch)}`,
104410
+ isStatic ? null : `Branch: ${colors.bold(branch)}`,
103896
104411
  `Services: ${colors.bold(serviceNames)}`,
103897
- `Deploy: ${colors.bold(isGitBased ? "Automatic (on push)" : "Manual (CLI upload)")}`
104412
+ `Deploy: ${colors.bold(deployLabel)}`
103898
104413
  ].filter(Boolean).join(`
103899
104414
  `), `${icons.rocket} Deployment Preview`);
103900
104415
  newline();
@@ -103921,7 +104436,8 @@ async function runSetupWizard(options) {
103921
104436
  git_url: gitUrl,
103922
104437
  git_provider_connection_id: connectionId,
103923
104438
  automatic_deploy: isGitBased,
103924
- source_type: isGitBased ? "git" : "manual",
104439
+ source_type: isGitBased ? "git" : isStatic ? "static_files" : "manual",
104440
+ project_type: isStatic ? "static" : "docker",
103925
104441
  storage_service_ids: serviceIds
103926
104442
  }
103927
104443
  });
@@ -103944,7 +104460,21 @@ async function runSetupWizard(options) {
103944
104460
  keyValue("Dashboard", colors.primary(dashboardUrl));
103945
104461
  keyValue("Config", colors.muted(configPath));
103946
104462
  newline();
103947
- 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) {
103948
104478
  info2("Triggering first deployment...");
103949
104479
  newline();
103950
104480
  try {
@@ -104159,6 +104689,8 @@ async function up(projectArg, options) {
104159
104689
  preset: options.preset,
104160
104690
  branch: options.branch,
104161
104691
  manual: options.manual,
104692
+ static: options.static,
104693
+ staticDir: options.staticDir,
104162
104694
  noServices: options.noServices,
104163
104695
  yes: options.yes
104164
104696
  });
@@ -104175,18 +104707,32 @@ async function up(projectArg, options) {
104175
104707
  let project;
104176
104708
  let environments = [];
104177
104709
  try {
104178
- const { data, error: error4 } = await getProjectBySlug({
104710
+ const { data, error: error3 } = await getProjectBySlug({
104179
104711
  client,
104180
104712
  path: { slug: resolved.slug }
104181
104713
  });
104182
- if (error4 || !data) {
104183
- const rawApiUrl = config.get("apiUrl");
104184
- const baseUrl = client.getConfig().baseUrl ?? rawApiUrl;
104185
- failSpinner(`Project "${resolved.slug}" not found`);
104186
- info2(`API: ${colors.muted(`${baseUrl}/projects/by-slug/${resolved.slug}`)}`);
104187
- if (error4) {
104188
- 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;
104189
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
+ });
104190
104736
  return;
104191
104737
  }
104192
104738
  project = data;
@@ -104371,7 +104917,7 @@ async function up(projectArg, options) {
104371
104917
  }
104372
104918
  }
104373
104919
  function registerUpCommand(program2) {
104374
- 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) => {
104375
104921
  if (projectArg && !opts.project) {
104376
104922
  opts.project = projectArg;
104377
104923
  }
@@ -104388,11 +104934,11 @@ async function status2(projectArg, options) {
104388
104934
  await setupClient();
104389
104935
  const resolved = await requireProjectSlug(projectArg ?? options.project);
104390
104936
  const projectData = await withSpinner("Fetching project status...", async () => {
104391
- const { data, error: error4 } = await getProjectBySlug({
104937
+ const { data, error: error3 } = await getProjectBySlug({
104392
104938
  client,
104393
104939
  path: { slug: resolved.slug }
104394
104940
  });
104395
- if (error4 || !data) {
104941
+ if (error3 || !data) {
104396
104942
  throw new Error(`Project "${resolved.slug}" not found`);
104397
104943
  }
104398
104944
  return data;
@@ -104690,11 +105236,11 @@ init_spinner();
104690
105236
  init_prompts();
104691
105237
  init_output();
104692
105238
  async function resolveProjectId8(slug) {
104693
- const { data, error: error4 } = await getProjectBySlug({
105239
+ const { data, error: error3 } = await getProjectBySlug({
104694
105240
  client,
104695
105241
  path: { slug }
104696
105242
  });
104697
- if (error4 || !data) {
105243
+ if (error3 || !data) {
104698
105244
  throw new Error(`Project "${slug}" not found`);
104699
105245
  }
104700
105246
  return data.id;
@@ -105053,12 +105599,12 @@ async function exec3(_command, options) {
105053
105599
  const targetEnv = options.environment ? environments.find((e) => e.name.toLowerCase() === options.environment.toLowerCase() || e.slug === options.environment) : environments[0];
105054
105600
  if (!targetEnv)
105055
105601
  return [];
105056
- const { data, error: error4 } = await listContainers({
105602
+ const { data, error: error3 } = await listContainers({
105057
105603
  client,
105058
105604
  path: { project_id: project.id, environment_id: targetEnv.id }
105059
105605
  });
105060
- if (error4)
105061
- throw new Error(getErrorMessage(error4));
105606
+ if (error3)
105607
+ throw new Error(getErrorMessage(error3));
105062
105608
  return data?.containers ?? [];
105063
105609
  });
105064
105610
  if (containers.length > 0) {
@@ -105749,6 +106295,7 @@ function createProgram() {
105749
106295
  registerSandboxCommands(program2);
105750
106296
  registerWorkflowCommands(program2);
105751
106297
  registerRevenueCommands(program2);
106298
+ registerSessionReplayCommands(program2);
105752
106299
  registerInitCommand(program2);
105753
106300
  registerLinkCommand(program2);
105754
106301
  registerUpCommand(program2);
@@ -106086,6 +106633,7 @@ function createProgram2() {
106086
106633
  registerSandboxCommands(program2);
106087
106634
  registerWorkflowCommands(program2);
106088
106635
  registerRevenueCommands(program2);
106636
+ registerSessionReplayCommands(program2);
106089
106637
  registerInitCommand(program2);
106090
106638
  registerLinkCommand(program2);
106091
106639
  registerUpCommand(program2);
@@ -106127,8 +106675,8 @@ async function run() {
106127
106675
  const program2 = createProgram2();
106128
106676
  try {
106129
106677
  await program2.parseAsync(process.argv);
106130
- } catch (error4) {
106131
- handleError(error4);
106678
+ } catch (error3) {
106679
+ handleError(error3);
106132
106680
  }
106133
106681
  }
106134
106682
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temps-sdk/cli",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "CLI for Temps deployment platform",
5
5
  "type": "module",
6
6
  "bin": {