@walkeros/cli 1.4.0-next-1771332305084 → 1.4.0-next-1771334965900

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/CHANGELOG.md CHANGED
@@ -1,17 +1,18 @@
1
1
  # @walkeros/cli
2
2
 
3
- ## 1.4.0-next-1771332305084
3
+ ## 1.4.0-next-1771334965900
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - a2f27d4: Add deploy command for web and server deployments
7
8
  - 7b2d750: Add walkerOS.json package convention for CDN-based schema discovery
8
9
 
9
10
  ### Patch Changes
10
11
 
11
12
  - 1ae6972: Fix missing trailing newline in JSON output
12
13
  - Updated dependencies [7b2d750]
13
- - @walkeros/core@1.4.0-next-1771332305084
14
- - @walkeros/server-core@1.0.6-next-1771332305084
14
+ - @walkeros/core@1.4.0-next-1771334965900
15
+ - @walkeros/server-core@1.0.6-next-1771334965900
15
16
 
16
17
  ## 1.3.0
17
18
 
package/dist/cli.js CHANGED
@@ -3988,6 +3988,115 @@ async function readFlowStdin() {
3988
3988
  return readStdin();
3989
3989
  }
3990
3990
 
3991
+ // src/commands/deploy/index.ts
3992
+ async function deploy(options) {
3993
+ const projectId = options.projectId ?? requireProjectId();
3994
+ const client = createApiClient();
3995
+ const { data, error } = await client.POST(
3996
+ "/api/projects/{projectId}/flows/{flowId}/deploy",
3997
+ { params: { path: { projectId, flowId: options.flowId } } }
3998
+ );
3999
+ if (error)
4000
+ throw new Error(error.error?.message || "Failed to start deployment");
4001
+ if (!options.wait) return data;
4002
+ const terminalStatuses = ["active", "published", "failed", "deleted"];
4003
+ let status = data.status;
4004
+ let result = { ...data };
4005
+ while (!terminalStatuses.includes(status)) {
4006
+ await new Promise((r) => setTimeout(r, 3e3));
4007
+ const { data: advanced, error: advanceError } = await client.POST(
4008
+ "/api/projects/{projectId}/flows/{flowId}/deploy/{deploymentId}/advance",
4009
+ {
4010
+ params: {
4011
+ path: {
4012
+ projectId,
4013
+ flowId: options.flowId,
4014
+ deploymentId: data.deploymentId
4015
+ }
4016
+ }
4017
+ }
4018
+ );
4019
+ if (advanceError)
4020
+ throw new Error(
4021
+ advanceError.error?.message || "Failed to advance deployment"
4022
+ );
4023
+ if (advanced) {
4024
+ status = advanced.status;
4025
+ result = { ...advanced };
4026
+ }
4027
+ }
4028
+ return result;
4029
+ }
4030
+ async function getDeployment(options) {
4031
+ const projectId = options.projectId ?? requireProjectId();
4032
+ const client = createApiClient();
4033
+ const { data, error } = await client.GET(
4034
+ "/api/projects/{projectId}/flows/{flowId}/deploy",
4035
+ { params: { path: { projectId, flowId: options.flowId } } }
4036
+ );
4037
+ if (error)
4038
+ throw new Error(error.error?.message || "Failed to get deployment");
4039
+ return data;
4040
+ }
4041
+ async function deployCommand(flowId, options) {
4042
+ const log = createCommandLogger(options);
4043
+ try {
4044
+ const result = await deploy({
4045
+ flowId,
4046
+ projectId: options.project,
4047
+ wait: options.wait !== false
4048
+ });
4049
+ if (options.json) {
4050
+ await writeResult(JSON.stringify(result, null, 2), options);
4051
+ return;
4052
+ }
4053
+ const r = result;
4054
+ if (r.status === "published") {
4055
+ log.success(`Published: ${r.publicUrl}`);
4056
+ if (r.scriptTag) log.info(`Script tag: ${r.scriptTag}`);
4057
+ } else if (r.status === "active") {
4058
+ log.success(`Active: ${r.containerUrl}`);
4059
+ } else if (r.status === "failed") {
4060
+ log.error(`Failed: ${r.errorMessage || "Unknown error"}`);
4061
+ process.exit(1);
4062
+ } else if (r.status === "bundling") {
4063
+ log.info(`Deployment started: ${r.deploymentId} (${r.type})`);
4064
+ } else {
4065
+ log.info(`Status: ${r.status}`);
4066
+ }
4067
+ } catch (err) {
4068
+ log.error(err instanceof Error ? err.message : "Deploy failed");
4069
+ process.exit(1);
4070
+ }
4071
+ }
4072
+ async function getDeploymentCommand(flowId, options) {
4073
+ const log = createCommandLogger(options);
4074
+ try {
4075
+ const result = await getDeployment({
4076
+ flowId,
4077
+ projectId: options.project
4078
+ });
4079
+ if (options.json) {
4080
+ await writeResult(JSON.stringify(result, null, 2), options);
4081
+ return;
4082
+ }
4083
+ if (!result) {
4084
+ log.info("No deployment found");
4085
+ return;
4086
+ }
4087
+ log.info(`Deployment: ${result.id}`);
4088
+ log.info(`Type: ${result.type}`);
4089
+ log.info(`Status: ${result.status}`);
4090
+ if (result.containerUrl) log.info(`Endpoint: ${result.containerUrl}`);
4091
+ if (result.publicUrl) log.info(`URL: ${result.publicUrl}`);
4092
+ if (result.scriptTag) log.info(`Script tag: ${result.scriptTag}`);
4093
+ if (result.errorMessage) log.error(`Error: ${result.errorMessage}`);
4094
+ } catch (err) {
4095
+ log.error(err instanceof Error ? err.message : "Failed to get deployment");
4096
+ process.exit(1);
4097
+ }
4098
+ }
4099
+
3991
4100
  // src/cli.ts
