@inquir/compute-cli 0.2.2 → 0.4.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.
Files changed (119) hide show
  1. package/README.md +228 -21
  2. package/dist/commands/admin-tenants.d.ts +11 -0
  3. package/dist/commands/admin-tenants.d.ts.map +1 -0
  4. package/dist/commands/admin-tenants.js +318 -0
  5. package/dist/commands/admin-tenants.js.map +1 -0
  6. package/dist/commands/admin.d.ts +2 -0
  7. package/dist/commands/admin.d.ts.map +1 -0
  8. package/dist/commands/admin.js +445 -0
  9. package/dist/commands/admin.js.map +1 -0
  10. package/dist/commands/apps-describe.d.ts +9 -0
  11. package/dist/commands/apps-describe.d.ts.map +1 -0
  12. package/dist/commands/apps-describe.js +118 -0
  13. package/dist/commands/apps-describe.js.map +1 -0
  14. package/dist/commands/apps-observability.d.ts +9 -0
  15. package/dist/commands/apps-observability.d.ts.map +1 -0
  16. package/dist/commands/apps-observability.js +281 -0
  17. package/dist/commands/apps-observability.js.map +1 -0
  18. package/dist/commands/apps-promote.d.ts +31 -0
  19. package/dist/commands/apps-promote.d.ts.map +1 -0
  20. package/dist/commands/apps-promote.js +115 -0
  21. package/dist/commands/apps-promote.js.map +1 -0
  22. package/dist/commands/apps-resources.d.ts +6 -0
  23. package/dist/commands/apps-resources.d.ts.map +1 -0
  24. package/dist/commands/apps-resources.js +107 -0
  25. package/dist/commands/apps-resources.js.map +1 -0
  26. package/dist/commands/apps.d.ts +65 -5
  27. package/dist/commands/apps.d.ts.map +1 -1
  28. package/dist/commands/apps.js +1293 -89
  29. package/dist/commands/apps.js.map +1 -1
  30. package/dist/commands/config.d.ts.map +1 -1
  31. package/dist/commands/config.js +7 -3
  32. package/dist/commands/config.js.map +1 -1
  33. package/dist/commands/delete.d.ts.map +1 -1
  34. package/dist/commands/delete.js +10 -2
  35. package/dist/commands/delete.js.map +1 -1
  36. package/dist/commands/deploy.d.ts +38 -0
  37. package/dist/commands/deploy.d.ts.map +1 -1
  38. package/dist/commands/deploy.js +165 -12
  39. package/dist/commands/deploy.js.map +1 -1
  40. package/dist/commands/doctor.js +2 -2
  41. package/dist/commands/init.d.ts.map +1 -1
  42. package/dist/commands/init.js +3 -0
  43. package/dist/commands/init.js.map +1 -1
  44. package/dist/commands/login.d.ts.map +1 -1
  45. package/dist/commands/login.js +96 -20
  46. package/dist/commands/login.js.map +1 -1
  47. package/dist/commands/logout.d.ts.map +1 -1
  48. package/dist/commands/logout.js +37 -5
  49. package/dist/commands/logout.js.map +1 -1
  50. package/dist/commands/mcp.d.ts +13 -0
  51. package/dist/commands/mcp.d.ts.map +1 -1
  52. package/dist/commands/mcp.js +184 -77
  53. package/dist/commands/mcp.js.map +1 -1
  54. package/dist/commands/projects.d.ts +2 -0
  55. package/dist/commands/projects.d.ts.map +1 -0
  56. package/dist/commands/projects.js +194 -0
  57. package/dist/commands/projects.js.map +1 -0
  58. package/dist/index.js +11 -0
  59. package/dist/index.js.map +1 -1
  60. package/dist/lib/finite-source-command-client.d.ts +3 -0
  61. package/dist/lib/finite-source-command-client.d.ts.map +1 -0
  62. package/dist/lib/finite-source-command-client.js +3 -0
  63. package/dist/lib/finite-source-command-client.js.map +1 -0
  64. package/dist/lib/mcp-io.d.ts +23 -0
  65. package/dist/lib/mcp-io.d.ts.map +1 -0
  66. package/dist/lib/mcp-io.js +185 -0
  67. package/dist/lib/mcp-io.js.map +1 -0
  68. package/dist/lib/mcp-source-commands.d.ts +17 -0
  69. package/dist/lib/mcp-source-commands.d.ts.map +1 -0
  70. package/dist/lib/mcp-source-commands.js +345 -0
  71. package/dist/lib/mcp-source-commands.js.map +1 -0
  72. package/dist/utils/api.d.ts +58 -8
  73. package/dist/utils/api.d.ts.map +1 -1
  74. package/dist/utils/api.js +86 -7
  75. package/dist/utils/api.js.map +1 -1
  76. package/dist/utils/apps-presentation.d.ts +11 -1
  77. package/dist/utils/apps-presentation.d.ts.map +1 -1
  78. package/dist/utils/apps-presentation.js +37 -0
  79. package/dist/utils/apps-presentation.js.map +1 -1
  80. package/dist/utils/args.d.ts.map +1 -1
  81. package/dist/utils/args.js +8 -1
  82. package/dist/utils/args.js.map +1 -1
  83. package/dist/utils/assets.d.ts +48 -1
  84. package/dist/utils/assets.d.ts.map +1 -1
  85. package/dist/utils/assets.js +185 -7
  86. package/dist/utils/assets.js.map +1 -1
  87. package/dist/utils/auth.d.ts +29 -2
  88. package/dist/utils/auth.d.ts.map +1 -1
  89. package/dist/utils/auth.js +164 -27
  90. package/dist/utils/auth.js.map +1 -1
  91. package/dist/utils/browser.d.ts +12 -0
  92. package/dist/utils/browser.d.ts.map +1 -1
  93. package/dist/utils/browser.js +37 -16
  94. package/dist/utils/browser.js.map +1 -1
  95. package/dist/utils/context.d.ts.map +1 -1
  96. package/dist/utils/context.js +2 -0
  97. package/dist/utils/context.js.map +1 -1
  98. package/dist/utils/deploy-follow.d.ts +4 -3
  99. package/dist/utils/deploy-follow.d.ts.map +1 -1
  100. package/dist/utils/deploy-follow.js +76 -17
  101. package/dist/utils/deploy-follow.js.map +1 -1
  102. package/dist/utils/detect.d.ts +49 -1
  103. package/dist/utils/detect.d.ts.map +1 -1
  104. package/dist/utils/detect.js +153 -12
  105. package/dist/utils/detect.js.map +1 -1
  106. package/dist/utils/ensure-auth.d.ts.map +1 -1
  107. package/dist/utils/ensure-auth.js +6 -2
  108. package/dist/utils/ensure-auth.js.map +1 -1
  109. package/dist/utils/package-metadata.js +1 -1
  110. package/dist/utils/project-context.d.ts +17 -0
  111. package/dist/utils/project-context.d.ts.map +1 -0
  112. package/dist/utils/project-context.js +96 -0
  113. package/dist/utils/project-context.js.map +1 -0
  114. package/dist/utils/project-lookup.d.ts +10 -0
  115. package/dist/utils/project-lookup.d.ts.map +1 -0
  116. package/dist/utils/project-lookup.js +52 -0
  117. package/dist/utils/project-lookup.js.map +1 -0
  118. package/package.json +7 -4
  119. package/skill/SKILL.md +15 -2
