@cascade-flow/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 ADDED
@@ -0,0 +1,63 @@
1
+ # CLI
2
+
3
+ Command-line interface for workflow execution.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun install
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ### Direct Execution
14
+
15
+ ```bash
16
+ cf run <workflow> [--input '{}' | --input-file path] [--output-file path] [--run-id id]
17
+ cf list # List workflows
18
+ ```
19
+
20
+ ### Queue-Based Execution
21
+
22
+ ```bash
23
+ # Worker
24
+ cf worker start [--mode unified|executor|scheduler] [--concurrency n] [--workflows-dir path]
25
+
26
+ # Submit
27
+ cf submit <workflow> [--input '{}' | --input-file path] [--priority n] [--timeout ms]
28
+
29
+ # Manage
30
+ cf status <runId>
31
+ cf cancel <runId> [--reason text]
32
+ ```
33
+
34
+ ## Worker Modes
35
+
36
+ - **Unified** (default) - All loops in one process
37
+ - **Executor** - Execute steps only (requires separate scheduler)
38
+ - **Scheduler** - Schedule steps only (requires separate executors)
39
+
40
+ ## Timeouts
41
+
42
+ **3-tier fallback:**
43
+ 1. Step-level: `defineStep({ timeoutMs })`
44
+ 2. Submission-level: `--timeout` flag
45
+ 3. System default: 300000ms (5 min)
46
+
47
+ **Stale threshold:** `--stale-threshold` (default 30s) - Detects crashed workers via missing heartbeats
48
+
49
+ ## Examples
50
+
51
+ ```bash
52
+ # Direct execution
53
+ cf run my-workflow --input '{"key": "value"}'
54
+
55
+ # Queue-based execution
56
+ cf worker start --concurrency 5 # Terminal 1
57
+ cf submit my-workflow --input '{}' --timeout 60000 # Terminal 2
58
+ cf status <runId> # Terminal 2
59
+
60
+ # Scaled deployment
61
+ cf worker start --mode scheduler # Terminal 1
62
+ cf worker start --mode executor --concurrency 10 # Terminal 2-4 (multiple)
63
+ ```
package/bin/cf.js ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Platform detection wrapper for @cascade-flow/cli
5
+ * Detects the current platform and executes the appropriate compiled binary
6
+ */
7
+
8
+ import { execFileSync } from 'child_process';
9
+ import { platform, arch } from 'process';
10
+ import { fileURLToPath } from 'url';
11
+ import { dirname, join } from 'path';
12
+
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+
16
+ // Map platform and architecture to binary name
17
+ const getBinaryName = () => {
18
+ const platformArch = `${platform}-${arch}`;
19
+
20
+ switch (platformArch) {
21
+ case 'darwin-arm64':
22
+ return 'cf-darwin-arm64';
23
+ case 'darwin-x64':
24
+ return 'cf-darwin-x64';
25
+ case 'linux-x64':
26
+ return 'cf-linux-x64';
27
+ case 'linux-arm64':
28
+ return 'cf-linux-arm64';
29
+ case 'win32-x64':
30
+ return 'cf-windows-x64.exe';
31
+ default:
32
+ console.error(`Unsupported platform: ${platform}-${arch}`);
33
+ console.error('Supported platforms:');
34
+ console.error(' - macOS ARM64 (Apple Silicon)');
35
+ console.error(' - macOS x64 (Intel)');
36
+ console.error(' - Linux x64');
37
+ console.error(' - Linux ARM64');
38
+ console.error(' - Windows x64');
39
+ process.exit(1);
40
+ }
41
+ };
42
+
43
+ // Get the binary path
44
+ const binaryName = getBinaryName();
45
+ const binaryPath = join(__dirname, '..', 'dist', binaryName);
46
+
47
+ // Execute the binary with all passed arguments
48
+ try {
49
+ execFileSync(binaryPath, process.argv.slice(2), {
50
+ stdio: 'inherit',
51
+ // Pass through environment variables
52
+ env: process.env
53
+ });
54
+ } catch (error) {
55
+ // If the binary doesn't exist, provide a helpful error message
56
+ if (error.code === 'ENOENT') {
57
+ console.error(`Binary not found: ${binaryPath}`);
58
+ console.error('This may indicate an incomplete installation.');
59
+ console.error('Try reinstalling the package: npm install -g @cascade-flow/cli');
60
+ process.exit(1);
61
+ }
62
+
63
+ // For other errors, let the error propagate naturally
64
+ // The execFileSync will already handle exit codes from the binary
65
+ process.exit(error.status || 1);
66
+ }
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@cascade-flow/cli",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "cf": "./bin/cf.js"
7
+ },
8
+ "scripts": {
9
+ "build": "./scripts/build-all-platforms.sh",
10
+ "build:current": "rm -rf dist && bun build src/cli.ts --compile --outfile dist/cf",
11
+ "prepublishOnly": "bun run build",
12
+ "test": "bun test"
13
+ },
14
+ "dependencies": {
15
+ "@cliffy/command": "npm:@jsr/cliffy__command@1.0.0-rc.8",
16
+ "@cascade-flow/runner": "0.1.0",
17
+ "@cascade-flow/backend-factory": "0.1.0",
18
+ "@cascade-flow/backend-filesystem": "0.1.0",
19
+ "@cascade-flow/worker": "0.1.0",
20
+ "@cascade-flow/client": "0.1.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/bun": "latest",
24
+ "typescript": "^5"
25
+ },
26
+ "peerDependencies": {
27
+ "typescript": "^5"
28
+ },
29
+ "files": [
30
+ "bin",
31
+ "dist"
32
+ ],
33
+ "preferGlobal": true,
34
+ "engines": {
35
+ "node": ">=18"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/cascadeflow/cascadeflow.git",
43
+ "directory": "packages/cli"
44
+ },
45
+ "license": "MIT",
46
+ "description": "Command-line interface for CascadeFlow workflow orchestrator",
47
+ "keywords": [
48
+ "workflow",
49
+ "orchestrator",
50
+ "cli",
51
+ "command-line",
52
+ "cascade-flow"
53
+ ]
54
+ }