@marktoflow/cli 2.0.0-alpha.10

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 ADDED
@@ -0,0 +1,567 @@
1
+ # @marktoflow/cli
2
+
3
+ > **Author:** Scott Glover <scottgl@gmail.com>
4
+
5
+ Agent automation framework with native MCP support - Command Line Interface.
6
+
7
+ ## Overview
8
+
9
+ `@marktoflow/cli` is the main package for marktoflow, providing the command-line interface for creating, running, and managing automation workflows.
10
+
11
+ ## Features
12
+
13
+ - **Workflow Execution** - Run workflows from markdown files
14
+ - **Interactive Setup** - Initialize projects with guided prompts
15
+ - **OAuth Integration** - Easy OAuth setup for Gmail, Outlook
16
+ - **Scheduling** - Background workflow scheduling with cron
17
+ - **Webhooks** - HTTP webhook server for event-driven workflows
18
+ - **Queue Workers** - Process workflows from queues (Redis/RabbitMQ)
19
+ - **Dry Run Mode** - Test workflows without executing actions
20
+ - **Debug Mode** - Detailed execution logging
21
+ - **Doctor** - System health checks and diagnostics
22
+ - **Template Management** - Create workflows from templates
23
+
24
+ ## Installation
25
+
26
+ ### Install globally from npm
27
+
28
+ ```bash
29
+ npm install -g @marktoflow/cli@alpha
30
+ ```
31
+
32
+ ### Use with npx (no installation)
33
+
34
+ ```bash
35
+ npx @marktoflow/cli@alpha <command>
36
+ ```
37
+
38
+ ### Install from GitHub
39
+
40
+ ```bash
41
+ npm install -g github:scottgl9/marktoflow#main
42
+ ```
43
+
44
+ ## Quick Start
45
+
46
+ ### 1. Initialize a project
47
+
48
+ ```bash
49
+ marktoflow init
50
+ ```
51
+
52
+ This creates:
53
+
54
+ - `.marktoflow/` directory
55
+ - `workflows/` directory with example workflow
56
+ - `.marktoflow/config.yaml` configuration file
57
+
58
+ ### 2. Create a workflow
59
+
60
+ Create `workflow.md`:
61
+
62
+ ```markdown
63
+ ---
64
+ workflow:
65
+ id: hello-world
66
+ name: Hello World
67
+
68
+ tools:
69
+ slack:
70
+ sdk: '@slack/web-api'
71
+ auth:
72
+ token: '${SLACK_BOT_TOKEN}'
73
+
74
+ inputs:
75
+ message:
76
+ type: string
77
+ default: 'Hello World!'
78
+ ---
79
+
80
+ # Hello World Workflow
81
+
82
+ ## Step 1: Send Message
83
+
84
+ \`\`\`yaml
85
+ action: slack.chat.postMessage
86
+ inputs:
87
+ channel: '#general'
88
+ text: '{{ inputs.message }}'
89
+ \`\`\`
90
+ ```
91
+
92
+ ### 3. Run the workflow
93
+
94
+ ```bash
95
+ # Set environment variable
96
+ export SLACK_BOT_TOKEN=xoxb-your-token
97
+
98
+ # Run workflow
99
+ marktoflow run workflow.md
100
+
101
+ # With inputs
102
+ marktoflow run workflow.md --input message="Hello marktoflow!"
103
+ ```
104
+
105
+ ## CLI Commands
106
+
107
+ ### Core Commands
108
+
109
+ #### `marktoflow run <workflow>`
110
+
111
+ Execute a workflow.
112
+
113
+ ```bash
114
+ # Basic usage
115
+ marktoflow run workflow.md
116
+
117
+ # With inputs
118
+ marktoflow run workflow.md --input key=value --input another=value
119
+
120
+ # With config file
121
+ marktoflow run workflow.md --config .marktoflow/config.yaml
122
+
123
+ # Verbose output
124
+ marktoflow run workflow.md --verbose
125
+ ```
126
+
127
+ #### `marktoflow init`
128
+
129
+ Initialize a new marktoflow project.
130
+
131
+ ```bash
132
+ marktoflow init
133
+
134
+ # Skip prompts
135
+ marktoflow init --yes
136
+ ```
137
+
138
+ #### `marktoflow version`
139
+
140
+ Show version information.
141
+
142
+ ```bash
143
+ marktoflow version
144
+ ```
145
+
146
+ #### `marktoflow doctor`
147
+
148
+ Run system diagnostics.
149
+
150
+ ```bash
151
+ marktoflow doctor
152
+ ```
153
+
154
+ ### Scheduling
155
+
156
+ #### `marktoflow schedule <workflow>`
157
+
158
+ Schedule a workflow to run on a cron schedule.
159
+
160
+ ```bash
161
+ # Schedule workflow
162
+ marktoflow schedule workflow.md --cron "0 9 * * 1-5"
163
+
164
+ # List scheduled workflows
165
+ marktoflow schedule list
166
+
167
+ # Remove schedule
168
+ marktoflow schedule remove <workflow-id>
169
+
170
+ # Start scheduler daemon
171
+ marktoflow schedule start
172
+
173
+ # Stop scheduler daemon
174
+ marktoflow schedule stop
175
+ ```
176
+
177
+ ### Webhooks
178
+
179
+ #### `marktoflow webhook <workflow>`
180
+
181
+ Create webhook endpoint for workflow.
182
+
183
+ ```bash
184
+ # Start webhook server
185
+ marktoflow webhook workflow.md --path /github --port 3000
186
+
187
+ # With secret for signature verification
188
+ marktoflow webhook workflow.md --path /github --secret ${WEBHOOK_SECRET}
189
+
190
+ # List webhooks
191
+ marktoflow webhook list
192
+
193
+ # Stop webhook server
194
+ marktoflow webhook stop
195
+ ```
196
+
197
+ ### Queue Workers
198
+
199
+ #### `marktoflow worker`
200
+
201
+ Start a queue worker to process workflows.
202
+
203
+ ```bash
204
+ # Start worker (Redis)
205
+ marktoflow worker --queue redis --redis-url redis://localhost:6379
206
+
207
+ # Start worker (RabbitMQ)
208
+ marktoflow worker --queue rabbitmq --rabbitmq-url amqp://localhost
209
+
210
+ # Multiple workers
211
+ marktoflow worker --concurrency 5
212
+ ```
213
+
214
+ ### Development
215
+
216
+ #### `marktoflow dry-run <workflow>`
217
+
218
+ Test workflow without executing actions.
219
+
220
+ ```bash
221
+ marktoflow dry-run workflow.md
222
+
223
+ # With mocked responses
224
+ marktoflow dry-run workflow.md --mock slack.chat.postMessage=success
225
+ ```
226
+
227
+ #### `marktoflow debug <workflow>`
228
+
229
+ Run workflow with detailed debug logging.
230
+
231
+ ```bash
232
+ marktoflow debug workflow.md
233
+ ```
234
+
235
+ ### OAuth Setup
236
+
237
+ #### `marktoflow connect <service>`
238
+
239
+ Set up OAuth for email services.
240
+
241
+ ```bash
242
+ # Gmail OAuth
243
+ marktoflow connect gmail
244
+
245
+ # Outlook OAuth
246
+ marktoflow connect outlook
247
+ ```
248
+
249
+ This launches a browser for OAuth authentication and stores credentials securely.
250
+
251
+ ### Visual Designer
252
+
253
+ #### `marktoflow gui`
254
+
255
+ Start the visual workflow designer.
256
+
257
+ ```bash
258
+ # Start GUI server
259
+ marktoflow gui
260
+
261
+ # With options
262
+ marktoflow gui --port 3000 # Custom port
263
+ marktoflow gui --open # Open browser automatically
264
+ ```
265
+
266
+ ### Templates
267
+
268
+ #### `marktoflow new <template>`
269
+
270
+ Create workflow from template.
271
+
272
+ ```bash
273
+ # List available templates
274
+ marktoflow new --list
275
+
276
+ # Create from template
277
+ marktoflow new code-review --output workflows/code-review.md
278
+
279
+ # Interactive wizard
280
+ marktoflow new
281
+ ```
282
+
283
+ ### Agent & Tool Management
284
+
285
+ #### `marktoflow agents list`
286
+
287
+ List available AI agents.
288
+
289
+ ```bash
290
+ marktoflow agents list
291
+ ```
292
+
293
+ #### `marktoflow tools list`
294
+
295
+ List available tools and integrations.
296
+
297
+ ```bash
298
+ marktoflow tools list
299
+
300
+ # Show tool details
301
+ marktoflow tools show slack
302
+ ```
303
+
304
+ #### `marktoflow bundles list`
305
+
306
+ List available tool bundles.
307
+
308
+ ```bash
309
+ marktoflow bundles list
310
+
311
+ # Install bundle
312
+ marktoflow bundles install my-bundle.json
313
+ ```
314
+
315
+ ## Configuration
316
+
317
+ ### Environment Variables
318
+
319
+ ```bash
320
+ # Core
321
+ MARKTOFLOW_DB_PATH=.marktoflow/state.db
322
+
323
+ # Slack
324
+ SLACK_BOT_TOKEN=xoxb-your-token
325
+
326
+ # GitHub
327
+ GITHUB_TOKEN=ghp_your-token
328
+
329
+ # Jira
330
+ JIRA_HOST=your-domain.atlassian.net
331
+ JIRA_EMAIL=your@email.com
332
+ JIRA_API_TOKEN=your-token
333
+
334
+ # Gmail
335
+ GMAIL_CLIENT_ID=your-client-id
336
+ GMAIL_CLIENT_SECRET=your-secret
337
+ GMAIL_REFRESH_TOKEN=your-refresh-token
338
+
339
+ # Outlook
340
+ OUTLOOK_CLIENT_ID=your-client-id
341
+ OUTLOOK_CLIENT_SECRET=your-secret
342
+ OUTLOOK_TENANT_ID=your-tenant-id
343
+ ```
344
+
345
+ ### Configuration File
346
+
347
+ `.marktoflow/config.yaml`:
348
+
349
+ ```yaml
350
+ state:
351
+ dbPath: .marktoflow/state.db
352
+
353
+ queue:
354
+ type: redis
355
+ redis:
356
+ host: localhost
357
+ port: 6379
358
+
359
+ security:
360
+ rbac:
361
+ enabled: true
362
+ auditLog:
363
+ enabled: true
364
+
365
+ costs:
366
+ budget:
367
+ daily: 100
368
+ monthly: 3000
369
+
370
+ logging:
371
+ level: info
372
+ file: .marktoflow/logs/marktoflow.log
373
+ ```
374
+
375
+ ## Examples
376
+
377
+ ### Daily Standup Report
378
+
379
+ ```bash
380
+ # Create workflow
381
+ cat > workflows/daily-standup.md << 'EOF'
382
+ ---
383
+ workflow:
384
+ id: daily-standup
385
+ name: Daily Standup Report
386
+
387
+ tools:
388
+ jira:
389
+ sdk: 'jira.js'
390
+ auth:
391
+ host: '${JIRA_HOST}'
392
+ email: '${JIRA_EMAIL}'
393
+ apiToken: '${JIRA_API_TOKEN}'
394
+ slack:
395
+ sdk: '@slack/web-api'
396
+ auth:
397
+ token: '${SLACK_BOT_TOKEN}'
398
+
399
+ steps:
400
+ - action: jira.issues.searchIssues
401
+ inputs:
402
+ jql: 'assignee = currentUser() AND status = "In Progress"'
403
+ output_variable: issues
404
+
405
+ - action: slack.chat.postMessage
406
+ inputs:
407
+ channel: '#standup'
408
+ text: 'Working on: {{ issues.issues[0].fields.summary }}'
409
+ EOF
410
+
411
+ # Schedule for weekdays at 9 AM
412
+ marktoflow schedule workflows/daily-standup.md --cron "0 9 * * 1-5"
413
+
414
+ # Start scheduler
415
+ marktoflow schedule start
416
+ ```
417
+
418
+ ### GitHub PR Webhook
419
+
420
+ ```bash
421
+ # Create webhook workflow
422
+ cat > workflows/github-pr.md << 'EOF'
423
+ ---
424
+ workflow:
425
+ id: github-pr-review
426
+ name: GitHub PR Review Notification
427
+
428
+ tools:
429
+ slack:
430
+ sdk: '@slack/web-api'
431
+ auth:
432
+ token: '${SLACK_BOT_TOKEN}'
433
+
434
+ inputs:
435
+ pr_url:
436
+ type: string
437
+ pr_title:
438
+ type: string
439
+ author:
440
+ type: string
441
+
442
+ steps:
443
+ - action: slack.chat.postMessage
444
+ inputs:
445
+ channel: '#code-review'
446
+ text: |
447
+ 🔍 New PR ready for review
448
+ *{{ inputs.pr_title }}* by {{ inputs.author }}
449
+ {{ inputs.pr_url }}
450
+ EOF
451
+
452
+ # Start webhook server
453
+ marktoflow webhook workflows/github-pr.md --path /github --port 3000
454
+ ```
455
+
456
+ ### Multi-Agent Workflow
457
+
458
+ ```bash
459
+ cat > workflows/research-and-summarize.md << 'EOF'
460
+ ---
461
+ workflow:
462
+ id: research-summarize
463
+ name: Research and Summarize
464
+
465
+ tools:
466
+ ollama:
467
+ adapter: ollama
468
+
469
+ agents:
470
+ researcher:
471
+ model: llama2
472
+ role: research
473
+ writer:
474
+ model: llama2
475
+ role: summarize
476
+
477
+ steps:
478
+ - action: ollama.generate
479
+ agent: researcher
480
+ inputs:
481
+ prompt: 'Research recent developments in {{ inputs.topic }}'
482
+ output_variable: research
483
+
484
+ - action: ollama.generate
485
+ agent: writer
486
+ inputs:
487
+ prompt: 'Summarize this research: {{ research.response }}'
488
+ output_variable: summary
489
+ EOF
490
+
491
+ marktoflow run workflows/research-and-summarize.md --input topic="quantum computing"
492
+ ```
493
+
494
+ ## Troubleshooting
495
+
496
+ ### Command not found
497
+
498
+ If `marktoflow` command is not found after global installation:
499
+
500
+ ```bash
501
+ # Check npm global bin directory
502
+ npm config get prefix
503
+
504
+ # Add to PATH (macOS/Linux)
505
+ export PATH="$PATH:$(npm config get prefix)/bin"
506
+
507
+ # Or use npx
508
+ npx @marktoflow/cli@alpha version
509
+ ```
510
+
511
+ ### Permission errors
512
+
513
+ ```bash
514
+ # Use npx instead of global install
515
+ npx @marktoflow/cli@alpha run workflow.md
516
+
517
+ # Or configure npm to use local directory
518
+ npm config set prefix ~/.npm-global
519
+ export PATH=~/.npm-global/bin:$PATH
520
+ npm install -g @marktoflow/cli@alpha
521
+ ```
522
+
523
+ ### OAuth issues
524
+
525
+ ```bash
526
+ # Re-run OAuth setup
527
+ marktoflow connect gmail --force
528
+
529
+ # Check stored credentials
530
+ ls -la .marktoflow/credentials/
531
+ ```
532
+
533
+ ## Development
534
+
535
+ ### Install from source
536
+
537
+ ```bash
538
+ git clone https://github.com/scottgl9/marktoflow.git
539
+ cd marktoflow
540
+ pnpm install
541
+ pnpm build
542
+ npm link packages/cli
543
+ ```
544
+
545
+ ### Run tests
546
+
547
+ ```bash
548
+ pnpm test
549
+ ```
550
+
551
+ ## Links
552
+
553
+ - [Main Repository](https://github.com/scottgl9/marktoflow)
554
+ - [Documentation](https://github.com/scottgl9/marktoflow#readme)
555
+ - [Installation Guide](https://github.com/scottgl9/marktoflow/blob/main/docs/INSTALLATION.md)
556
+ - [Publishing Guide](https://github.com/scottgl9/marktoflow/blob/main/docs/PUBLISHING.md)
557
+ - [Core Package](@marktoflow/core)
558
+ - [Integrations Package](@marktoflow/integrations)
559
+
560
+ ## Support
561
+
562
+ - [GitHub Issues](https://github.com/scottgl9/marktoflow/issues)
563
+ - [Discussions](https://github.com/scottgl9/marktoflow/discussions)
564
+
565
+ ## License
566
+
567
+ Apache-2.0
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Interactive debugging command for marktoflow workflows
3
+ *
4
+ * Features:
5
+ * - Breakpoints on specific steps
6
+ * - Step-through execution (next, continue, skip)
7
+ * - Variable inspection and modification
8
+ * - Replay failed steps
9
+ */
10
+ import { Workflow, WorkflowStep, ExecutionContext, StepResult } from '@marktoflow/core';
11
+ export interface SDKRegistryLike {
12
+ load(sdkName: string): Promise<unknown>;
13
+ has(sdkName: string): boolean;
14
+ }
15
+ export type DebugAction = 'next' | 'continue' | 'skip' | 'inspect' | 'modify' | 'breakpoint' | 'quit';
16
+ export interface DebuggerState {
17
+ currentStepIndex: number;
18
+ breakpoints: Set<string>;
19
+ isPaused: boolean;
20
+ stepResults: StepResult[];
21
+ context: ExecutionContext;
22
+ }
23
+ export interface DebugOptions {
24
+ breakpoints?: string[];
25
+ verbose?: boolean;
26
+ autoStart?: boolean;
27
+ }
28
+ export declare class WorkflowDebugger {
29
+ private state;
30
+ private workflow;
31
+ private sdkRegistry;
32
+ private stepExecutor;
33
+ constructor(workflow: Workflow, inputs: Record<string, unknown>, sdkRegistry: SDKRegistryLike, stepExecutor: (step: WorkflowStep, context: ExecutionContext, registry: SDKRegistryLike) => Promise<unknown>, options?: DebugOptions);
34
+ /**
35
+ * Start interactive debugging session
36
+ */
37
+ debug(): Promise<void>;
38
+ /**
39
+ * Execute a single step
40
+ */
41
+ private executeStep;
42
+ /**
43
+ * Prompt user for next action
44
+ */
45
+ private promptAction;
46
+ /**
47
+ * Display current debugger state
48
+ */
49
+ private displayState;
50
+ /**
51
+ * Display current step details
52
+ */
53
+ private displayStep;
54
+ /**
55
+ * Inspect current variables
56
+ */
57
+ private inspectVariables;
58
+ /**
59
+ * Modify input variables
60
+ */
61
+ private modifyVariables;
62
+ /**
63
+ * Manage breakpoints
64
+ */
65
+ private manageBreakpoints;
66
+ /**
67
+ * Display final summary
68
+ */
69
+ private displaySummary;
70
+ }
71
+ /**
72
+ * Parse breakpoint specification
73
+ */
74
+ export declare function parseBreakpoints(breakpointSpec: string[]): string[];
75
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/commands/debug.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,EAKX,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxC,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B;AAMD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,UAAU,GACV,MAAM,GAC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