package/README.md CHANGED
@@ -58,6 +58,10 @@ inquir whoami # show the signed-in user + active workspace
58
58
 
59
59
  `inquir login` prints a short code and opens a dashboard page; confirm the code
60
60
  matches and click **Authorize**. The CLI then receives its token automatically.
61
+ Browser-issued CLI sessions expire (90 days by default; the server can configure
62
+ a shorter lifetime). The CLI records the issuing API and expiry with the token.
63
+ Logging in again saves the new session before revoking the previous session owned
64
+ by that profile, unless another stored profile or environment variable still uses it.
61
65
 
62
66
  Other login modes:
63
67
 
@@ -67,8 +71,29 @@ inquir login --token <pat> # non-interactive (CI): use a PAT created in the da
67
71
  inquir login --name "my CI" # label the device/token shown in the dashboard
68
72
  ```
69
73
 
74
+ Login stores the API URL together with the token. To keep credentials for another
75
+ API separately, use a named environment:
76
+
77
+ ```bash
78
+ inquir login --env staging --api-url https://staging.example.com --token <pat>
79
+ inquir whoami --env staging
80
+ ```
81
+
82
+ Changing a login's API or token clears its cached identity and workspace until
83
+ membership discovery succeeds. A previous workspace on the same API is restored
84
+ only if the new token can still access it. If discovery is temporarily unavailable,
85
+ the token remains saved and subsequent commands do not reuse the previous
86
+ account's stored workspace.
87
+
70
88
  Create and revoke PATs from the dashboard under **API Keys → Personal Access
71
- Tokens**. To sign out and remove the stored token: `inquir logout`.
89
+ Tokens**. `inquir logout` revokes its browser-issued CLI session at the API that
90
+ issued it, then clears the local credentials and workspace. If the API is offline,
91
+ the local logout still completes and warns that server revocation was not confirmed.
92
+ Imported PATs (`--token`), tokens saved by older CLI versions, and credentials shared
93
+ with another profile are only cleared locally; revoke them in the dashboard when
94
+ they are no longer needed. Shell environment variables are never removed by logout.
95
+ `inquir logout --env staging` leaves the default profile intact and prevents the
96
+ logged-out profile from inheriting its credentials again.
72
97
 
73
98
  > A PAT can deploy to **any workspace you belong to**. A workspace-scoped **API
74
99
  > key** is pinned to a single workspace and ignores workspace switching.
@@ -94,6 +119,44 @@ inquir whoami --workspace acme-prod
94
119
  Under the hood, user-scoped credentials send an `X-Inquir-Workspace` header; the
95
120
  server verifies your membership before honoring it.
96
121
 
122
+ ## Application projects
123
+
124
+ Projects group long-lived container applications inside a workspace: web services,
125
+ APIs, databases, and workers. Serverless functions are managed separately and cannot
126
+ be added to these projects. A new application creates a project named after itself
127
+ unless you select an existing project:
128
+
129
+ ```bash
130
+ inquir projects list
131
+ inquir projects create shop
132
+ inquir projects use shop
133
+ inquir apps create api --port 3000
134
+ inquir apps create db --template postgres --project shop
135
+ inquir projects add shop existing-app
136
+ inquir projects move shop db # file it in shop, take it out of its other projects
137
+ inquir projects remove shop old-api # unfile it; it keeps running
138
+ inquir projects current
139
+ inquir projects use --clear
140
+ ```
141
+
142
+ `projects use` saves the selection for the current directory, or the nearest
143
+ `inquir.config.json` root. Use `--cwd <path>` to select another directory. The
144
+ selection is kept locally under `~/.inquir/project-contexts` and isolated by API,
145
+ the actual workspace, and signed-in user (or API key). Switching workspace or
146
+ account therefore cannot silently reuse another context's project.
147
+
148
+ `apps create --project <project>` overrides the selection for one command.
149
+ `projects use --clear` returns to automatic project creation. Every project command
150
+ accepts a project's ID, slug, or unique display name, and an application's ID or
151
+ name. `apps create` prints the project an application landed in. All project
152
+ commands support `--json`. Deploying an existing container application with
153
+ `apps deploy` keeps its project membership. `projects add` files an application in
154
+ one more project; `projects move` files it and takes it out of every other one.
155
+ No project command archives a project: the API does not record which were created
156
+ automatically, so an emptied one is reported and left for you to archive in the
157
+ dashboard. This selection does not change the serverless `inquir deploy`
158
+ workflow or local source/configuration project discovery.
159
+
97
160
  ## Deploy a function (remote)
98
161
 
99
162
  Once installed globally, deploying takes three steps:
@@ -131,7 +194,7 @@ OIDC auth), or run `inquir deploy --ci`.
131
194
  **Auth & workspaces**
132
195
 
133
196
  - `inquir login` - authenticate the CLI (browser pairing, `--browserless`, or `--token`).
134
- - `inquir logout` - remove the stored token + active workspace for the current environment.
197
+ - `inquir logout` - revoke the current browser-issued CLI session and clear its local credentials and workspace.
135
198
  - `inquir whoami` - show the signed-in user, active workspace, and role.
136
199
  - `inquir workspaces` - list the workspaces you belong to.
137
200
  - `inquir use <slug|id> [--local]` - set the active workspace; `--local` links *this project* by writing `workspace` into `inquir.config.json`.
@@ -158,16 +221,19 @@ runtime adapter involved.
158
221
  - `inquir apps deploy <app> [--image <ref>]` - start a release and wait until it is healthy. Without `--image` the current directory (or `--dir`) is built from its Dockerfile first; `--build <id>` releases an existing build.
159
222
  - `inquir apps build <app> [--dir <path>] [--dockerfile <f>] [--context <dir>] [--build-arg K=V]` - build an image from source without releasing it.
160
223
  - `inquir apps builds <app>` - build history (`--cancel <buildId>` drops a queued build).
161
- - `inquir apps status <app>` - endpoints, hostnames and recent releases.
224
+ - `inquir apps status <app>` - endpoints (public and private), hostnames and recent releases. The `private:` lines are what another app in the workspace dials (`{slug}.apps.internal`, port per TCP service); they appear once the platform has verified the route.
162
225
  - `inquir apps logs <app|release|build> [--tail <n>]` - stream container (or build) logs.
163
226
  - `inquir apps promote <release>` - send production traffic to a release (needs a login, not an API key).
164
227
  - `inquir apps rollback <app>` - return production to the previous release.
165
228
  - `inquir apps stop <release>` - stop any release that is not serving production.
166
229
  - `inquir apps exec <app> -- <command>` - run a command inside the container (owner/admin login only — it can read every secret).
167
- - `inquir apps update <app> [--set K=V] [--port …] [--egress none|full] …` - change settings; applies to the next release.
230
+ - `inquir apps update <app> [--set K=V] [--port …] [--egress none|full] [--ingress private|public] …` - change settings; applies to the next release. `--ingress public` creates the generated public domain, `--ingress private` removes it (the private address is unaffected). New apps are private unless created with `--ingress public`.
168
231
  - `inquir apps domain <app> [hostname] [--verify|--remove]` - bind a custom hostname; publish the printed TXT record and point DNS at the platform, then `--verify`.
169
232
  - `inquir apps delete <app> --yes` - archive an application (stops every release, unbinds every hostname).
170
233
 
234
+ Project archive in the dashboard also archives every application in the project, including applications shared with another project. It requires production permissions (`projects:write` and `apps:promote`). Clearing the local project selection with `inquir projects use --clear` only changes where future applications are created; it does not archive applications.
235
+
236
+
171
237
  ```bash