3992
4101
  var program = new Command();
3993
4102
  program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version(VERSION);
@@ -4115,6 +4224,13 @@ flowsCmd.command("delete <flowId>").description("Delete a flow").option("--proje
4115
4224
  flowsCmd.command("duplicate <flowId>").description("Duplicate a flow").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("--name <name>", "name for the copy").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (flowId, options) => {
4116
4225
  await duplicateFlowCommand(flowId, options);
4117
4226
  });
4227
+ var deployCmd = program.command("deploy").description("Deploy flows to walkerOS cloud");
4228
+ deployCmd.command("start <flowId>").description("Deploy a flow (auto-detects web or server)").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("--no-wait", "do not wait for deployment to complete").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (flowId, options) => {
4229
+ await deployCommand(flowId, options);
4230
+ });
4231
+ deployCmd.command("status <flowId>").description("Get the latest deployment status for a flow").option("--project <id>", "project ID (defaults to WALKEROS_PROJECT_ID)").option("-o, --output <path>", "output file path").option("--json", "output as JSON").option("-v, --verbose", "verbose output").option("-s, --silent", "suppress output").action(async (flowId, options) => {
4232
+ await getDeploymentCommand(flowId, options);
4233
+ });
4118
4234
  var runCmd = program.command("run").description("Run walkerOS flows in collect or serve mode");
4119
4235
  runCmd.command("collect [file]").description(
4120
4236
  "Run collector mode (event collection endpoint). Defaults to server-collect.mjs if no file specified."
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Flow, Elb } from '@walkeros/core';
2
2
  export { Flow } from '@walkeros/core';
3
3
  import { BuildOptions as BuildOptions$1 } from 'esbuild';
4
4
  import { z } from '@walkeros/core/dev';
5
+ import * as openapi_typescript_helpers from 'openapi-typescript-helpers';
5
6
  import * as openapi_fetch from 'openapi-fetch';
6
7
 
