ninepm 0.44.0 → 0.46.0

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.d.ts CHANGED
@@ -114,7 +114,7 @@ export interface CreatedServiceToken {
114
114
  clientSecret: string;
115
115
  }
116
116
  export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
117
- export declare const CLI_VERSION = "0.44.0";
117
+ export declare const CLI_VERSION = "0.46.0";
118
118
  type CredentialBackend = "macos-keychain" | "windows-dpapi" | "linux-secret-service" | "file-plaintext" | "none";
119
119
  export interface StoredCredentialEntry {
120
120
  token: string;
@@ -527,6 +527,7 @@ export declare function parseEnvFileEntries(content: string, kind: "secret" | "v
527
527
  value: string;
528
528
  kind: "secret" | "var";
529
529
  }>;
530
+ export declare function healthWithReason(status: string | null | undefined, reason: string | null | undefined): string;
530
531
  export declare function storedCredentialTokens(): StoredCredentialEntry[];
531
532
  export declare function credentialDiagnostics(): CredentialDiagnostics;
532
533
  export type BrowserOpenResult = "opened" | "failed" | "unknown";
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { MAX_DEPLOY_DESCRIPTION_LENGTH, normalizeDeployDescription } from "./dep
14
14
  import { MAX_STATIC_ASSET_FILE_BYTES, MAX_WORKER_ENTRY_COMPRESSED_BYTES, MAX_WORKER_SCRIPT_COMPRESSED_BYTES, WORKER_ENTRY_COMPRESSED_WARN_BYTES, assetFileTooLargeMessage, formatMebibytes, formatMegabytes, oversizedAssets, workerBundleNearLimitMessage, workerBundleTooLargeMessage, workerEntryNearLimitMessage, workerEntryTooLargeMessage, } from "./deploy-limits.js";
15
15
  import { buildFileManifest, readManifestFile } from "./manifest.js";
16
16
  import { API_KEY_HELP, API_URL_HELP, CLI_CLIENT_ID, DEFAULT_API_URL, reportCliError } from "./cli-config.js";
17
- export const CLI_VERSION = "0.44.0";
17
+ export const CLI_VERSION = "0.46.0";
18
18
  const PUBLIC_DASHBOARD_URL = "https://9pm.ai/dashboard";
19
19
  const TOKEN_SERVICE = "9pm";
20
20
  const TOKEN_ACCOUNT = "default";
@@ -2352,6 +2352,26 @@ async function runDeploymentsCommand(command) {
2352
2352
  });
2353
2353
  console.log(`Deleted deployment ${result.deleted}.`);
2354
2354
  }
2355
+ // #807 step 5: the claim behind a health verdict, in words. A bare `unknown` reads
2356
+ // as "fine"; the reason says which statement the platform is actually making.
2357
+ export function healthWithReason(status, reason) {
2358
+ const label = status ?? "unknown";
2359
+ const copy = {
2360
+ application_answered: "application answered",
2361
+ application_not_answering: "application not answering",
2362
+ application_exited: "application exited",
2363
+ publish_failed: "deploy failed",
2364
+ not_verified_yet: "not checked yet",
2365
+ };
2366
+ const explained = reason ? copy[reason] : undefined;
2367
+ // `unknown` with no stored reason predates the reason column - same claim.
2368
+ const fallback = label === "unknown" ? copy.not_verified_yet : undefined;
2369
+ // An unrecognised code still names its claim: the raw string keeps a bare
2370
+ // verdict from rendering as if it were a statement about the app when this
2371
+ // CLI meets a reason code newer than itself.
2372
+ const suffix = explained ?? reason ?? fallback;
2373
+ return suffix ? `${label} (${suffix})` : label;
2374
+ }
2355
2375
  async function runLogsCommand(command) {
2356
2376
  const base = { apiUrl: command.apiUrl, token: command.token };
2357
2377
  const result = await apiRequest(base, `/v1/sites/${encodeURIComponent(command.site)}/logs`, { method: "GET" });
@@ -2364,13 +2384,13 @@ async function runLogsCommand(command) {
2364
2384
  return;
2365
2385
  }
2366
2386
  const deployment = result.deployment;
2367
- console.log(`Deployment ${deployment.id}\t${deployment.status}\thealth: ${deployment.healthStatus}\t${deployment.finishedAt ?? deployment.createdAt}`);
2387
+ console.log(`Deployment ${deployment.id}\t${deployment.status}\thealth: ${healthWithReason(deployment.healthStatus, deployment.healthReason)}\t${deployment.finishedAt ?? deployment.createdAt}`);
2368
2388
  // The line above describes the LATEST deployment, which is not the one serving
2369
2389
  // traffic while a newer attempt is queued or failed - and its health is that
2370
2390
  // attempt's, not the running app's. Name the serving one's own verdict rather
2371
2391
  // than leaving the only health figure on screen belonging to something else.
2372
2392
  if (result.runtimeDeployment && result.runtimeDeployment.id !== deployment.id && result.runtimeDeployment.health) {
2373
- console.log(`Serving ${result.runtimeDeployment.id}\thealth: ${result.runtimeDeployment.health}`);
2393
+ console.log(`Serving ${result.runtimeDeployment.id}\thealth: ${healthWithReason(result.runtimeDeployment.health, result.runtimeDeployment.healthReason)}`);
2374
2394
  }
2375
2395
  if (result.reason) {
2376
2396
  console.log(`Reason: ${result.reason}`);
@@ -2407,6 +2427,14 @@ async function runLogsCommand(command) {
2407
2427
  console.log("");
2408
2428
  console.log(`Runtime${servingLabel}: ${parts.join("\t")}`);
2409
2429
  }
2430
+ // #839: printed whenever it is known, not only when something is wrong — the
2431
+ // point is to see a disk filling BEFORE it stops the app booting, and to let an
2432
+ // owner rule the disk out instead of guessing at it.
2433
+ if (result.volume && result.volume.totalBytes > 0) {
2434
+ const percent = Math.round((result.volume.usedBytes / result.volume.totalBytes) * 100);
2435
+ console.log("");
2436
+ console.log(`Disk${servingLabel}: ${formatBytesForCli(result.volume.usedBytes)} of ${formatBytesForCli(result.volume.totalBytes)} (${percent}%)`);
2437
+ }
2410
2438
  if (result.runtimeLogs) {
2411
2439
  let lines = result.runtimeLogs.split("\n");
2412
2440
  if (command.lines !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ninepm",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "CLI for deploying built apps to 9pm.ai.",
5
5
  "homepage": "https://9pm.ai",
6
6
  "keywords": [