172
238
  # an HTTP service built from the Dockerfile in the current directory
173
239
  inquir apps create web --port 3000
@@ -193,6 +259,31 @@ TCP port is reachable by anyone who can reach the host: the platform
193
259
  terminates no TLS and checks no credentials on raw TCP, so the service must
194
260
  authenticate its own clients.
195
261
 
262
+ `--drain-grace <seconds>` (`create`, `deploy`, `update`; 0–3600) — the time the
263
+ old container gets after SIGTERM before it is killed (`runtimeSpec.drainGraceSeconds`).
264
+ Like `--memory` or `--cpu` it is saved on the application by `create`/`update`
265
+ and carried into every release built from the saved runtime.
266
+
267
+ **Databases**
268
+
269
+ - `inquir apps create <name> --template postgres|redis` - create a database: image, persistent volume, private TCP port, generated password and its first release, in one command. Add `--volume-runner <runner>` to keep its data and container on a worker; the worker runs the operator's digest-pinned mirror of the template image, and without one the create is refused (`APP_TEMPLATE_IMAGE_NOT_MIRRORED`).
270
+ - `inquir apps connection-url <db>` - print the live connection URL, credentials included (it lands in your shell history).
271
+ - `inquir apps connect <db> <app>` - write that URL into another application's env as `DATABASE_URL` / `REDIS_URL` without it passing through your terminal; it applies on that application's next release.
272
+ - `inquir apps backups <app> [list|create|restore <id>|delete <id>]` - volume snapshots. `restore` **overwrites the volume** with the snapshot and stops the application while it runs, so it asks for confirmation — pass `--yes` in a script.
273
+
274
+ ```bash
275
+ inquir apps create mydb --template postgres
276
+ inquir apps connect mydb web # web gets DATABASE_URL on its next release
277
+ inquir apps backups mydb create # snapshot every volume, wait for it to settle
278
+ inquir apps backups mydb restore 3f9c1a2b --yes
279
+ ```
280
+
281
+ An application that declares a volume deploys by stopping its container before
282
+ starting the new one, so two containers never write the same data — expect a
283
+ short outage on every deploy. Backups are crash-consistent (the container is
284
+ paused while it is copied) and need an artifact store configured on the
285
+ deployment; without one the backup commands report that they are unavailable.
286
+
196
287
  **Staying up to date**
