@inquir/compute-cli 0.1.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/README.md +240 -0
- package/dist/commands/codegen.d.ts +2 -0
- package/dist/commands/codegen.d.ts.map +1 -0
- package/dist/commands/codegen.js +36 -0
- package/dist/commands/codegen.js.map +1 -0
- package/dist/commands/debug.d.ts +2 -0
- package/dist/commands/debug.d.ts.map +1 -0
- package/dist/commands/debug.js +15 -0
- package/dist/commands/debug.js.map +1 -0
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +127 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/deploys.d.ts +2 -0
- package/dist/commands/deploys.d.ts.map +1 -0
- package/dist/commands/deploys.js +40 -0
- package/dist/commands/deploys.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +157 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/invoke.d.ts +2 -0
- package/dist/commands/invoke.d.ts.map +1 -0
- package/dist/commands/invoke.js +33 -0
- package/dist/commands/invoke.js.map +1 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +37 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +163 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +19 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/logs.d.ts +2 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +47 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/rollback.d.ts +2 -0
- package/dist/commands/rollback.d.ts.map +1 -0
- package/dist/commands/rollback.js +55 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +62 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +55 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync-status.d.ts +2 -0
- package/dist/commands/sync-status.d.ts.map +1 -0
- package/dist/commands/sync-status.js +56 -0
- package/dist/commands/sync-status.js.map +1 -0
- package/dist/commands/use.d.ts +2 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +30 -0
- package/dist/commands/use.js.map +1 -0
- package/dist/commands/whoami.d.ts +2 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +36 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/commands/workspaces.d.ts +2 -0
- package/dist/commands/workspaces.d.ts.map +1 -0
- package/dist/commands/workspaces.js +37 -0
- package/dist/commands/workspaces.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk.d.ts +2 -0
- package/dist/sdk.d.ts.map +1 -0
- package/dist/sdk.js +2 -0
- package/dist/sdk.js.map +1 -0
- package/dist/utils/api.d.ts +31 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +66 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/args.d.ts +19 -0
- package/dist/utils/args.d.ts.map +1 -0
- package/dist/utils/args.js +93 -0
- package/dist/utils/args.js.map +1 -0
- package/dist/utils/assets.d.ts +8 -0
- package/dist/utils/assets.d.ts.map +1 -0
- package/dist/utils/assets.js +19 -0
- package/dist/utils/assets.js.map +1 -0
- package/dist/utils/auth.d.ts +41 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/auth.js +97 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/browser.d.ts +7 -0
- package/dist/utils/browser.d.ts.map +1 -0
- package/dist/utils/browser.js +34 -0
- package/dist/utils/browser.js.map +1 -0
- package/dist/utils/deploy-follow.d.ts +23 -0
- package/dist/utils/deploy-follow.d.ts.map +1 -0
- package/dist/utils/deploy-follow.js +57 -0
- package/dist/utils/deploy-follow.js.map +1 -0
- package/dist/utils/output.d.ts +19 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +71 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/payload.d.ts +10 -0
- package/dist/utils/payload.d.ts.map +1 -0
- package/dist/utils/payload.js +42 -0
- package/dist/utils/payload.js.map +1 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# @inquir/compute-cli
|
|
2
|
+
|
|
3
|
+
CLI for workspace-first Inquir Compute development.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Global:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @inquir/compute-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run with `npx`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @inquir/compute-cli --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Concepts
|
|
20
|
+
|
|
21
|
+
- **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`.
|
|
22
|
+
- **Pipeline**: a declarative DAG of functions defined with `definePipeline()`. Registered in the codegen registry for client use; remote run/deploy for pipelines is handled by the backend.
|
|
23
|
+
- **Client**: the generated TypeScript module at `.inquir/generated/client.ts`. Wraps remote invocation with schemas inferred from your source. Import it in your application code.
|
|
24
|
+
- **Source of truth**: your local files under `functionsDir` and `pipelinesDir`. `registry.json` is a derived artifact rebuilt by `inquir codegen` — never hand-edit it.
|
|
25
|
+
- **Local ↔ remote link**: each deployed remote function stores a `linkedLocalName` (your local asset name) and a `sourceHash`. `inquir sync status` compares hashes to detect drift.
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
inquir init
|
|
31
|
+
inquir codegen
|
|
32
|
+
inquir list
|
|
33
|
+
inquir run hello --payload '{"name":"World"}'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Authentication
|
|
37
|
+
|
|
38
|
+
The recommended way to authenticate on your own machine is a browser login,
|
|
39
|
+
which mints a user-scoped **Personal Access Token** (PAT) bound to your account
|
|
40
|
+
and stores it in `~/.inquir/config.json`:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
inquir login # opens your browser to approve this device
|
|
44
|
+
inquir whoami # show the signed-in user + active workspace
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`inquir login` prints a short code and opens a dashboard page; confirm the code
|
|
48
|
+
matches and click **Authorize**. The CLI then receives its token automatically.
|
|
49
|
+
|
|
50
|
+
Other login modes:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
inquir login --browserless # print the URL + code instead of opening a browser
|
|
54
|
+
inquir login --token <pat> # non-interactive (CI): use a PAT created in the dashboard
|
|
55
|
+
inquir login --name "my CI" # label the device/token shown in the dashboard
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Create and revoke PATs from the dashboard under **API Keys → Personal Access
|
|
59
|
+
Tokens**. To sign out and remove the stored token: `inquir logout`.
|
|
60
|
+
|
|
61
|
+
> A PAT can deploy to **any workspace you belong to**. A workspace-scoped **API
|
|
62
|
+
> key** is pinned to a single workspace and ignores workspace switching.
|
|
63
|
+
|
|
64
|
+
## Workspaces
|
|
65
|
+
|
|
66
|
+
A single login works across every workspace you're a member of. List them and
|
|
67
|
+
choose a default:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
inquir workspaces # list workspaces (active one marked with *)
|
|
71
|
+
inquir use <slug|id> # set the active workspace for subsequent commands
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Target a different workspace for a single command with `--workspace`:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
inquir deploy hello --workspace acme-prod
|
|
78
|
+
inquir deploys hello --workspace acme-prod
|
|
79
|
+
inquir whoami --workspace acme-prod
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Under the hood, user-scoped credentials send an `X-Inquir-Workspace` header; the
|
|
83
|
+
server verifies your membership before honoring it.
|
|
84
|
+
|
|
85
|
+
## Deploy a function (remote)
|
|
86
|
+
|
|
87
|
+
Once installed globally, deploying takes three steps:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# 1. Authenticate. Easiest on a workstation:
|
|
91
|
+
inquir login
|
|
92
|
+
# For CI / scripts, export env vars for a one-off instead:
|
|
93
|
+
# export INQUIR_API_URL="https://api.inquir.org"
|
|
94
|
+
# export INQUIR_API_KEY="<api-key>" # workspace-scoped key, or
|
|
95
|
+
# export INQUIR_TOKEN="<personal-access-token>"
|
|
96
|
+
|
|
97
|
+
# 2. From your workspace (created by `inquir init`), deploy an asset by name.
|
|
98
|
+
inquir deploy hello # streams build/deploy logs, exits non-zero on failure
|
|
99
|
+
|
|
100
|
+
# 3. Invoke it remotely.
|
|
101
|
+
inquir invoke hello --payload '{"name":"World"}'
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Get an API key from your Inquir Compute workspace settings. For CI, prefer the
|
|
105
|
+
[`inquir-compute/deploy-action`](../deploy-action) GitHub Action (supports keyless
|
|
106
|
+
OIDC auth), or run `inquir deploy --ci`.
|
|
107
|
+
|
|
108
|
+
## Commands
|
|
109
|
+
|
|
110
|
+
- `inquir init [--skip-install]` - scaffold `inquir.config.json`, folders, and sample function.
|
|
111
|
+
- `inquir codegen` - discover assets and generate `.inquir/generated/client.ts` + `registry.json`.
|
|
112
|
+
- `inquir list` - list discovered local assets.
|
|
113
|
+
- `inquir run <asset>` - run a local asset.
|
|
114
|
+
- `inquir debug <asset>` - run locally with inspector enabled.
|
|
115
|
+
- `inquir login` - authenticate the CLI (browser pairing, `--browserless`, or `--token`).
|
|
116
|
+
- `inquir logout` - remove the stored token + active workspace for the current environment.
|
|
117
|
+
- `inquir whoami` - show the signed-in user, active workspace, and role.
|
|
118
|
+
- `inquir workspaces` - list the workspaces you belong to.
|
|
119
|
+
- `inquir use <slug|id>` - set the active workspace for subsequent commands.
|
|
120
|
+
- `inquir invoke <asset>` - invoke remote function by name / linked local name.
|
|
121
|
+
- `inquir deploy <asset>` - package, upload, and deploy a function (async; streams build logs).
|
|
122
|
+
- `inquir deploys <function>` - list deploy history for a remote function.
|
|
123
|
+
- `inquir status <deployId>` - show a deploy's status (`--follow` to stream logs).
|
|
124
|
+
- `inquir rollback <function> [deployId]` - roll back to a previous successful deploy.
|
|
125
|
+
- `inquir logs <asset>` - show recent remote invocation history.
|
|
126
|
+
- `inquir sync status` - compare local hashes with remote hashes (`in-sync`, `drift`, `missing`).
|
|
127
|
+
|
|
128
|
+
### `deploy` flags
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
inquir deploy hello # package + async deploy, stream build logs
|
|
132
|
+
inquir deploy hello --environment staging
|
|
133
|
+
inquir deploy hello --no-logs # queue and wait for completion without streaming
|
|
134
|
+
inquir deploy hello --ci # plain output, non-zero exit on failure (for CI)
|
|
135
|
+
inquir deploy hello --dry-run # validate + package only; no create/deploy
|
|
136
|
+
inquir deploy hello --json # machine-readable result
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Exit codes: `0` success, `1` deploy/validation error, `3` network/timeout error.
|
|
140
|
+
|
|
141
|
+
## Global Flags
|
|
142
|
+
|
|
143
|
+
- `--config <path>` - config file path or workspace directory.
|
|
144
|
+
- `--json` - machine-readable output when supported.
|
|
145
|
+
- `--env <name>` - select environment from auth config.
|
|
146
|
+
- `--workspace <slug|id>` - target a specific workspace for this command (user-scoped login).
|
|
147
|
+
|
|
148
|
+
Global flags work in any position, for example both are valid:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
inquir run hello --config ./inquir.config.json
|
|
152
|
+
inquir --config ./inquir.config.json run hello
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Payload Input
|
|
156
|
+
|
|
157
|
+
`run` and `invoke` support:
|
|
158
|
+
|
|
159
|
+
- `--payload '{"k":"v"}'`
|
|
160
|
+
- `--payload-file ./payload.json`
|
|
161
|
+
- stdin piping
|
|
162
|
+
|
|
163
|
+
## Remote Auth / Environment
|
|
164
|
+
|
|
165
|
+
The CLI resolves each credential field independently, in this order (first match
|
|
166
|
+
wins):
|
|
167
|
+
|
|
168
|
+
1. CLI flags / `--env <name>` selection (and `--workspace` for the workspace)
|
|
169
|
+
2. Environment variables (`LAMBDA_*` are legacy fallbacks):
|
|
170
|
+
- `INQUIR_API_URL`, `INQUIR_API_KEY`
|
|
171
|
+
- `INQUIR_TOKEN` — a Personal Access Token (takes precedence over `apiKey`)
|
|
172
|
+
- `INQUIR_WORKSPACE` — active workspace (slug or id)
|
|
173
|
+
- `INQUIR_ENV` — pick a named environment
|
|
174
|
+
3. Selected environment in the config file
|
|
175
|
+
4. Top-level config file values
|
|
176
|
+
5. Default `apiUrl` of `https://api.inquir.org` (override with env/config for local dev)
|
|
177
|
+
|
|
178
|
+
When both a `token` (PAT) and an `apiKey` are present, the PAT wins. The active
|
|
179
|
+
`workspaceId` is only applied to user-scoped credentials (PAT/session); for a
|
|
180
|
+
workspace-scoped API key it is ignored unless you pass `--workspace` explicitly.
|
|
181
|
+
|
|
182
|
+
Config file locations:
|
|
183
|
+
|
|
184
|
+
- `~/.inquir/config.json` (preferred, written by `inquir login` / `use`)
|
|
185
|
+
- `~/.lambda-cli/config.json` (legacy fallback)
|
|
186
|
+
|
|
187
|
+
Example (written/managed by `inquir login`, `inquir use`, `inquir logout`):
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"apiUrl": "https://api.inquir.org",
|
|
192
|
+
"token": "inq_pat_…",
|
|
193
|
+
"workspaceId": "acme-prod",
|
|
194
|
+
"user": { "id": "…", "email": "you@example.com", "name": "You" },
|
|
195
|
+
"environments": {
|
|
196
|
+
"staging": {
|
|
197
|
+
"apiUrl": "https://staging.example.com",
|
|
198
|
+
"apiKey": "staging-key"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Publishing to npm (maintainers)
|
|
205
|
+
|
|
206
|
+
The CLI (`@inquir/compute-cli`) depends on the SDK (`@inquir/compute`), so the
|
|
207
|
+
SDK must be published **first** at a version satisfying the CLI's dependency
|
|
208
|
+
range (`dependencies["@inquir/compute"]`, currently `^0.1.0`).
|
|
209
|
+
|
|
210
|
+
Prerequisites:
|
|
211
|
+
|
|
212
|
+
- An npm account with publish access to the `@inquir` scope (create the org/scope on npmjs.com), then `npm login`.
|
|
213
|
+
- Both packages declare `"publishConfig": { "access": "public" }`, so scoped packages publish publicly.
|
|
214
|
+
- Each package's `prepublishOnly` rebuilds `dist/` automatically; only `dist/` ships (`files: ["dist"]`).
|
|
215
|
+
|
|
216
|
+
Steps (run from the repo root):
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
npm login
|
|
220
|
+
|
|
221
|
+
# 1) Publish the SDK first — the CLI resolves it from the public registry.
|
|
222
|
+
npm version <patch|minor|major> --workspace @inquir/compute
|
|
223
|
+
npm publish --workspace @inquir/compute
|
|
224
|
+
|
|
225
|
+
# 2) Publish the CLI. Ensure its @inquir/compute dependency range covers the
|
|
226
|
+
# SDK version you just published, then:
|
|
227
|
+
npm version <patch|minor|major> --workspace @inquir/compute-cli
|
|
228
|
+
npm publish --workspace @inquir/compute-cli
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Tips:
|
|
232
|
+
|
|
233
|
+
- Preview the exact tarball contents without publishing: `npm publish --dry-run --workspace @inquir/compute-cli`.
|
|
234
|
+
- The published `bin` is `inquir` (from `dist/index.js`, which keeps its `#!/usr/bin/env node` shebang).
|
|
235
|
+
- After publishing, anyone can install and deploy:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
npm install -g @inquir/compute-cli
|
|
239
|
+
inquir --help
|
|
240
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AASA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAkClE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { discoverAssets, generateAndWriteCodegenArtifacts, loadConfig, } from '../sdk.js';
|
|
3
|
+
import { hasFlag, readJsonFlag, readWorkspaceDir } from '../utils/args.js';
|
|
4
|
+
import { cyan, dim, formatDiagnostic, printCommandHelp, printLine, printSuccess } from '../utils/output.js';
|
|
5
|
+
export async function codegenCommand(args) {
|
|
6
|
+
if (hasFlag(args, '--help') || hasFlag(args, '-h')) {
|
|
7
|
+
printCommandHelp('codegen', 'codegen [options]', [
|
|
8
|
+
'--config <path> Path to workspace or config file',
|
|
9
|
+
'--json Machine-readable JSON output',
|
|
10
|
+
]);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const config = loadConfig(readWorkspaceDir(args));
|
|
14
|
+
const registry = await discoverAssets(config);
|
|
15
|
+
const generatedDir = path.resolve(config.rootDir, config.generatedDir);
|
|
16
|
+
const artifacts = await generateAndWriteCodegenArtifacts(generatedDir, registry);
|
|
17
|
+
if (readJsonFlag(args)) {
|
|
18
|
+
printLine(JSON.stringify({
|
|
19
|
+
outputDir: generatedDir,
|
|
20
|
+
assets: artifacts.registry.assets,
|
|
21
|
+
diagnostics: registry.diagnostics,
|
|
22
|
+
}, null, 2));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
printSuccess(`Wrote ${path.relative(config.rootDir, path.join(generatedDir, 'client.ts'))}`);
|
|
26
|
+
printSuccess(`Wrote ${path.relative(config.rootDir, path.join(generatedDir, 'registry.json'))}`);
|
|
27
|
+
const allDiagnostics = [...registry.diagnostics, ...artifacts.collisionDiagnostics];
|
|
28
|
+
if (allDiagnostics.length > 0) {
|
|
29
|
+
printLine('');
|
|
30
|
+
printLine(cyan('Diagnostics:'));
|
|
31
|
+
for (const diagnostic of allDiagnostics) {
|
|
32
|
+
printLine(dim(` ${formatDiagnostic(diagnostic, config.rootDir)}`));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=codegen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegen.js","sourceRoot":"","sources":["../../src/commands/codegen.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,gCAAgC,EAChC,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE5G,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAc;IACjD,IAAI,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,gBAAgB,CAAC,SAAS,EAAE,mBAAmB,EAAE;YAC/C,mDAAmD;YACnD,+CAA+C;SAChD,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;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ug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AAIA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { hasFlag } from '../utils/args.js';
|
|
2
|
+
import { printCommandHelp } from '../utils/output.js';
|
|
3
|
+
import { runCommand } from './run.js';
|
|
4
|
+
export async function debugCommand(args) {
|
|
5
|
+
if (hasFlag(args, '--help') || hasFlag(args, '-h')) {
|
|
6
|
+
printCommandHelp('debug', 'debug <asset> [options]', [
|
|
7
|
+
'--payload <json> JSON payload string',
|
|
8
|
+
'--payload-file <path> Path to JSON payload file',
|
|
9
|
+
'--config <path> Path to workspace or config file',
|
|
10
|
+
]);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
await runCommand(args, true);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAc;IAC/C,IAAI,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACnD,gBAAgB,CAAC,OAAO,EAAE,yBAAyB,EAAE;YACnD,4CAA4C;YAC5C,kDAAkD;YAClD,yDAAyD;SAC1D,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IACD,MAAM,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAwCA,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsHjE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { discoverAssets, loadConfig } from '../sdk.js';
|
|
3
|
+
import { findAssetOrExplain } from '../utils/assets.js';
|
|
4
|
+
import { hasFlag, readEnvironmentFlag, readFlagValue, readJsonFlag, readPositionalArgs, readWorkspaceDir, readWorkspaceFlag, } from '../utils/args.js';
|
|
5
|
+
import { createRemoteFunction, listRemoteFunctions, queueDeploy, updateRemoteFunction, } from '../utils/api.js';
|
|
6
|
+
import { collectGitContext, followDeploy } from '../utils/deploy-follow.js';
|
|
7
|
+
import { printCommandHelp, printError, printLine, printSuccess } from '../utils/output.js';
|
|
8
|
+
import { createZipBase64 } from '@inquir/compute';
|
|
9
|
+
function runtimeToRemoteRuntime(runtime) {
|
|
10
|
+
switch (runtime) {
|
|
11
|
+
case 'python':
|
|
12
|
+
return 'python312';
|
|
13
|
+
case 'go':
|
|
14
|
+
return 'go122';
|
|
15
|
+
case 'node':
|
|
16
|
+
default:
|
|
17
|
+
return 'nodejs22';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function deriveHandler(asset) {
|
|
21
|
+
const relativePath = path.relative(asset.assetDir, asset.filePath).replace(/\\/g, '/');
|
|
22
|
+
const withoutExtension = relativePath.replace(/\.[^.]+$/, '');
|
|
23
|
+
return `${withoutExtension}.${asset.exportName}`;
|
|
24
|
+
}
|
|
25
|
+
export async function deployCommand(args) {
|
|
26
|
+
if (hasFlag(args, '--help') || hasFlag(args, '-h')) {
|
|
27
|
+
printCommandHelp('deploy', 'deploy <asset> [options]', [
|
|
28
|
+
'--environment <name> Target deploy environment (e.g. production, staging)',
|
|
29
|
+
'--workspace <id|slug> Target workspace for this deploy (user-scoped login)',
|
|
30
|
+
'--env <name> Named CLI environment from ~/.inquir/config.json',
|
|
31
|
+
'--config <path> Path to workspace or config file',
|
|
32
|
+
'--no-logs Do not stream build logs; wait for completion',
|
|
33
|
+
'--ci CI mode: plain output, exit non-zero on failure',
|
|
34
|
+
'--dry-run Validate and package without creating or deploying',
|
|
35
|
+
'--json Machine-readable JSON output',
|
|
36
|
+
]);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const [assetName] = readPositionalArgs(args, { valueFlags: ['--environment'] });
|
|
40
|
+
if (!assetName) {
|
|
41
|
+
throw new Error('Missing asset name');
|
|
42
|
+
}
|
|
43
|
+
const config = loadConfig(readWorkspaceDir(args));
|
|
44
|
+
const registry = await discoverAssets(config);
|
|
45
|
+
const assetResult = findAssetOrExplain(registry, assetName);
|
|
46
|
+
if ('error' in assetResult) {
|
|
47
|
+
throw new Error(assetResult.error);
|
|
48
|
+
}
|
|
49
|
+
const asset = assetResult.asset;
|
|
50
|
+
if (asset.kind !== 'function') {
|
|
51
|
+
throw new Error(`Deploy is currently supported for function assets only (received ${asset.kind})`);
|
|
52
|
+
}
|
|
53
|
+
const json = readJsonFlag(args);
|
|
54
|
+
const ci = hasFlag(args, '--ci');
|
|
55
|
+
const noLogs = hasFlag(args, '--no-logs');
|
|
56
|
+
const dryRun = hasFlag(args, '--dry-run');
|
|
57
|
+
const deployEnvironment = readFlagValue(args, '--environment');
|
|
58
|
+
const apiOptions = { environment: readEnvironmentFlag(args), workspaceId: readWorkspaceFlag(args) };
|
|
59
|
+
const codeZipBase64 = await createZipBase64(asset.assetDir);
|
|
60
|
+
const remoteFunctions = await listRemoteFunctions(apiOptions);
|
|
61
|
+
const existing = remoteFunctions.find((item) => item.linkedLocalName === asset.name || item.name === asset.name);
|
|
62
|
+
const payload = {
|
|
63
|
+
name: asset.name,
|
|
64
|
+
handler: deriveHandler(asset),
|
|
65
|
+
runtime: runtimeToRemoteRuntime(asset.runtime),
|
|
66
|
+
codeZipBase64,
|
|
67
|
+
sourceHash: asset.sourceHash,
|
|
68
|
+
linkedLocalName: asset.name,
|
|
69
|
+
};
|
|
70
|
+
if (dryRun) {
|
|
71
|
+
const approxBytes = Math.floor((codeZipBase64.length * 3) / 4);
|
|
72
|
+
const plan = {
|
|
73
|
+
dryRun: true,
|
|
74
|
+
asset: asset.name,
|
|
75
|
+
action: existing ? 'update' : 'create',
|
|
76
|
+
functionId: existing?.id,
|
|
77
|
+
handler: payload.handler,
|
|
78
|
+
runtime: payload.runtime,
|
|
79
|
+
environment: deployEnvironment ?? 'production',
|
|
80
|
+
packagedBytes: approxBytes,
|
|
81
|
+
};
|
|
82
|
+
if (json) {
|
|
83
|
+
printLine(JSON.stringify(plan, null, 2));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
printLine(`Dry run for ${asset.name}:`);
|
|
87
|
+
printLine(` action: ${plan.action}${existing ? ` (${existing.id})` : ''}`);
|
|
88
|
+
printLine(` handler: ${plan.handler}`);
|
|
89
|
+
printLine(` runtime: ${plan.runtime}`);
|
|
90
|
+
printLine(` environment: ${plan.environment}`);
|
|
91
|
+
printLine(` packaged: ~${approxBytes} bytes`);
|
|
92
|
+
printSuccess('Dry run OK — no function created or deployed.');
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const remoteFunction = existing
|
|
97
|
+
? await updateRemoteFunction(existing.id, payload, apiOptions)
|
|
98
|
+
: await createRemoteFunction(payload, apiOptions);
|
|
99
|
+
const queued = await queueDeploy({
|
|
100
|
+
functionId: remoteFunction.id,
|
|
101
|
+
environment: deployEnvironment,
|
|
102
|
+
source: ci ? 'github-actions' : 'cli',
|
|
103
|
+
git: collectGitContext(),
|
|
104
|
+
}, apiOptions);
|
|
105
|
+
if (!json) {
|
|
106
|
+
printLine(`Queued deploy ${queued.deployId} (v${queued.version}) for ${asset.name}`);
|
|
107
|
+
}
|
|
108
|
+
const finalDeploy = await followDeploy(queued.deployId, apiOptions, { json, ci, noLogs });
|
|
109
|
+
if (json) {
|
|
110
|
+
printLine(JSON.stringify({ function: remoteFunction, deploy: finalDeploy }, null, 2));
|
|
111
|
+
}
|
|
112
|
+
else if (finalDeploy.status === 'success') {
|
|
113
|
+
const duration = finalDeploy.durationMs ? `, ${finalDeploy.durationMs}ms` : '';
|
|
114
|
+
printSuccess(`Deployed ${asset.name} (deploy ${finalDeploy.deployId}, v${finalDeploy.version}${duration})`);
|
|
115
|
+
if (finalDeploy.url) {
|
|
116
|
+
printLine(`URL: ${finalDeploy.url}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
printError(`Deploy ${finalDeploy.deployId} ${finalDeploy.status}` +
|
|
121
|
+
(finalDeploy.error ? `: ${finalDeploy.error}` : ''));
|
|
122
|
+
}
|
|
123
|
+
if (finalDeploy.status !== 'success') {
|
|
124
|
+
process.exitCode = 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAmB,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,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AC,CAAC,KAAK,WAAW,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,YAAY,CAAC,YAAY,KAAK,CAAC,IAAI,YAAY,WAAW,CAAC,QAAQ,MAAM,WAAW,CAAC,OAAO,GAAG,QAAQ,GAAG,CAAC,CAAC;QAC5G,IAAI,WAAW,CAAC,GAAG,EAAE,CAAC;YACpB,SAAS,CAAC,QAAQ,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,UAAU,CACR,UAAU,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,MAAM,EAAE;YACpD,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACtD,CAAC;IACJ,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploys.d.ts","sourceRoot":"","sources":["../../src/commands/deploys.ts"],"names":[],"mappings":"AAIA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyClE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { hasFlag, readEnvironmentFlag, readJsonFlag, readLimitFlag, readPositionalArgs, readWorkspaceFlag } from '../utils/args.js';
|
|
2
|
+
import { listFunctionDeploys, resolveRemoteFunction } from '../utils/api.js';
|
|
3
|
+
import { formatTable, printCommandHelp, printLine } from '../utils/output.js';
|
|
4
|
+
export async function deploysCommand(args) {
|
|
5
|
+
if (hasFlag(args, '--help') || hasFlag(args, '-h')) {
|
|
6
|
+
printCommandHelp('deploys', 'deploys <function> [options]', [
|
|
7
|
+
'--limit <n> Number of deploys to show (default 20)',
|
|
8
|
+
'--env <name> Named CLI environment from ~/.inquir/config.json',
|
|
9
|
+
'--json Machine-readable JSON output',
|
|
10
|
+
]);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const [identifier] = readPositionalArgs(args, { valueFlags: ['--limit'] });
|
|
14
|
+
if (!identifier) {
|
|
15
|
+
throw new Error('Missing function name or id');
|
|
16
|
+
}
|
|
17
|
+
const apiOptions = { environment: readEnvironmentFlag(args), workspaceId: readWorkspaceFlag(args) };
|
|
18
|
+
const fn = await resolveRemoteFunction(identifier, apiOptions);
|
|
19
|
+
const limit = readLimitFlag(args, 20);
|
|
20
|
+
const result = await listFunctionDeploys(fn.id, { limit }, apiOptions);
|
|
21
|
+
if (readJsonFlag(args)) {
|
|
22
|
+
printLine(JSON.stringify(result, null, 2));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (result.items.length === 0) {
|
|
26
|
+
printLine(`No deploys yet for ${fn.name}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const rows = result.items.map((d) => ({
|
|
30
|
+
version: `v${d.version}`,
|
|
31
|
+
status: d.status,
|
|
32
|
+
active: d.isActive ? '*' : '',
|
|
33
|
+
source: d.source,
|
|
34
|
+
env: d.environment,
|
|
35
|
+
created: d.createdAt,
|
|
36
|
+
deployId: d.deployId,
|
|
37
|
+
}));
|
|
38
|
+
printLine(formatTable(rows, ['version', 'status', 'active', 'source', 'env', 'created', 'deployId']));
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=deploys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploys.js","sourceRoot":"","sources":["../../src/commands/deploys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,i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