@walkeros/cli 2.0.0 → 2.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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Flow, Elb } from '@walkeros/core';
1
+ import { Flow, Elb, WalkerOS } 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';
@@ -143,40 +143,6 @@ interface MinifyOptions {
143
143
  legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
144
144
  }
145
145
 
146
- /**
147
- * Global CLI Options
148
- *
149
- * Options that apply to all commands.
150
- */
151
- /**
152
- * Global options available across all CLI commands
153
- */
154
- interface GlobalOptions {
155
- /**
156
- * Show detailed execution logs
157
- * @default false
158
- */
159
- verbose?: boolean;
160
- /**
161
- * Suppress all output except errors
162
- * @default false
163
- */
164
- silent?: boolean;
165
- }
166
-
167
- /**
168
- * Input Detector
169
- *
170
- * Detects whether CLI input is a config JSON or pre-built bundle.
171
- * Supports both local files and URLs.
172
- */
173
- type Platform$1 = 'web' | 'server';
174
-
175
- declare function getToken(): string | undefined;
176
- declare function getAuthHeaders(): Record<string, string>;
177
- declare function resolveBaseUrl(): string;
178
- declare function requireProjectId(): string;
179
-
180
146
  interface BundleStats {
181
147
  totalSize: number;
182
148
  packages: {
@@ -252,19 +218,13 @@ declare function bundleRemote(options: {
252
218
  stats: any;
253
219
  }>;
254
220
 
255
- /**
256
- * Call Tracker for Simulation
257
- *
258
- * Wraps mock environment functions to track API calls.
259
- * Used with destination-provided examples/env.ts mocks.
260
- */
221
+ /** Tracked API call from destination simulation */
261
222
  interface ApiCall {
262
223
  type: 'call';
263
224
  path: string;
264
225
  args: unknown[];
265
226
  timestamp: number;
266
227
  }
267
-
268
228
  interface SimulateCommandOptions {
269
229
  config?: string;
270
230
  output?: string;
@@ -274,6 +234,16 @@ interface SimulateCommandOptions {
274
234
  verbose?: boolean;
275
235
  silent?: boolean;
276
236
  platform?: 'web' | 'server';
237
+ example?: string;
238
+ step?: string;
239
+ }
240
+ interface ExampleMatch {
241
+ name: string;
242
+ step: string;
243
+ expected: unknown;
244
+ actual: unknown;
245
+ match: boolean;
246
+ diff?: string;
277
247
  }
278
248
  interface SimulationResult {
279
249
  success: boolean;
@@ -283,6 +253,9 @@ interface SimulationResult {
283
253
  logs?: unknown[];
284
254
  usage?: Record<string, ApiCall[]>;
285
255
  duration?: number;
256
+ exampleMatch?: ExampleMatch;
257
+ /** Events captured by source simulation */
258
+ capturedEvents?: WalkerOS.DeepPartialEvent[];
286
259
  }
287
260
 
288
261
  /**
@@ -301,7 +274,7 @@ declare const PlatformSchema: z.ZodEnum<{
301
274
  web: "web";
302
275
  server: "server";
303
276
  }>;
304
- type Platform = z.infer<typeof PlatformSchema>;
277
+ type Platform$1 = z.infer<typeof PlatformSchema>;
305
278
  /**
306
279
  * Simulate options schema.
307
280
  *
@@ -315,6 +288,69 @@ declare const SimulateOptionsSchema: z.ZodObject<{
315
288
  }, z.core.$strip>;
316
289
  type SimulateOptions = z.infer<typeof SimulateOptionsSchema>;
317
290
 
291
+ /**
292
+ * Input Detector
293
+ *
294
+ * Detects whether CLI input is a config JSON or pre-built bundle.
295
+ * Supports both local files and URLs.
296
+ */
297
+ type Platform = 'web' | 'server';
298
+
299
+ declare function getToken(): string | undefined;
300
+ declare function getAuthHeaders(): Record<string, string>;
301
+ /**
302
+ * Fetch with deploy token priority for heartbeat calls.
303
+ * Priority: WALKEROS_DEPLOY_TOKEN > WALKEROS_TOKEN > config file
304
+ */
305
+ declare function deployAuthenticatedFetch(url: string, init?: RequestInit): Promise<Response>;
306
+ declare function resolveBaseUrl(): string;
307
+ declare function requireProjectId(): string;
308
+
309
+ interface SSEEvent {
310
+ type: string;
311
+ data: string;
312
+ }
313
+ interface SSEParseResult {
314
+ parsed: SSEEvent[];
315
+ remainder: string;
316
+ }
317
+ declare function parseSSEEvents(buffer: string): SSEParseResult;
318
+
319
+ type StepType = 'source' | 'transformer' | 'destination';
320
+ interface ExampleLookupResult {
321
+ stepType: StepType;
322
+ stepName: string;
323
+ exampleName: string;
324
+ example: {
325
+ in?: unknown;
326
+ mapping?: unknown;
327
+ out?: unknown;
328
+ };
329
+ }
330
+ /**
331
+ * Find a named example in a flow config.
332
+ *
333
+ * Searches sources, transformers, and destinations for a matching example.
334
+ * If --step is provided (e.g. "destination.gtag"), looks only in that step.
335
+ * If not, searches all steps and errors if ambiguous.
336
+ *
337
+ * @param config - Raw (unresolved) flow config with examples intact
338
+ * @param exampleName - Name of the example to find
339
+ * @param stepTarget - Optional step target in "type.name" format
340
+ * @returns The found example with its location
341
+ */
342
+ declare function findExample(config: Flow.Config, exampleName: string, stepTarget?: string): ExampleLookupResult;
343
+
344
+ /**
345
+ * Compare simulation output against expected example output.
346
+ */
347
+ declare function compareOutput(expected: unknown, actual: unknown): {
348
+ expected: unknown;
349
+ actual: unknown;
350
+ match: boolean;
351
+ diff?: string;
352
+ };
353
+
318
354
  /**
319
355
  * CLI command handler for simulate command
320
356
  */
@@ -355,7 +391,9 @@ declare function simulateCommand(options: SimulateCommandOptions): Promise<void>
355
391
  */
356
392
  declare function simulate(configOrPath: string | unknown, event: unknown, options?: SimulateOptions & {
357
393
  flow?: string;
358
- platform?: Platform;
394
+ platform?: Platform$1;
395
+ example?: string;
396
+ step?: string;
359
397
  }): Promise<SimulationResult>;
360
398
 
361
399
  /**
@@ -428,7 +466,7 @@ declare function pushCommand(options: PushCommandOptions): Promise<void>;
428
466
  */
429
467
  declare function push(configOrPath: string | unknown, event: unknown, options?: PushOptions & {
430
468
  flow?: string;
431
- platform?: Platform$1;
469
+ platform?: Platform;
432
470
  }): Promise<PushResult>;
433
471
 
434
472
  /**
@@ -436,10 +474,6 @@ declare function push(configOrPath: string | unknown, event: unknown, options?:
436
474
  *
437
475
  * Types for running walkerOS flows via CLI using local runtime
438
476
  */
439
- /**
440
- * Run mode - determines which execution mode to use
441
- */
442
- type RunMode = 'collect' | 'serve';
443
477
  /**
444
478
  * CLI command options for `walkeros run`
445
479
  */
@@ -450,16 +484,22 @@ interface RunCommandOptions {
450
484
  port?: number;
451
485
  /** Server host (default: 0.0.0.0) */
452
486
  host?: string;
453
- /** Serve path (URL directory path, e.g., 'libs/v1') */
454
- servePath?: string;
455
- /** Serve name (filename in URL, default: walker.js) */
456
- serveName?: string;
457
487
  /** Enable JSON output */
458
488
  json?: boolean;
459
489
  /** Verbose logging */
460
490
  verbose?: boolean;
461
491
  /** Suppress output */
462
492
  silent?: boolean;
493
+ /** Deployment slug (enables heartbeat to walkerOS app) */
494
+ deployment?: string;
495
+ /** Project ID (used with --deploy) */
496
+ project?: string;
497
+ /** Public URL of this server (used with --deploy) */
498
+ url?: string;
499
+ /** Health check endpoint path (used with --deploy, default: /health) */
500
+ healthEndpoint?: string;
501
+ /** Heartbeat interval in seconds (used with --deploy, default: 60) */
502
+ heartbeatInterval?: number;
463
503
  }
464
504
  /**
465
505
  * Programmatic run options (subset of CLI options)
@@ -471,10 +511,6 @@ interface RunOptions {
471
511
  port?: number;
472
512
  /** Server host */
473
513
  host?: string;
474
- /** Serve path (URL directory path, e.g., 'libs/v1') */
475
- servePath?: string;
476
- /** Serve name (filename in URL, default: walker.js) */
477
- serveName?: string;
478
514
  /** Suppress output */
479
515
  silent?: boolean;
480
516
  /** Verbose logging */
@@ -503,40 +539,40 @@ interface RunResult {
503
539
  /**
504
540
  * CLI command function for `walkeros run`
505
541
  *
506
- * @param mode - Run mode (collect | serve)
507
542
  * @param options - Command options
508
543
  */
509
- declare function runCommand(mode: string, options: RunCommandOptions): Promise<void>;
544
+ declare function runCommand(options: RunCommandOptions): Promise<void>;
510
545
  /**
511
546
  * Programmatic run function
512
547
  *
513
- * @param mode - Run mode (collect | serve)
514
548
  * @param options - Run options
515
549
  * @returns Run result
516
550
  *
517
551
  * @example
518
552
  * ```typescript
519
553
  * // Run with JSON config (bundles automatically)
520
- * await run('collect', {
554
+ * await run({
521
555
  * config: './flow.json',
522
556
  * port: 8080
523
557
  * });
524
558
  *
525
559
  * // Run with pre-built bundle
526
- * await run('collect', {
560
+ * await run({
527
561
  * config: './flow.mjs',
528
562
  * port: 8080
529
563
  * });
530
564
  * ```
531
565
  */
532
- declare function run(mode: RunMode, options: RunOptions): Promise<RunResult>;
566
+ declare function run(options: RunOptions): Promise<RunResult>;
533
567
 
534
- type ValidationType = 'event' | 'flow' | 'mapping' | 'entry';
568
+ type ValidationType = 'contract' | 'event' | 'flow' | 'mapping';
569
+ type ValidateResultType = ValidationType | 'entry';
535
570
  interface ValidateCommandOptions {
536
571
  type: ValidationType;
537
572
  input?: string;
538
573
  output?: string;
539
574
  flow?: string;
575
+ path?: string;
540
576
  json?: boolean;
541
577
  verbose?: boolean;
542
578
  strict?: boolean;
@@ -555,7 +591,7 @@ interface ValidationWarning {
555
591
  }
556
592
  interface ValidateResult {
557
593
  valid: boolean;
558
- type: ValidationType;
594
+ type: ValidateResultType;
559
595
  errors: ValidationError[];
560
596
  warnings: ValidationWarning[];
561
597
  details: Record<string, unknown>;
@@ -565,14 +601,36 @@ interface ValidateResult {
565
601
  * Programmatic API for validation.
566
602
  * Can be called directly from code or MCP server.
567
603
  */
568
- declare function validate(type: ValidationType | string, input: unknown, options?: {
604
+ declare function validate(type: ValidationType, input: unknown, options?: {
569
605
  flow?: string;
606
+ path?: string;
570
607
  }): Promise<ValidateResult>;
571
608
  /**
572
609
  * CLI command handler for validate command.
573
610
  */
574
611
  declare function validateCommand(options: ValidateCommandOptions): Promise<void>;
575
612
 
613
+ /**
614
+ * Global CLI Options
615
+ *
616
+ * Options that apply to all commands.
617
+ */
618
+ /**
619
+ * Global options available across all CLI commands
620
+ */
621
+ interface GlobalOptions {
622
+ /**
623
+ * Show detailed execution logs
624
+ * @default false
625
+ */
626
+ verbose?: boolean;
627
+ /**
628
+ * Suppress all output except errors
629
+ * @default false
630
+ */
631
+ silent?: boolean;
632
+ }
633
+
576
634
  interface LoginCommandOptions extends GlobalOptions {
577
635
  url?: string;
578
636
  json?: boolean;
@@ -800,6 +858,9 @@ interface DeployOptions {
800
858
  projectId?: string;
801
859
  wait?: boolean;
802
860
  flowName?: string;
861
+ timeout?: number;
862
+ signal?: AbortSignal;
863
+ onStatus?: (status: string, substatus: string | null) => void;
803
864
  }
804
865
  declare function deploy(options: DeployOptions): Promise<any>;
805
866
  declare function getDeployment(options: {
@@ -811,12 +872,48 @@ interface DeployCommandOptions extends GlobalOptions {
811
872
  project?: string;
812
873
  flow?: string;
813
874
  wait?: boolean;
875
+ timeout?: string;
814
876
  output?: string;
815
877
  json?: boolean;
816
878
  }
817
879
  declare function deployCommand(flowId: string, options: DeployCommandOptions): Promise<void>;
818
880
  declare function getDeploymentCommand(flowId: string, options: DeployCommandOptions): Promise<void>;
819
881
 
882
+ interface ListDeploymentsOptions {
883
+ projectId?: string;
884
+ type?: 'web' | 'server';
885
+ status?: string;
886
+ }
887
+ declare function listDeployments(options?: ListDeploymentsOptions): Promise<any>;
888
+ declare function getDeploymentBySlug(options: {
889
+ slug: string;
890
+ projectId?: string;
891
+ }): Promise<any>;
892
+ declare function createDeployment(options: {
893
+ type: 'web' | 'server';
894
+ label?: string;
895
+ projectId?: string;
896
+ }): Promise<any>;
897
+ declare function deleteDeployment(options: {
898
+ slug: string;
899
+ projectId?: string;
900
+ }): Promise<any>;
901
+ interface DeploymentsCommandOptions extends GlobalOptions {
902
+ json?: boolean;
903
+ output?: string;
904
+ project?: string;
905
+ type?: string;
906
+ status?: string;
907
+ label?: string;
908
+ }
909
+ declare function listDeploymentsCommand(options: DeploymentsCommandOptions): Promise<void>;
910
+ declare function getDeploymentBySlugCommand(slug: string, options: DeploymentsCommandOptions): Promise<void>;
911
+ declare function createDeploymentCommand(options: DeploymentsCommandOptions): Promise<void>;
912
+ declare function deleteDeploymentCommand(slug: string, options: DeploymentsCommandOptions): Promise<void>;
913
+ declare function createDeployCommand(config: string | undefined, options: DeploymentsCommandOptions & {
914
+ flow?: string;
915
+ }): Promise<void>;
916
+
820
917
  /**
821
918
  * This file was auto-generated by openapi-typescript.
822
919
  * Do not make direct changes to the file.
@@ -3198,4 +3295,22 @@ interface components {
3198
3295
 
3199
3296
  declare function createApiClient(): openapi_fetch.Client<paths, `${string}/${string}`>;
3200
3297
 
3201
- 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 };
3298
+ /**
3299
+ * Load and parse JSON configuration file from local path or URL.
3300
+ *
3301
+ * @param configPath - Path to JSON file or HTTP/HTTPS URL
3302
+ * @returns Parsed configuration object and cleanup function
3303
+ * @throws Error if file not found, download fails, or invalid JSON
3304
+ *
3305
+ * @example
3306
+ * ```typescript
3307
+ * // Local file
3308
+ * const config = await loadJsonConfig('./config.json')
3309
+ *
3310
+ * // Remote URL
3311
+ * const config = await loadJsonConfig('https://example.com/config.json')
3312
+ * ```
3313
+ */
3314
+ declare function loadJsonConfig<T>(configPath: string): Promise<T>;
3315
+
3316
+ export { type BuildOptions, type BundleStats, type CLIBuildOptions, type DeployOptions, type ExampleLookupResult, type ExampleMatch, type GlobalOptions, type ListDeploymentsOptions, type ListFlowsOptions, type MinifyOptions, type PushResult, type RunCommandOptions, type RunOptions, type RunResult, type SSEEvent, type SSEParseResult, type SimulationResult, type ValidateResult, type ValidationError, type ValidationType, type ValidationWarning, bundle, bundleCommand, bundleRemote, compareOutput, createApiClient, createDeployCommand, createDeployment, createDeploymentCommand, createFlow, createFlowCommand, createProject, createProjectCommand, deleteDeployment, deleteDeploymentCommand, deleteFlow, deleteFlowCommand, deleteProject, deleteProjectCommand, deploy, deployAuthenticatedFetch, deployCommand, duplicateFlow, duplicateFlowCommand, findExample, getAuthHeaders, getDeployment, getDeploymentBySlug, getDeploymentBySlugCommand, getDeploymentCommand, getFlow, getFlowCommand, getProject, getProjectCommand, getToken, listDeployments, listDeploymentsCommand, listFlows, listFlowsCommand, listProjects, listProjectsCommand, loadJsonConfig, loginCommand, logoutCommand, parseSSEEvents, push, pushCommand, requireProjectId, resolveBaseUrl, run, runCommand, simulate, simulateCommand, updateFlow, updateFlowCommand, updateProject, updateProjectCommand, validate, validateCommand, whoami, whoamiCommand };