197
288
 
198
289
  The CLI keeps itself in step with the platform. On start it checks — at most
@@ -214,6 +305,16 @@ failing later on a changed wire contract.
214
305
  - `inquir config [show|get <key>|set <key> <value>|path]` - view/edit CLI configuration.
215
306
  - `inquir help [command]` - show grouped help, or help for one command.
216
307
 
308
+ **Platform operators**
309
+
310
+ - `inquir admin cluster [status|hold|release|move <memberId>|host register|grant <host> <capability>|revoke <host> <capability>]` -
311
+ the multi-master control plane (docs/roadmap/R4_MULTI_MASTER.md §6.2). It authenticates with the platform admin token in
312
+ `INQUIR_ADMIN_TOKEN`, never with your login; changes need the full token and land in the admin audit log.
313
+ - `inquir admin allocations relocate <allocationId> --reason <text> [--target <runnerId>]` - move one serving replica
314
+ make-before-break: its replacement starts (on the target, which must pass every placement filter and have room), takes
315
+ the traffic, and only then is the replica stopped. Pinned, volume, preview and TCP-pinned replicas are refused, as is an
316
+ application in a deployment handoff. `inquir admin allocations relocation <operationId>` shows where it is. Same token.
317
+
217
318
  ### `deploy` flags
218
319
 
