trainfabric 0.1.9 → 0.1.10

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 +31 -11
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -8789,16 +8789,36 @@ var import_node_os = __toESM(require("node:os"), 1);
8789
8789
  var import_node_path2 = __toESM(require("node:path"), 1);
8790
8790
  function collectRuntimeFiles(repoPath) {
8791
8791
  const candidates = ["training.yaml", "train.runtime.yaml", "pyproject.toml", "requirements.txt", "environment.yml", "Dockerfile", "train.py"];
8792
- return candidates.map((fileName) => {
8793
- const filePath = import_node_path2.default.join(repoPath, fileName);
8794
- if (!import_node_fs.default.existsSync(filePath)) {
8795
- return void 0;
8792
+ const ignoredDirectories = /* @__PURE__ */ new Set([".git", ".hg", ".svn", "node_modules", ".venv", "venv", "__pycache__", ".mypy_cache", ".pytest_cache", "dist", "build"]);
8793
+ const found = [];
8794
+ function walk(currentPath) {
8795
+ if (found.length >= 64) {
8796
+ return;
8796
8797
  }
8797
- return {
8798
- path: fileName,
8799
- content: import_node_fs.default.readFileSync(filePath, "utf8")
8800
- };
8801
- }).filter(Boolean);
8798
+ for (const entry of import_node_fs.default.readdirSync(currentPath, { withFileTypes: true })) {
8799
+ const absolute = import_node_path2.default.join(currentPath, entry.name);
8800
+ const relative = import_node_path2.default.relative(repoPath, absolute).split(import_node_path2.default.sep).join("/");
8801
+ if (entry.isDirectory()) {
8802
+ if (!ignoredDirectories.has(entry.name)) {
8803
+ walk(absolute);
8804
+ }
8805
+ continue;
8806
+ }
8807
+ if (!entry.isFile() || !candidates.includes(entry.name)) {
8808
+ continue;
8809
+ }
8810
+ const stat = import_node_fs.default.statSync(absolute);
8811
+ if (stat.size > 256 * 1024) {
8812
+ continue;
8813
+ }
8814
+ found.push({
8815
+ path: relative,
8816
+ content: import_node_fs.default.readFileSync(absolute, "utf8")
8817
+ });
8818
+ }
8819
+ }
8820
+ walk(repoPath);
8821
+ return found.sort((left, right) => left.path.localeCompare(right.path));
8802
8822
  }
8803
8823
  function buildSourceOptions(options) {
8804
8824
  if (options.repo) {
@@ -8891,7 +8911,7 @@ function buildComputeSpec(options) {
8891
8911
 
8892
8912
  // src/index.ts
8893
8913
  var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
8894
- var CLI_VERSION = "0.1.9";
8914
+ var CLI_VERSION = "0.1.10";
8895
8915
  var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
8896
8916
  var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
8897
8917
  var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
@@ -9061,7 +9081,7 @@ function ensureConfigDir() {
9061
9081
  import_node_fs2.default.chmodSync(CONFIG_DIR, 448);
9062
9082
  }
9063
9083
  function canUseMacKeychain() {
9064
- return process.platform === "darwin" && process.env.TRAINFABRIC_DISABLE_KEYCHAIN !== "1" && process.env.CI !== "1" && Boolean(process.stdin.isTTY && process.stdout.isTTY) && (0, import_node_child_process.spawnSync)("security", ["-h"]).status === 0;
9084
+ return process.platform === "darwin" && process.env.TRAINFABRIC_DISABLE_KEYCHAIN !== "1" && process.env.CI !== "1" && (0, import_node_child_process.spawnSync)("security", ["-h"]).status === 0;
9065
9085
  }
9066
9086
  function encodeSecretPayload(payload) {
9067
9087
  return JSON.stringify(payload);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trainfabric",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
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",