trainfabric 0.1.27 → 0.1.28

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.cjs +13 -2
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -8905,6 +8905,14 @@ function validateGitUrl(value) {
8905
8905
  }
8906
8906
  return value;
8907
8907
  }
8908
+ function validateGitBranch(value) {
8909
+ const branch = String(value ?? "").trim();
8910
+ const invalidCharacterPattern = /[\x00-\x20~^:?*[\]\\]/;
8911
+ if (!branch || branch === "@" || branch.startsWith("-") || branch.startsWith("/") || branch.endsWith("/") || branch.endsWith(".") || branch.includes("//") || branch.includes("..") || branch.includes("@{") || invalidCharacterPattern.test(branch) || branch.split("/").some((part) => !part || part.startsWith(".") || part.endsWith(".lock"))) {
8912
+ throw new Error("Git branch is invalid. Use a valid git branch name, for example main or feature/train-run.");
8913
+ }
8914
+ return branch;
8915
+ }
8908
8916
  function validateRepoPath(repoPath) {
8909
8917
  const absolute = import_node_path2.default.resolve(repoPath);
8910
8918
  const parsed = import_node_path2.default.parse(absolute);
@@ -8921,6 +8929,9 @@ function buildSourceOptions(options) {
8921
8929
  if (options.repo && options.git) {
8922
8930
  throw new Error("Use either --repo or --git, not both.");
8923
8931
  }
8932
+ if (options.branch && !options.git) {
8933
+ throw new Error("--branch only applies when --git is used.");
8934
+ }
8924
8935
  if (options.repo) {
8925
8936
  const repoPath = validateRepoPath(options.repo);
8926
8937
  const files = collectRuntimeFiles(repoPath);
@@ -8937,7 +8948,7 @@ function buildSourceOptions(options) {
8937
8948
  source: {
8938
8949
  kind: "git",
8939
8950
  repoUrl: validateGitUrl(options.git),
8940
- branch: options.branch
8951
+ branch: options.branch === void 0 ? void 0 : validateGitBranch(options.branch)
8941
8952
  }
8942
8953
  };
8943
8954
  }
@@ -9122,7 +9133,7 @@ function buildComputeSpec(options) {
9122
9133
 
9123
9134
  // src/index.ts
9124
9135
  var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
9125
- var CLI_VERSION = "0.1.27";
9136
+ var CLI_VERSION = "0.1.28";
9126
9137
  var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
9127
9138
  var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
9128
9139
  var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trainfabric",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Trainfabric CLI for launching GPU training jobs on the hosted Trainfabric backend.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",