219
320
  ```bash
@@ -328,9 +429,22 @@ wins):
328
429
  - `INQUIR_ENV` — pick a named environment
329
430
  3. Selected environment in the config file
330
431
  4. Project link — `workspace` in the local `inquir.config.json` (set by `inquir use --local`); applies to the workspace only, below flags/env
331
- 5. Top-level config file values
432
+ 5. Top-level config file values (credentials and workspace only when the named environment uses the same API)
332
433
  6. Default `apiUrl` of `https://api.inquir.org` (override with env/config for local dev)
333
434
 
435
+ A named environment with its own different API does not inherit the default
436
+ token, API key, cached identity, or workspace. Partial profiles using the same API
437
+ can still inherit defaults. Explicit flags and environment variables keep the
438
+ precedence above. An unknown environment name fails before a remote command;
439
+ `inquir login --env <name>` can create it.
440
+
441
+ When login changes the default API, existing named profiles that inherited that
442
+ API and contain credentials, a workspace, or cached identity retain their previous
443
+ API binding. Their stored credentials are preserved. A profile that previously
444
+ inherited its credentials may need its own login after this change. Empty profiles
445
+ continue to inherit defaults. Changing a profile's API also removes its stored API
446
+ key, so logging out of the new PAT cannot reactivate a key from the previous API.
447
+
334
448
  When both a `token` (PAT) and an `apiKey` are present, the PAT wins. The active
