trainfabric 0.1.60 → 0.1.62
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 +24 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -9364,7 +9364,7 @@ function buildComputeSpec(options) {
|
|
|
9364
9364
|
|
|
9365
9365
|
// src/index.ts
|
|
9366
9366
|
var DEFAULT_TRAINFABRIC_API_URL2 = "https://api.trainfabric.com";
|
|
9367
|
-
var CLI_VERSION = "0.1.
|
|
9367
|
+
var CLI_VERSION = "0.1.62";
|
|
9368
9368
|
var CONFIG_DIR = import_node_path3.default.join(import_node_os2.default.homedir(), ".trainfabric");
|
|
9369
9369
|
var CONFIG_PATH = import_node_path3.default.join(CONFIG_DIR, "config.json");
|
|
9370
9370
|
var FALLBACK_SECRET_PATH = import_node_path3.default.join(CONFIG_DIR, "session.enc");
|
|
@@ -9634,6 +9634,15 @@ function saveConfig(config) {
|
|
|
9634
9634
|
function printJson(value) {
|
|
9635
9635
|
console.log(JSON.stringify(value, null, 2));
|
|
9636
9636
|
}
|
|
9637
|
+
function redactSecret(value) {
|
|
9638
|
+
if (!value) {
|
|
9639
|
+
return value;
|
|
9640
|
+
}
|
|
9641
|
+
if (value.length <= 12) {
|
|
9642
|
+
return "<redacted>";
|
|
9643
|
+
}
|
|
9644
|
+
return `${value.slice(0, 8)}\u2026${value.slice(-4)}`;
|
|
9645
|
+
}
|
|
9637
9646
|
function shouldEmitJsonError() {
|
|
9638
9647
|
return process.argv.includes("--json") && !process.argv.includes("--summary");
|
|
9639
9648
|
}
|
|
@@ -10065,7 +10074,7 @@ async function login(config) {
|
|
|
10065
10074
|
}
|
|
10066
10075
|
}
|
|
10067
10076
|
var program2 = new Command();
|
|
10068
|
-
program2.name("trainfabric").description("Trainfabric CLI for launching and monitoring GPU training jobs").version(CLI_VERSION);
|
|
10077
|
+
program2.name("trainfabric").description("Trainfabric CLI for launching and monitoring GPU training jobs").version(CLI_VERSION).option("--json", "emit JSON output or structured JSON errors when supported");
|
|
10069
10078
|
program2.command("runs").description("Show run command group help").addHelpText(
|
|
10070
10079
|
"after",
|
|
10071
10080
|
`
|
|
@@ -10206,7 +10215,7 @@ program2.command("orgs:list").option("--json", "print raw JSON output; this is t
|
|
|
10206
10215
|
program2.command("projects:list").option("--json", "print raw JSON output; this is the default").description("List projects in the active organization").action(async () => {
|
|
10207
10216
|
printJson(await createClient(loadConfig()).projects.list());
|
|
10208
10217
|
});
|
|
10209
|
-
program2.command("projects:create").requiredOption("--name <name>").option("--org <organizationId>").description("Create a project").action(async (options) => {
|
|
10218
|
+
program2.command("projects:create").requiredOption("--name <name>").option("--org <organizationId>").option("--json", "print raw JSON output; this is the default").description("Create a project").action(async (options) => {
|
|
10210
10219
|
printJson(
|
|
10211
10220
|
await createClient(loadConfig()).projects.create({
|
|
10212
10221
|
name: normalizeHumanName(options.name, "Project name"),
|
|
@@ -10226,7 +10235,7 @@ program2.command("projects:delete").argument("<projectId>").option("--json", "pr
|
|
|
10226
10235
|
await client.projects.delete(normalizedProjectId);
|
|
10227
10236
|
printJson({ deleted: true, id: normalizedProjectId });
|
|
10228
10237
|
});
|
|
10229
|
-
program2.command("datasets:validate").argument("<file>").description("Validate a local dataset file").action(async (file) => {
|
|
10238
|
+
program2.command("datasets:validate").argument("<file>").option("--json", "print raw JSON output; this is the default").description("Validate a local dataset file").action(async (file) => {
|
|
10230
10239
|
assertReadableFile(file, "Dataset path");
|
|
10231
10240
|
const validation = await createClient(loadConfig()).datasets.validate({
|
|
10232
10241
|
path: file,
|
|
@@ -10243,7 +10252,7 @@ program2.command("datasets:list").option("--project <projectId>").option("--json
|
|
|
10243
10252
|
program2.command("datasets:get").argument("<datasetId>").option("--json", "print raw JSON output; this is the default").description("Fetch dataset detail").action(async (datasetId) => {
|
|
10244
10253
|
printJson(await createClient(loadConfig()).datasets.get(normalizeId(datasetId, "dataset", "Dataset ID")));
|
|
10245
10254
|
});
|
|
10246
|
-
program2.command("datasets:delete").argument("<datasetId>").description("Delete a dataset").action(async (datasetId) => {
|
|
10255
|
+
program2.command("datasets:delete").argument("<datasetId>").option("--json", "print raw JSON output; this is the default").description("Delete a dataset").action(async (datasetId) => {
|
|
10247
10256
|
const normalizedDatasetId = normalizeId(datasetId, "dataset", "Dataset ID");
|
|
10248
10257
|
const client = createClient(loadConfig());
|
|
10249
10258
|
try {
|
|
@@ -10376,13 +10385,13 @@ program2.command("runs:configuration").argument("<runId>").option("--json", "pri
|
|
|
10376
10385
|
program2.command("runs:explanation").argument("<runId>").option("--json", "print raw JSON output; this is the default").description("Fetch run planning explanation").action(async (runId) => {
|
|
10377
10386
|
printJson(await createClient(loadConfig()).runs.explanation(normalizeId(runId, "run", "Run ID")));
|
|
10378
10387
|
});
|
|
10379
|
-
program2.command("runs:cancel").argument("<runId>").description("Cancel a run").action(async (runId) => {
|
|
10388
|
+
program2.command("runs:cancel").argument("<runId>").option("--json", "print raw JSON output; this is the default").description("Cancel a run").action(async (runId) => {
|
|
10380
10389
|
printJson(await createClient(loadConfig()).runs.cancel(normalizeId(runId, "run", "Run ID")));
|
|
10381
10390
|
});
|
|
10382
10391
|
program2.command("runs:resume").argument("<runId>").option("--json", "print raw JSON output; this is the default").description("Resume a run from the latest checkpoint").action(async (runId) => {
|
|
10383
10392
|
printJson(await createClient(loadConfig()).runs.resume(normalizeId(runId, "run", "Run ID")));
|
|
10384
10393
|
});
|
|
10385
|
-
program2.command("runs:terminate").argument("<runId>").description("Terminate a queued, launchable, or active run").action(async (runId) => {
|
|
10394
|
+
program2.command("runs:terminate").argument("<runId>").option("--json", "print raw JSON output; this is the default").description("Terminate a queued, launchable, or active run").action(async (runId) => {
|
|
10386
10395
|
printJson(await createClient(loadConfig()).runs.terminate(normalizeId(runId, "run", "Run ID")));
|
|
10387
10396
|
});
|
|
10388
10397
|
program2.command("cluster:capacity").option("--json", "print raw JSON output; this is the default").description("Fetch cluster capacity view").action(async () => {
|
|
@@ -10424,7 +10433,7 @@ program2.command("deployments:create").requiredOption("--model <modelId>").optio
|
|
|
10424
10433
|
program2.command("deployments:get").argument("<deploymentId>").option("--json", "print raw JSON output; this is the default").description("Fetch a deployment").action(async (deploymentId) => {
|
|
10425
10434
|
printJson(await createClient(loadConfig()).deployments.get(normalizeId(deploymentId, "deployment", "Deployment ID")));
|
|
10426
10435
|
});
|
|
10427
|
-
program2.command("deployments:delete").argument("<deploymentId>").description("Delete a pending or cataloged deployment").action(async (deploymentId) => {
|
|
10436
|
+
program2.command("deployments:delete").argument("<deploymentId>").option("--json", "print raw JSON output; this is the default").description("Delete a pending or cataloged deployment").action(async (deploymentId) => {
|
|
10428
10437
|
const normalizedDeploymentId = normalizeId(deploymentId, "deployment", "Deployment ID");
|
|
10429
10438
|
await createClient(loadConfig()).deployments.delete(normalizedDeploymentId);
|
|
10430
10439
|
printJson({ deleted: true, id: normalizedDeploymentId });
|
|
@@ -10482,7 +10491,7 @@ program2.command("treasury:funding-preview").requiredOption("--estimated-supplie
|
|
|
10482
10491
|
})
|
|
10483
10492
|
);
|
|
10484
10493
|
});
|
|
10485
|
-
program2.command("api-keys:create").requiredOption("--name <name>").option("--owner-type <ownerType>", "user or service_account", "user").option("--owner-id <ownerId>").option("--scopes <scopes>", "comma-separated scopes", "org:read,project:read,project:write,dataset:read,dataset:write,run:read,run:write").description("Create a scoped API key").action(async (options) => {
|
|
10494
|
+
program2.command("api-keys:create").requiredOption("--name <name>").option("--owner-type <ownerType>", "user or service_account", "user").option("--owner-id <ownerId>").option("--scopes <scopes>", "comma-separated scopes", "org:read,project:read,project:write,dataset:read,dataset:write,run:read,run:write").option("--json", "print raw JSON output; this is the default").option("--show-secret", "print the full one-time secret instead of a redacted preview").description("Create a scoped API key").action(async (options) => {
|
|
10486
10495
|
const config = loadConfig();
|
|
10487
10496
|
const session = await createClient(config).auth.me();
|
|
10488
10497
|
const apiKey = await createClient(config).apiKeys.create({
|
|
@@ -10491,17 +10500,17 @@ program2.command("api-keys:create").requiredOption("--name <name>").option("--ow
|
|
|
10491
10500
|
ownerId: options.ownerId ?? session.user.id,
|
|
10492
10501
|
scopes: parseApiKeyScopes(String(options.scopes))
|
|
10493
10502
|
});
|
|
10494
|
-
printJson(apiKey);
|
|
10503
|
+
printJson(options.showSecret ? apiKey : { ...apiKey, secret: redactSecret(apiKey.secret), secretRedacted: true });
|
|
10495
10504
|
});
|
|
10496
10505
|
program2.command("api-keys:list").option("--json", "print raw JSON output; this is the default").description("List API keys").action(async () => {
|
|
10497
10506
|
printJson(await createClient(loadConfig()).apiKeys.list());
|
|
10498
10507
|
});
|
|
10499
|
-
program2.command("api-keys:revoke").argument("<apiKeyId>").description("Revoke an API key").action(async (apiKeyId) => {
|
|
10508
|
+
program2.command("api-keys:revoke").argument("<apiKeyId>").option("--json", "print raw JSON output; this is the default").description("Revoke an API key").action(async (apiKeyId) => {
|
|
10500
10509
|
const normalizedApiKeyId = normalizeId(apiKeyId, "apiKey", "API key ID");
|
|
10501
10510
|
await createClient(loadConfig()).apiKeys.revoke(normalizedApiKeyId);
|
|
10502
|
-
|
|
10511
|
+
printJson({ revoked: true, id: normalizedApiKeyId });
|
|
10503
10512
|
});
|
|
10504
|
-
program2.command("service-accounts:create").requiredOption("--name <name>").option("--scopes <scopes>", "comma-separated scopes", "org:read,project:read,project:write,dataset:read,dataset:write,run:read,run:write").description("Create a service account").action(async (options) => {
|
|
10513
|
+
program2.command("service-accounts:create").requiredOption("--name <name>").option("--scopes <scopes>", "comma-separated scopes", "org:read,project:read,project:write,dataset:read,dataset:write,run:read,run:write").option("--json", "print raw JSON output; this is the default").description("Create a service account").action(async (options) => {
|
|
10505
10514
|
printJson(
|
|
10506
10515
|
await createClient(loadConfig()).serviceAccounts.create({
|
|
10507
10516
|
name: normalizeHumanName(options.name, "Service account name"),
|
|
@@ -10512,10 +10521,10 @@ program2.command("service-accounts:create").requiredOption("--name <name>").opti
|
|
|
10512
10521
|
program2.command("service-accounts:list").option("--json", "print raw JSON output; this is the default").description("List service accounts").action(async () => {
|
|
10513
10522
|
printJson(await createClient(loadConfig()).serviceAccounts.list());
|
|
10514
10523
|
});
|
|
10515
|
-
program2.command("service-accounts:revoke").argument("<serviceAccountId>").description("Revoke a service account").action(async (serviceAccountId) => {
|
|
10524
|
+
program2.command("service-accounts:revoke").argument("<serviceAccountId>").option("--json", "print raw JSON output; this is the default").description("Revoke a service account").action(async (serviceAccountId) => {
|
|
10516
10525
|
const normalizedServiceAccountId = normalizeId(serviceAccountId, "serviceAccount", "Service account ID");
|
|
10517
10526
|
await createClient(loadConfig()).serviceAccounts.revoke(normalizedServiceAccountId);
|
|
10518
|
-
|
|
10527
|
+
printJson({ revoked: true, id: normalizedServiceAccountId });
|
|
10519
10528
|
});
|
|
10520
10529
|
void program2.parseAsync(process.argv).catch((error) => {
|
|
10521
10530
|
const message = error instanceof Error ? error.message : String(error);
|