trainfabric 0.1.50 → 0.1.51

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 +39 -13
  2. 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.50";
9367
+ var CLI_VERSION = "0.1.51";
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");
@@ -9709,6 +9709,27 @@ function printUsageSummary(usage) {
9709
9709
  console.log(` ${item.label}: ${formatUsd(item.amountUsd)} - ${item.description}`);
9710
9710
  }
9711
9711
  }
9712
+ function printInvoiceSummary(invoices) {
9713
+ if (invoices.length === 0) {
9714
+ console.log("No invoices found.");
9715
+ return;
9716
+ }
9717
+ for (const invoice of invoices) {
9718
+ console.log(`${invoice.id}${invoice.runId ? ` (${invoice.runId})` : ""}`);
9719
+ console.log(` status: ${invoice.status}`);
9720
+ console.log(` amount due: ${formatUsd(invoice.amountDueUsd)}`);
9721
+ if (typeof invoice.customerChargeUsd === "number") {
9722
+ console.log(` run charge: ${formatUsd(invoice.customerChargeUsd)}`);
9723
+ }
9724
+ if (typeof invoice.creditAppliedUsd === "number") {
9725
+ console.log(` credits applied: ${formatUsd(invoice.creditAppliedUsd)}`);
9726
+ }
9727
+ if (invoice.settlementNote) {
9728
+ console.log(` note: ${invoice.settlementNote}`);
9729
+ }
9730
+ console.log("");
9731
+ }
9732
+ }
9712
9733
  function summarizeRunDetail(detail) {
9713
9734
  return {
9714
9735
  runId: detail.run.id,
@@ -10176,10 +10197,10 @@ program2.command("config:clear-api-key").description("Clear the stored API key")
10176
10197
  }
10177
10198
  printJson(visibleConfig(config));
10178
10199
  });