7
8
  /**
@@ -2322,6 +2323,171 @@ interface paths {
2322
2323
  patch?: never;
2323
2324
  trace?: never;
2324
2325
  };
2326
+ '/api/projects/{projectId}/flows/{flowId}/deploy': {
2327
+ parameters: {
2328
+ query?: never;
2329
+ header?: never;
2330
+ path?: never;
2331
+ cookie?: never;
2332
+ };
2333
+ /**
2334
+ * Get latest deployment
2335
+ * @description Get the latest deployment for a flow.
2336
+ */
2337
+ get: {
2338
+ parameters: {
2339
+ query?: never;
2340
+ header?: never;
2341
+ path: {
2342
+ projectId: string;
2343
+ flowId: string;
2344
+ };
2345
+ cookie?: never;
2346
+ };
2347
+ requestBody?: never;
2348
+ responses: {
2349
+ /** @description Latest deployment (or null) */
2350
+ 200: {
2351
+ headers: {
2352
+ [name: string]: unknown;
2353
+ };
2354
+ content: {
2355
+ 'application/json': components['schemas']['Deployment'] | null;
2356
+ };
2357
+ };
2358
+ /** @description Unauthorized */
2359
+ 401: {
2360
+ headers: {
2361
+ [name: string]: unknown;
2362
+ };
2363
+ content: {
2364
+ 'application/json': components['schemas']['ErrorResponse'];
2365
+ };
2366
+ };
2367
+ };
2368
+ };
2369
+ put?: never;
2370
+ /**
2371
+ * Deploy flow
2372
+ * @description Start a deployment for a flow. Auto-detects web or server from flow content.
2373
+ */
2374
+ post: {
2375
+ parameters: {
2376
+ query?: never;
2377
+ header?: never;
2378
+ path: {
2379
+ projectId: string;
2380
+ flowId: string;
2381
+ };
2382
+ cookie?: never;
2383
+ };
2384
+ requestBody?: never;
2385
+ responses: {
2386
+ /** @description Deployment started */
2387
+ 201: {
2388
+ headers: {
2389
+ [name: string]: unknown;
2390
+ };
2391
+ content: {
2392
+ 'application/json': components['schemas']['DeployResponse'];
2393
+ };
2394
+ };
2395
+ /** @description Invalid flow */
2396
+ 400: {
2397
+ headers: {
2398
+ [name: string]: unknown;
2399
+ };
2400
+ content: {
2401
+ 'application/json': components['schemas']['ErrorResponse'];
2402
+ };
2403
+ };
2404
+ /** @description Unauthorized */
2405
+ 401: {
2406
+ headers: {
2407
+ [name: string]: unknown;
2408
+ };
2409
+ content: {
2410
+ 'application/json': components['schemas']['ErrorResponse'];
2411
+ };
2412
+ };
2413
+ /** @description Not found */
2414
+ 404: {
2415
+ headers: {
2416
+ [name: string]: unknown;
2417
+ };
2418
+ content: {
2419
+ 'application/json': components['schemas']['ErrorResponse'];
2420
+ };
2421
+ };
2422
+ };
2423
+ };
2424
+ delete?: never;
2425
+ options?: never;
2426
+ head?: never;
2427
+ patch?: never;
2428
+ trace?: never;
2429
+ };
2430
+ '/api/projects/{projectId}/flows/{flowId}/deploy/{deploymentId}/advance': {
2431
+ parameters: {
2432
+ query?: never;
2433
+ header?: never;
2434
+ path?: never;
2435
+ cookie?: never;
2436
+ };
2437
+ get?: never;
2438
+ put?: never;
2439
+ /**
2440
+ * Advance deployment
2441
+ * @description Advance the deployment state machine. Poll until terminal status.
2442
+ */
2443
+ post: {
2444
+ parameters: {
2445
+ query?: never;
2446
+ header?: never;
2447
+ path: {
2448
+ projectId: string;
2449
+ flowId: string;
2450
+ deploymentId: string;
2451
+ };
2452
+ cookie?: never;
2453
+ };
2454
+ requestBody?: never;
2455
+ responses: {
2456
+ /** @description Current deployment state */
2457
+ 200: {
2458
+ headers: {
2459
+ [name: string]: unknown;
2460
+ };
2461
+ content: {
2462
+ 'application/json': components['schemas']['Deployment'];
2463
+ };
2464
+ };
2465
+ /** @description Unauthorized */
2466
+ 401: {
2467
+ headers: {
2468
+ [name: string]: unknown;
2469
+ };
2470
+ content: {
2471
+ 'application/json': components['schemas']['ErrorResponse'];
2472
+ };
2473
+ };
2474
+ /** @description Not found */
2475
+ 404: {
2476
+ headers: {
2477
+ [name: string]: unknown;
2478
+ };
2479
+ content: {
2480
+ 'application/json': components['schemas']['ErrorResponse'];
2481
+ };
2482
+ };
2483
+ };
2484
+ };
2485
+ delete?: never;
2486
+ options?: never;
2487
+ head?: never;
2488
+ patch?: never;
2489
+ trace?: never;
2490
+ };
2325
2491
  '/api/projects/{projectId}/observe/ticket': {
2326
2492
  parameters: {
2327
2493
  query?: never;
@@ -2964,6 +3130,38 @@ interface components {
2964
3130
  ValidateTicketRequest: {
2965
3131
  ticket: string;
2966
3132
  };
3133
+ Deployment: {
3134
+ /** @example dep_a1b2c3d4 */
3135
+ id: string;
3136
+ /** @example flow_a1b2c3d4 */
3137
+ flowId: string;
3138
+ /** @enum {string} */
3139
+ type: 'web' | 'server';
3140
+ /** @enum {string} */
3141
+ status:
3142
+ | 'bundling'
3143
+ | 'deploying'
3144
+ | 'active'
3145
+ | 'failed'
3146
+ | 'deleted'
3147
+ | 'published';
3148
+ containerUrl?: string | null;
3149
+ publicUrl?: string | null;
3150
+ scriptTag?: string | null;
3151
+ errorMessage?: string | null;
3152
+ /** Format: date-time */
3153
+ createdAt: string;
3154
+ /** Format: date-time */
3155
+ updatedAt: string;
3156
+ };
3157
+ DeployResponse: {
3158
+ /** @example dep_a1b2c3d4 */
3159
+ deploymentId: string;
3160
+ /** @enum {string} */
3161
+ type: 'web' | 'server';
3162
+ /** @example bundling */
3163
+ status: string;
3164
+ };
2967
3165
  HealthResponse: {
2968
3166
  /** @example ok */
2969
3167
  status: string;
@@ -2976,6 +3174,46 @@ interface components {
2976
3174
  pathItems: never;
2977
3175
  }
2978
3176
 
3177
+ interface DeployOptions {
3178
+ flowId: string;
3179
+ projectId?: string;
3180
+ wait?: boolean;
3181
+ }
3182
+ declare function deploy(options: DeployOptions): Promise<Record<string, unknown> | {
3183
+ deploymentId: string;
3184
+ type: "web" | "server";
3185
+ status: string;
3186
+ }>;
3187
+ declare function getDeployment(options: {
3188
+ flowId: string;
3189
+ projectId?: string;
3190
+ }): Promise<openapi_typescript_helpers.Readable<openapi_typescript_helpers.SuccessResponse<{
3191
+ 200: {
3192
+ headers: {
3193
+ [name: string]: unknown;
3194
+ };
3195
+ content: {
3196
+ "application/json": components["schemas"]["Deployment"] | null;
3197
+ };
3198
+ };
3199
+ 401: {
3200
+ headers: {
3201
+ [name: string]: unknown;
3202
+ };
3203
+ content: {
3204
+ "application/json": components["schemas"]["ErrorResponse"];
3205
+ };
3206
+ };
3207
+ }, `${string}/${string}`>>>;
3208
+ interface DeployCommandOptions extends GlobalOptions {
3209
+ project?: string;
3210
+ wait?: boolean;
3211
+ output?: string;
3212
+ json?: boolean;
3213
+ }
3214
+ declare function deployCommand(flowId: string, options: DeployCommandOptions): Promise<void>;
3215
+ declare function getDeploymentCommand(flowId: string, options: DeployCommandOptions): Promise<void>;
3216
+
2979
3217
  declare function createApiClient(): openapi_fetch.Client<paths, `${string}/${string}`>;
2980
3218
 
2981
- export { type BuildOptions, type BundleStats, type CLIBuildOptions, type GlobalOptions, type ListFlowsOptions, type MinifyOptions, type PushResult, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type SimulationResult, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, bundle, bundleCommand, bundleRemote, createApiClient, createFlow, createFlowCommand, createProject, createProjectCommand, deleteFlow, deleteFlowCommand, deleteProject, deleteProjectCommand, duplicateFlow, duplicateFlowCommand, getAuthHeaders, getFlow, getFlowCommand, getProject, getProjectCommand, getToken, listFlows, listFlowsCommand, listProjects, listProjectsCommand, loginCommand, logoutCommand, push, pushCommand, requireProjectId, resolveBaseUrl, run, runCommand, simulate, simulateCommand, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand };
3219
+ export { type BuildOptions, type BundleStats, type CLIBuildOptions, type DeployOptions, type GlobalOptions, type ListFlowsOptions, type MinifyOptions, type PushResult, type RunCommandOptions, type RunMode, type RunOptions, type RunResult, type SimulationResult, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, bundle, bundleCommand, bundleRemote, createApiClient, createFlow, createFlowCommand, createProject, createProjectCommand, deleteFlow, deleteFlowCommand, deleteProject, deleteProjectCommand, deploy, deployCommand, duplicateFlow, duplicateFlowCommand, getAuthHeaders, getDeployment, getDeploymentCommand, getFlow, getFlowCommand, getProject, getProjectCommand, getToken, listFlows, listFlowsCommand, listProjects, listProjectsCommand, loginCommand, logoutCommand, push, pushCommand, requireProjectId, resolveBaseUrl, run, runCommand, simulate, simulateCommand, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand };
package/dist/index.js CHANGED
@@ -4020,6 +4020,115 @@ async function readFlowStdin() {
4020
4020
  }
4021
4021
  return readStdin();
4022
4022
  }
4023
+
4024
+ // src/commands/deploy/index.ts
4025
+ async function deploy(options) {
4026
+ const projectId = options.projectId ?? requireProjectId();
4027
+ const client = createApiClient();
4028
+ const { data, error } = await client.POST(
4029
+ "/api/projects/{projectId}/flows/{flowId}/deploy",
4030
+ { params: { path: { projectId, flowId: options.flowId } } }
4031
+ );
4032
+ if (error)
4033
+ throw new Error(error.error?.message || "Failed to start deployment");
4034
+ if (!options.wait) return data;
4035
+ const terminalStatuses = ["active", "published", "failed", "deleted"];
4036
+ let status = data.status;
4037
+ let result = { ...data };
4038
+ while (!terminalStatuses.includes(status)) {
4039
+ await new Promise((r) => setTimeout(r, 3e3));
4040
+ const { data: advanced, error: advanceError } = await client.POST(
4041
+ "/api/projects/{projectId}/flows/{flowId}/deploy/{deploymentId}/advance",
4042
+ {
4043
+ params: {
4044
+ path: {
4045
+ projectId,
4046
+ flowId: options.flowId,
4047
+ deploymentId: data.deploymentId
4048
+ }
4049
+ }
4050
+ }
4051
+ );
4052
+ if (advanceError)
4053
+ throw new Error(
4054
+ advanceError.error?.message || "Failed to advance deployment"
4055
+ );
4056
+ if (advanced) {
4057
+ status = advanced.status;
4058
+ result = { ...advanced };
4059
+ }
4060
+ }
4061
+ return result;
4062
+ }
4063
+ async function getDeployment(options) {
4064
+ const projectId = options.projectId ?? requireProjectId();
4065
+ const client = createApiClient();
4066
+ const { data, error } = await client.GET(
4067
+ "/api/projects/{projectId}/flows/{flowId}/deploy",
4068
+ { params: { path: { projectId, flowId: options.flowId } } }
4069
+ );
4070
+ if (error)
4071
+ throw new Error(error.error?.message || "Failed to get deployment");
4072
+ return data;
4073
+ }
4074
+ async function deployCommand(flowId, options) {
4075
+ const log = createCommandLogger(options);
4076
+ try {
4077
+ const result = await deploy({
4078
+ flowId,
4079
+ projectId: options.project,
4080
+ wait: options.wait !== false
4081
+ });
4082
+ if (options.json) {
4083
+ await writeResult(JSON.stringify(result, null, 2), options);
4084
+ return;
4085
+ }
4086
+ const r = result;
4087
+ if (r.status === "published") {
4088
+ log.success(`Published: ${r.publicUrl}`);
4089
+ if (r.scriptTag) log.info(`Script tag: ${r.scriptTag}`);
4090
+ } else if (r.status === "active") {
4091
+ log.success(`Active: ${r.containerUrl}`);
4092
+ } else if (r.status === "failed") {
4093
+ log.error(`Failed: ${r.errorMessage || "Unknown error"}`);
4094
+ process.exit(1);
4095
+ } else if (r.status === "bundling") {
4096
+ log.info(`Deployment started: ${r.deploymentId} (${r.type})`);
4097
+ } else {
4098
+ log.info(`Status: ${r.status}`);
4099
+ }
4100
+ } catch (err) {
4101
+ log.error(err instanceof Error ? err.message : "Deploy failed");
4102
+ process.exit(1);
4103
+ }
4104
+ }
4105
+ async function getDeploymentCommand(flowId, options) {
4106
+ const log = createCommandLogger(options);
4107
+ try {
4108
+ const result = await getDeployment({
4109
+ flowId,
4110
+ projectId: options.project
4111
+ });
4112
+ if (options.json) {
4113
+ await writeResult(JSON.stringify(result, null, 2), options);
4114
+ return;
4115
+ }
4116
+ if (!result) {
4117
+ log.info("No deployment found");
4118
+ return;
4119
+ }
4120
+ log.info(`Deployment: ${result.id}`);
4121
+ log.info(`Type: ${result.type}`);
4122
+ log.info(`Status: ${result.status}`);
4123
+ if (result.containerUrl) log.info(`Endpoint: ${result.containerUrl}`);
4124
+ if (result.publicUrl) log.info(`URL: ${result.publicUrl}`);
4125
+ if (result.scriptTag) log.info(`Script tag: ${result.scriptTag}`);
4126
+ if (result.errorMessage) log.error(`Error: ${result.errorMessage}`);
4127
+ } catch (err) {
4128
+ log.error(err instanceof Error ? err.message : "Failed to get deployment");
4129
+ process.exit(1);
4130
+ }
4131
+ }
4023
4132
  export {
4024
4133
  bundle,
4025
4134
  bundleCommand,
@@ -4033,9 +4142,13 @@ export {
4033
4142
  deleteFlowCommand,
4034
4143
  deleteProject,
4035
4144
  deleteProjectCommand,
4145
+ deploy,
4146
+ deployCommand,
4036
4147
  duplicateFlow,
4037
4148
  duplicateFlowCommand,
4038
4149
  getAuthHeaders,
4150
+ getDeployment,
4151
+ getDeploymentCommand,
4039
4152
  getFlow,
4040
4153
  getFlowCommand,
4041
4154
  getProject,