@inquir/compute-cli 0.1.4 → 0.2.1

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 (55) hide show
  1. package/README.md +79 -5
  2. package/dist/commands/apps.d.ts +21 -0
  3. package/dist/commands/apps.d.ts.map +1 -0
  4. package/dist/commands/apps.js +857 -0
  5. package/dist/commands/apps.js.map +1 -0
  6. package/dist/commands/config.d.ts.map +1 -1
  7. package/dist/commands/config.js +19 -2
  8. package/dist/commands/config.js.map +1 -1
  9. package/dist/commands/deploy.d.ts.map +1 -1
  10. package/dist/commands/deploy.js +207 -93
  11. package/dist/commands/deploy.js.map +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +4 -2
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/mcp.d.ts +15 -0
  16. package/dist/commands/mcp.d.ts.map +1 -0
  17. package/dist/commands/mcp.js +269 -0
  18. package/dist/commands/mcp.js.map +1 -0
  19. package/dist/commands/upgrade.d.ts +6 -0
  20. package/dist/commands/upgrade.d.ts.map +1 -0
  21. package/dist/commands/upgrade.js +72 -0
  22. package/dist/commands/upgrade.js.map +1 -0
  23. package/dist/index.js +26 -3
  24. package/dist/index.js.map +1 -1
  25. package/dist/utils/api.d.ts +52 -2
  26. package/dist/utils/api.d.ts.map +1 -1
  27. package/dist/utils/api.js +95 -2
  28. package/dist/utils/api.js.map +1 -1
  29. package/dist/utils/apps-presentation.d.ts +25 -0
  30. package/dist/utils/apps-presentation.d.ts.map +1 -0
  31. package/dist/utils/apps-presentation.js +71 -0
  32. package/dist/utils/apps-presentation.js.map +1 -0
  33. package/dist/utils/args.d.ts.map +1 -1
  34. package/dist/utils/args.js +1 -0
  35. package/dist/utils/args.js.map +1 -1
  36. package/dist/utils/auth.d.ts +2 -0
  37. package/dist/utils/auth.d.ts.map +1 -1
  38. package/dist/utils/auth.js +13 -5
  39. package/dist/utils/auth.js.map +1 -1
  40. package/dist/utils/auto-update.d.ts +84 -0
  41. package/dist/utils/auto-update.d.ts.map +1 -0
  42. package/dist/utils/auto-update.js +232 -0
  43. package/dist/utils/auto-update.js.map +1 -0
  44. package/dist/utils/context.d.ts.map +1 -1
  45. package/dist/utils/context.js +3 -1
  46. package/dist/utils/context.js.map +1 -1
  47. package/dist/utils/detect.d.ts +45 -0
  48. package/dist/utils/detect.d.ts.map +1 -0
  49. package/dist/utils/detect.js +358 -0
  50. package/dist/utils/detect.js.map +1 -0
  51. package/dist/utils/ensure-auth.d.ts.map +1 -1
  52. package/dist/utils/ensure-auth.js +7 -1
  53. package/dist/utils/ensure-auth.js.map +1 -1
  54. package/package.json +5 -4
  55. package/skill/SKILL.md +60 -0
package/README.md CHANGED
@@ -4,18 +4,30 @@ CLI for workspace-first Inquir Compute development.
4
4
 
5
5
  ## Install
6
6
 
7
- Global:
7
+ Global (recommended). `@latest` also upgrades an existing install to the newest
8
+ published version:
8
9
 
9
10
  ```bash
10
- npm install -g @inquir/compute-cli
11
+ npm install -g @inquir/compute-cli@latest
11
12
  ```
12
13
 
13
- Or run with `npx`:
14
+ Verify it's on your `PATH`:
14
15
 
15
16
  ```bash
16
- npx @inquir/compute-cli --help
17
+ inquir --version
18
+ inquir --help
17
19
  ```
18
20
 
21
+ Or run without installing:
22
+
23
+ ```bash
24
+ npx @inquir/compute-cli@latest --help
25
+ ```
26
+
27
+ > Requires **Node.js 22+**. To upgrade later, re-run the install command above. On
28
+ > macOS/Linux you may need `sudo` for a global install, or use a Node version
29
+ > manager (nvm/fnm) to avoid it. To remove: `npm uninstall -g @inquir/compute-cli`.
30
+
19
31
  ## Concepts
20
32
 
21
33
  - **Function**: a single compute unit with typed input/output (Zod schemas). Defined with `defineFunction()`. Run locally with `inquir run`, deployed and invoked remotely with `inquir deploy` / `inquir invoke`.
@@ -134,6 +146,68 @@ OIDC auth), or run `inquir deploy --ci`.
134
146
  - `inquir rollback <function> [deployId]` - roll back to a previous successful deploy.
135
147
  - `inquir delete <function>` - delete a remote function (asks for confirmation; `--yes` to skip).
136
148
 