335
449
  `workspaceId` is only applied to user-scoped credentials (PAT/session); for a
336
450
  workspace-scoped API key it is ignored unless you pass `--workspace` explicitly.
@@ -340,6 +454,13 @@ Config file locations:
340
454
  - `~/.inquir/config.json` (preferred, written by `inquir login` / `use`; saved with `0600` permissions)
341
455
  - `~/.lambda-cli/config.json` (legacy fallback — **credentials only**; the legacy `apiUrl` is intentionally ignored so you aren't silently pinned to `localhost`)
342
456
 
457
+ Credential updates use an atomic file replacement and an exclusive
458
+ `~/.inquir/config.json.lock` while updating or revoking a session. A timed-out lock
459
+ is never stolen from a running command. If a command crashed and subsequent commands
460
+ report `AUTH_CONFIG_LOCKED`, stop all CLI commands before removing that lock file.
461
+ Older CLI versions do not participate in this locking protocol; avoid running old
462
+ and new versions concurrently against the same configuration.
463
+
343
464
  Example (written/managed by `inquir login`, `inquir use`, `inquir logout`):
344
465
 
345
466
  ```json
@@ -377,36 +498,122 @@ failing check.
377
498
 
378
499
  The CLI (`@inquir/compute-cli`) depends on the SDK (`@inquir/compute`), so the
379
500
  SDK must be published **first** at a version satisfying the CLI's dependency
380
- range (`dependencies["@inquir/compute"]`, currently `^0.1.0`).
501
+ range (`dependencies["@inquir/compute"]`, `^0.4.0` for CLI 0.4.0). Set the lower
502
+ bound to the first SDK release containing every API the CLI imports. A workspace
503
+ build uses the local SDK and cannot prove that an older published SDK works.
504
+
505
+ Release order for 0.4.0: CLI 0.4.0 imports `isPromoteAccepted` and
506
+ `getApplicationRollout` (the background promote, `inquir apps promote`), which
507
+ SDK 0.3.0 does not export. Publish SDK 0.4.0 first and confirm it on the
508
+ registry; a CLI published against SDK 0.3.0 would fail at startup.
509
+
510
+ New `inquir init` scaffolds inherit this SDK range and require Node.js 22+.
511
+ Existing `package.json` files are preserved; update their dependencies explicitly
512
+ when adopting a newer SDK.
381
513
 
382
514
  Prerequisites:
383
515
 
384
516
  - An npm account with publish access to the `@inquir` scope (create the org/scope on npmjs.com), then `npm login`.
385
517
  - Both packages declare `"publishConfig": { "access": "public" }`, so scoped packages publish publicly.
386
- - Each package's `prepublishOnly` rebuilds `dist/` automatically; only `dist/` ships (`files: ["dist"]`).
518
+ - Both packages build before packing or publishing from source. The SDK includes
519
+ `dist/`; the CLI includes `dist/` and its bundled `skill/`. npm also includes
520
+ package metadata and README files.
521
+ - Choose unused release versions, update the CLI's SDK dependency and the lockfile,
522
+ then run the SDK and CLI tests before preparing the release candidate.
387
523
 
388
- Steps (run from the repo root):
524
+ Prepare the exact tarballs from the repo root:
389
525
 
390
526
  ```bash
391
- npm login
527
+ # Cleans and builds the SDK first, then the CLI.
528
+ npm run build --workspace @inquir/compute-cli
529
+ # Reuse the verified build instead of rebuilding during packing.
530
+ npm pack --workspace @inquir/compute --ignore-scripts
531
+ npm pack --workspace @inquir/compute-cli --ignore-scripts
532
+ ```
392
533
 
393
- # 1) Publish the SDK first — the CLI resolves it from the public registry.
394
- npm version <patch|minor|major> --workspace @inquir/compute
395
- npm publish --workspace @inquir/compute
534
+ Install both tarballs into a temporary directory outside this repository. Check
535
+ `npm ls @inquir/compute`, `inquir --version`, `inquir --help`, project commands,
536
+ and a local TypeScript function run. Resolve packages from that installation,
537
+ without workspace links, so the smoke test exercises the files users receive.
396
538
 
397
- # 2) Publish the CLI. Ensure its @inquir/compute dependency range covers the
398
- # SDK version you just published, then:
399
- npm version <patch|minor|major> --workspace @inquir/compute-cli
400
- npm publish --workspace @inquir/compute-cli
401
- ```
539
+ Publish those tested tarballs in order (0.3.0 shown; use the chosen versions):
402
540
 
403
- Tips:
541
+ ```bash
542
+ npm publish ./inquir-compute-0.3.0.tgz --access public
543
+ # Confirm this SDK version is available from the registry before publishing CLI.
544
+ npm view @inquir/compute@0.3.0 version
545
+ npm publish ./inquir-compute-cli-0.3.0.tgz --access public
546
+ ```
404
547
 
405
- - Preview the exact tarball contents without publishing: `npm publish --dry-run --workspace @inquir/compute-cli`.
406
- - The published `bin` is `inquir` (from `dist/index.js`, which keeps its `#!/usr/bin/env node` shebang).
407
- - After publishing, anyone can install and deploy:
548
+ After building, preview package contents without publishing with
549
+ `npm pack --dry-run --json --ignore-scripts --workspace @inquir/compute-cli`.
550
+ `--ignore-scripts` skips build hooks, so only use it after the explicit build.
551
+ The installed command is `inquir`, from `dist/index.js` with its Node shebang.
552
+ After publishing, users can install it with:
408
553
 
409
554
  ```bash
410
555
  npm install -g @inquir/compute-cli@latest
411
556
  inquir --help
412
557
  ```
558
+ ## Application observability
559
+
560
+ Read actual resource history for every release and replica, or HTTP gateway measurements:
561
+
562
+ ```sh
563
+ inquir apps metrics api --since 6h
564
+ inquir apps metrics api --since 30d --json
565
+ inquir apps metrics api --http --since 1d --json
566
+ ```
567
+
568
+ The resource table shows the latest point per replica in the selected window. JSON contains all returned points, their enforced CPU/RAM limits, network transfer rates, disk I/O rates and deployment markers. `null` means the measurement is unavailable; it is not zero. Disk I/O measures reads/writes, not occupied volume space. HTTP measurements cover gateway requests, including request counts, 5xx errors, response bytes and latency percentiles. Resource and HTTP history is retained for 30 days; resource points older than a day are rolled up to one per five minutes, and older than a week to one per hour, each keeping the bucket's last point plus its CPU and memory peak and mean. Inspect `status`, `latestSampleAt` and `truncated` in resource JSON before interpreting a range as current or complete.
569
+
570
+ Ask what the CPU and memory figures could be, from what the production replicas actually used:
571
+
572
+ ```sh
573
+ inquir apps resources recommend api
574
+ inquir apps resources recommend api --days 3 --json
575
+ ```
576
+
577
+ The recommendation is read-only. Memory is 1.2 × the peak working set in the window (default 7 days), at least 64 MB, at least 256 MB for a database, and never below the peak of the whole 30-day history plus 10%. The CPU limit follows the peak (1.5 ×, at least 0.1 vCPU); the reserved request shown is what the platform would reserve for that limit, next to the request the 95th percentile of five-minute averages alone would justify. A recommendation needs 24 hours of observed usage; `confidence` reports the days observed and the samples behind it, and `--json` adds each release (replica set) seen in the window. Apply one yourself with `inquir apps update api --memory <mb> --cpu <vcpus>` and `inquir apps redeploy api`.
578
+
579
+ Persisted container logs remain readable after the container is replaced. Select an app and optionally an exact release or runtime identity:
580
+
581
+ ```sh
582
+ inquir apps log-history api --since 1h --level error --json
583
+ inquir apps logs api --history --release <release-id> --replica <allocation-id> --allocation-fence 4
584
+ inquir apps log-history api --runner <runner-id> --runner-epoch 0 --container <full-container-id>
585
+ inquir apps log-history api --http --since 7d --status 503 --search /api --json
586
+ ```
587
+
588
+ History returns one page, newest first. Runtime retention is 7 days; HTTP retention is 30 days. Use `--limit` (up to 200 runtime rows or 500 HTTP rows) and `--cursor` for older pages. Always reuse the response's `from` and `to` as `--from`/`--to`, plus the same filters, when using a cursor. `apps logs api` without `--history` still follows the current release; `apps logs <build-id>` still reads build output.
589
+
590
+ Configure alert rules using JSON files or stdin. Destinations are write-only and are omitted from command output:
591
+
592
+ ```sh
593
+ inquir apps alerts api list --json
594
+ inquir apps alerts api create --file cpu-alert.json
595
+ inquir apps alerts api update <rule-id> --file patch.json
596
+ inquir apps alerts api incidents --limit 25 --json
597
+ inquir apps alerts api delete <rule-id>
598
+ ```
599
+
600
+ Example `cpu-alert.json` (incident-only until a notification destination is configured):
601
+
602
+ ```json
603
+ {
604
+ "name": "High CPU",
605
+ "enabled": true,
606
+ "metric": "cpu_percent",
607
+ "threshold": 85,
608
+ "forSeconds": 120,
609
+ "recoveryThreshold": 65,
610
+ "recoveryForSeconds": 60,
611
+ "noDataSeconds": 180,
612
+ "noData": "alert",
613
+ "channels": []
614
+ }
615
+ ```
616
+
617
+ Use `memory_percent` for RAM or `deployment_failed` for failed production deployments. CPU/RAM rules evaluate the continuous maximum across current production replicas; the hot replica can change during the hold period. Percentage thresholds refer to each container's enforced limit. For deployment events, timing and threshold fields do not control the failure trigger. Notification channels have the shape `{"type":"webhook","url":"https://your-endpoint.example/alerts"}` or `{"type":"slack","url":"https://hooks.slack.com/..."}`. Keep secret URLs in a file outside version control, or pipe JSON to `--file -`. The server must have secret encryption configured to accept notification channels.
618
+
619
+ A patch such as `{"threshold":90}` keeps existing destinations. `{"channels":[]}` removes them. Deleting a rule disables it and resolves active incidents while preserving retained history. Incident results include notification delivery state and retry counts. All commands honor the existing `--workspace`, `--env`, `--api-url` and credential selection rules.
@@ -0,0 +1,11 @@
1
+ export type AdminCall = (args: string[], request: {
2
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
3
+ path: string;
4
+ body?: Record<string, unknown>;
5
+ }) => Promise<Record<string, unknown>>;
6
+ export declare const TENANT_VALUE_FLAGS: string[];
7
+ export declare const TENANT_USAGE: string[];
8
+ export declare const TENANT_HELP: string[];
9
+ export declare function tenantsCommand(args: string[], action: string | undefined, rest: string[], json: boolean, call: AdminCall): Promise<void>;
10
+ export declare function containerdTenantsCommand(args: string[], action: string | undefined, rest: string[], json: boolean, call: AdminCall): Promise<void>;
11
+ //# sourceMappingURL=admin-tenants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-tenants.d.ts","sourceRoot":"","sources":["../../src/commands/admin-tenants.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,KAC3I,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEnC,eAAO,MAAM,kBAAkB,UAG9B,CAAC;AAEF,eAAO,MAAM,YAAY,UAMxB,CAAC;AAEF,eAAO,MAAM,WAAW,UAcvB,CAAC;AAiNF,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C9I;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CxJ"}