trainfabric 0.1.9 → 0.1.11
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.
- package/dist/index.cjs +37 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8204,6 +8204,9 @@ var DatasetsClient = class extends ResourceClient {
|
|
|
8204
8204
|
|
|
8205
8205
|
// ../sdk/dist/client/deployments.js
|
|
8206
8206
|
var DeploymentsClient = class extends ResourceClient {
|
|
8207
|
+
list() {
|
|
8208
|
+
return this.requestGet("/v1/deployments");
|
|
8209
|
+
}
|
|
8207
8210
|
create(input) {
|
|
8208
8211
|
return this.requestPost("/v1/deployments", input);
|
|
8209
8212
|
}
|
|
@@ -8789,16 +8792,36 @@ var import_node_os = __toESM(require("node:os"), 1);
|
|
|
8789
8792
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
8790
8793
|
function collectRuntimeFiles(repoPath) {
|
|
8791
8794
|
const candidates = ["training.yaml", "train.runtime.yaml", "pyproject.toml", "requirements.txt", "environment.yml", "Dockerfile", "train.py"];
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8795
|
+
const ignoredDirectories = /* @__PURE__ */ new Set([".git", ".hg", ".svn", "node_modules", ".venv", "venv", "__pycache__", ".mypy_cache", ".pytest_cache", "dist", "build"]);
|
|
8796
|
+
const found = [];
|
|
8797
|
+
function walk(currentPath) {
|
|
8798
|
+
if (found.length >= 64) {
|
|
8799
|
+
return;
|
|
8796
8800
|
}
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8801
|
+
for (const entry of import_node_fs.default.readdirSync(currentPath, { withFileTypes: true })) {
|
|
8802
|
+
const absolute = import_node_path2.default.join(currentPath, entry.name);
|
|
8803
|
+
const relative = import_node_path2.default.relative(repoPath, absolute).split(import_node_path2.default.sep).join("/");
|
|
8804
|
+
if (entry.isDirectory()) {
|
|
8805
|
+
if (!ignoredDirectories.has(entry.name)) {
|
|
8806
|
+
walk(absolute);
|
|
8807
|
+
}
|
|
8808
|
+
continue;
|
|
8809
|
+
}
|
|
8810
|
+
if (!entry.isFile() || !candidates.includes(entry.name)) {
|
|
8811
|
+
continue;
|
|
8812
|
+
}
|
|
8813
|
+
const stat = import_node_fs.default.statSync(absolute);
|
|
8814
|
+
if (stat.size > 256 * 1024) {
|
|
8815
|
+
continue;
|
|
8816
|
+
}
|
|
8817
|
+
found.push({
|
|
8818
|
+
path: relative,
|
|
8819
|
+
content: import_node_fs.default.readFileSync(absolute, "utf8")
|
|
8820
|
+
});
|
|
8821
|
+
}
|
|
8822
|
+
}
|
|
8823
|
+
walk(repoPath);
|
|
8824
|
+
return found.sort((left, right) => left.path.localeCompare(right.path));
|
|
8802
8825
|
}
|
|
8803
8826
|
function buildSourceOptions(options) {
|
|
8804
8827
|
if (options.repo) {
|
|
@@ -8891,7 +8914,7 @@ function buildComputeSpec(options) {
|
|
|
8891
8914
|
|
|
8892
8915
|
// src/index.ts
|
|
8893
8916
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
8894
|
-
var CLI_VERSION = "0.1.
|
|
8917
|
+
var CLI_VERSION = "0.1.11";
|
|
8895
8918
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
8896
8919
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
8897
8920
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9061,7 +9084,7 @@ function ensureConfigDir() {
|
|
|
9061
9084
|
import_node_fs2.default.chmodSync(CONFIG_DIR, 448);
|
|
9062
9085
|
}
|
|
9063
9086
|
function canUseMacKeychain() {
|
|
9064
|
-
return process.platform === "darwin" && process.env.TRAINFABRIC_DISABLE_KEYCHAIN !== "1" && process.env.CI !== "1" &&
|
|
9087
|
+
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
9088
|
}
|
|
9066
9089
|
function encodeSecretPayload(payload) {
|
|
9067
9090
|
return JSON.stringify(payload);
|
|
@@ -9527,6 +9550,9 @@ program2.command("models:list").description("List exported models").action(async
|
|
|
9527
9550
|
program2.command("models:export").argument("<modelId>").description("Fetch the export package path for a model").action(async (modelId) => {
|
|
9528
9551
|
printJson(await createClient(loadConfig()).models.export(String(modelId)));
|
|
9529
9552
|
});
|
|
9553
|
+
program2.command("deployments:list").description("List deployments").action(async () => {
|
|
9554
|
+
printJson(await createClient(loadConfig()).deployments.list());
|
|
9555
|
+
});
|
|
9530
9556
|
program2.command("deployments:create").requiredOption("--model <modelId>").description("Create a deployment for a model").action(async (options) => {
|
|
9531
9557
|
printJson(await createClient(loadConfig()).deployments.create({ modelId: options.model }));
|
|
9532
9558
|
});
|