10179
- program2.command("orgs:list").description("List accessible organizations").action(async () => {
10200
+ program2.command("orgs:list").option("--json", "print raw JSON output; this is the default").description("List accessible organizations").action(async () => {
10180
10201
  printJson(await createClient(loadConfig()).organizations.list());
10181
10202
  });
10182
- program2.command("projects:list").description("List projects in the active organization").action(async () => {
10203
+ program2.command("projects:list").option("--json", "print raw JSON output; this is the default").description("List projects in the active organization").action(async () => {
10183
10204
  printJson(await createClient(loadConfig()).projects.list());
10184
10205
  });
10185
10206
  program2.command("projects:create").requiredOption("--name <name>").option("--org <organizationId>").description("Create a project").action(async (options) => {
@@ -10366,7 +10387,7 @@ program2.command("models:list").option("--json", "print raw JSON output; this is
10366
10387
  program2.command("models:export").argument("<modelId>").description("Fetch the export package path for a model").action(async (modelId) => {
10367
10388
  printJson(await createClient(loadConfig()).models.export(normalizeId(modelId, "model", "Model ID")));
10368
10389
  });
10369
- program2.command("deployments:list").description("List deployments").action(async () => {
10390
+ program2.command("deployments:list").option("--json", "print raw JSON output; this is the default").description("List deployments").action(async () => {
10370
10391
  printJson(await createClient(loadConfig()).deployments.list());
10371
10392
  });
10372
10393
  program2.command("deployments:create").requiredOption("--model <modelId>").option("--project <projectId>", "accepted for consistency; deployment project is inferred from the model").description("Create a hosted deployment for a model. Requires TRAINING_DEPLOYMENT_BASE_URL to be configured on the backend.").action(async (options) => {
@@ -10392,7 +10413,7 @@ program2.command("deployments:delete").argument("<deploymentId>").description("D
10392
10413
  await createClient(loadConfig()).deployments.delete(normalizedDeploymentId);
10393
10414
  printJson({ deleted: true, id: normalizedDeploymentId });
10394
10415
  });
10395
- program2.command("billing:summary").description("Fetch billing summary").action(async () => {
10416
+ program2.command("billing:summary").option("--json", "print raw JSON output; this is the default").description("Fetch billing summary").action(async () => {
10396
10417
  printJson(await createClient(loadConfig()).billing.getSummary());
10397
10418
  });
10398
10419
  program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seconds, reserved_gpu_seconds, or usd").option("--run <runId>", "filter usage records to one run").description("List billing usage records").action(async (options) => {
@@ -10406,22 +10427,27 @@ program2.command("billing:usage").option("--unit <unit>", "normalized_tflop_seco
10406
10427
  }
10407
10428
  printJson(await client.billing.getUsage(unit));
10408
10429
  });
10409
- program2.command("billing:invoices").description("List invoices").action(async () => {
10410
- printJson(await createClient(loadConfig()).billing.listInvoices());
10430
+ program2.command("billing:invoices").option("--json", "print raw JSON output; this is the default unless --summary is used").option("--summary", "print a human-readable invoice reconciliation summary").description("List invoices").action(async (options) => {
10431
+ const invoices = await createClient(loadConfig()).billing.listInvoices();
10432
+ if (options.summary) {
10433
+ printInvoiceSummary(invoices);
10434
+ return;
10435
+ }
10436
+ printJson(invoices);
10411
10437
  });
10412
- program2.command("billing:margin").description("Fetch margin summary").action(async () => {
10438
+ program2.command("billing:margin").option("--json", "print raw JSON output; this is the default").description("Fetch margin summary").action(async () => {
10413
10439
  printJson(await createClient(loadConfig()).billing.getMarginSummary());
10414
10440
  });
10415
- program2.command("treasury:suppliers").description("List supplier adapters").action(async () => {
10441
+ program2.command("treasury:suppliers").option("--json", "print raw JSON output; this is the default").description("List supplier adapters").action(async () => {
10416
10442
  printJson(await createClient(loadConfig()).treasury.listSuppliers());
10417
10443
  });
10418
- program2.command("treasury:verifications").description("List supplier verifications").action(async () => {
10444
+ program2.command("treasury:verifications").option("--json", "print raw JSON output; this is the default").description("List supplier verifications").action(async () => {
10419
10445
  printJson(await createClient(loadConfig()).treasury.listSupplierVerifications());
10420
10446
  });
10421
- program2.command("treasury:billing").description("List supplier billing records").action(async () => {
10447
+ program2.command("treasury:billing").option("--json", "print raw JSON output; this is the default").description("List supplier billing records").action(async () => {
10422
10448
  printJson(await createClient(loadConfig()).treasury.listSupplierBillings());
10423
10449
  });
10424
- program2.command("treasury:funding").description("List supplier funding summaries").action(async () => {
10450
+ program2.command("treasury:funding").option("--json", "print raw JSON output; this is the default").description("List supplier funding summaries").action(async () => {
10425
10451
  printJson(await createClient(loadConfig()).treasury.listSupplierFunding());
10426
10452
  });
10427
10453
  program2.command("treasury:funding-preview").requiredOption("--estimated-supplier-cost <usd>").option("--supplier <supplierId>").option("--pool <poolId>").description("Preview treasury funding readiness for a supplier-backed launch").action(async (options) => {
@@ -10460,7 +10486,7 @@ program2.command("service-accounts:create").requiredOption("--name <name>").opti
10460
10486
  })
10461
10487
  );
10462
10488
  });
10463
- program2.command("service-accounts:list").description("List service accounts").action(async () => {
10489
+ program2.command("service-accounts:list").option("--json", "print raw JSON output; this is the default").description("List service accounts").action(async () => {
10464
10490
  printJson(await createClient(loadConfig()).serviceAccounts.list());
10465
10491
  });
10466
10492
  program2.command("service-accounts:revoke").argument("<serviceAccountId>").description("Revoke a service account").action(async (serviceAccountId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trainfabric",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
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",