149
+ **Container services (apps)**
150
+
151
+ Long-lived containers from any OCI image — the counterpart to functions. HTTP
152
+ ports are served over a hostname; TCP ports are published and dialled directly,
153
+ so a database, SMTP relay or SSH endpoint is a first-class service with no
154
+ runtime adapter involved.
155
+
156
+ - `inquir apps list` - list applications.
157
+ - `inquir apps create <name> [--port <n>] [--tcp …] [--set K=V]` - create an application.
158
+ - `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
+ - `inquir apps build <app> [--dir <path>] [--dockerfile <f>] [--context <dir>] [--build-arg K=V]` - build an image from source without releasing it.
160
+ - `inquir apps builds <app>` - build history (`--cancel <buildId>` drops a queued build).
161
+ - `inquir apps status <app>` - endpoints, hostnames and recent releases.
162
+ - `inquir apps logs <app|release|build> [--tail <n>]` - stream container (or build) logs.
163
+ - `inquir apps promote <release>` - send production traffic to a release (needs a login, not an API key).
164
+ - `inquir apps rollback <app>` - return production to the previous release.
165
+ - `inquir apps stop <release>` - stop any release that is not serving production.
166
+ - `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.
168
+ - `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
+ - `inquir apps delete <app> --yes` - archive an application (stops every release, unbinds every hostname).
170
+
171
+ ```bash
172
+ # an HTTP service built from the Dockerfile in the current directory
173
+ inquir apps create web --port 3000
174
+ inquir apps deploy web
175
+ inquir apps promote <releaseId>
176
+
177
+ # ...or from a prebuilt image
178
+ inquir apps deploy web --image nginx:alpine
179
+
180
+ # a database: no HTTP port at all, published on a pinned port,
181
+ # health-checked by asking the service itself
182
+ inquir apps create db \
183
+ --tcp postgres:5432:public:25432 \
184
+ --health-command "pg_isready -h 127.0.0.1" \
185
+ --set POSTGRES_PASSWORD=secret
186
+ inquir apps deploy db --image postgres:16-alpine
187
+ ```
188
+
189
+ `--tcp name:port[:public][:hostPort]` — `public` publishes beyond loopback,
190
+ and a pinned `hostPort` keeps a connection string valid across restarts (an
191
+ unpinned port is reassigned every time the container is recreated). A public
192
+ TCP port is reachable by anyone who can reach the host: the platform
193
+ terminates no TLS and checks no credentials on raw TCP, so the service must
194
+ authenticate its own clients.
195
+
196
+ **Staying up to date**
197
+
198
+ The CLI keeps itself in step with the platform. On start it checks — at most
199
+ every 12 hours, with a 2.5 s network timeout, never failing your command — the
200
+ npm registry for the latest `@inquir/compute-cli` and the API for the minimum
201
+ version it still supports (`GET /v1/cli/version`). When a newer version exists
202
+ and the CLI is a global npm install running in an interactive terminal, it
203
+ updates itself and re-runs your command; in CI, under `--json`, without a TTY,
204
+ via `npx` or from a source checkout it only prints a one-line notice. If the
205
+ API's *minimum* is not met, the command stops with the exact fix instead of
206
+ failing later on a changed wire contract.
207
+
208
+ - `inquir upgrade` - update now (`--check` only reports).
209
+ - Opt out: `inquir config set autoUpdate false`, `INQUIR_NO_AUTO_UPDATE=1`, or `--no-update` on one command.
210
+
137
211
  **Diagnostics & config**
138
212
 
139
213
  - `inquir doctor` - diagnose environment, credentials, and API connectivity (`--json` for a report).
@@ -333,6 +407,6 @@ Tips:
333
407
  - After publishing, anyone can install and deploy:
334
408
 
335
409
  ```bash
336
- npm install -g @inquir/compute-cli
410
+ npm install -g @inquir/compute-cli@latest
337
411
  inquir --help
338
412
  ```
@@ -0,0 +1,21 @@
1
+ import { type AppPortSpec, type AppRuntimeSpec, type Release } from '../utils/api.js';
2
+ export declare function appsCommand(args: string[]): Promise<void>;
3
+ /**
4
+ * `--tcp name:port[:public][:hostPort]` — the shorthand people actually want
5
+ * to type for a database or SSH endpoint.
6
+ */
7
+ export declare function parseTcpPortFlag(value: string): AppPortSpec;
8
+ export declare function parseSetFlags(values: string[]): Record<string, string>;
9
+ /** Runtime spec assembled from flags; undefined when nothing was specified. */
10
+ export declare function buildRuntimeFromFlags(args: string[]): AppRuntimeSpec | undefined;
11
+ /**
12
+ * Where a client can actually connect. Public endpoints first; a host-local
13
+ * port is still printed (marked as such) because on an installation with no
14
+ * public hostname it is the only way in.
15
+ */
16
+ export declare function releaseEndpointLines(release: Release, previewUrl?: string, options?: {
17
+ includeHostLocal?: boolean;
18
+ }): string[];
19
+ /** A build-sourced release is best named by its build; a pulled one by its ref. */
20
+ export declare function describeImage(release: Pick<Release, 'imageSource' | 'buildId' | 'imageRef' | 'imageDigest'>): string;
21
+ //# sourceMappingURL=apps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AAEA,OAAO,EAyBL,KAAK,WAAW,EAChB,KAAK,cAAc,EAGnB,KAAK,OAAO,EAEb,MAAM,iBAAiB,CAAC;AAgCzB,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8C/D;AAqDD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CA6B3D;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUtE;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,GAAG,SAAS,CAuChF;AA+PD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC3C,MAAM,EAAE,CAwBV;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC,GAAG,MAAM,CAGpH"}