Skip to content

Commit 40c91c3

Browse files
authored
feat!: add more imported exec comment options (#275)
1 parent 66ee7a9 commit 40c91c3

File tree

15 files changed

+817
-351
lines changed

15 files changed

+817
-351
lines changed

docs/guide/executables.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -387,26 +387,15 @@ You can use special comments to override executable metadata:
387387
388388
# f:name=production f:verb=deploy
389389
# f:description="Deploy to production environment"
390-
# f:tags=production,critical
391-
# f:aliases=prod-deploy
390+
# f:tag=production f:tag=critical
392391
# f:visibility=internal
393392
# f:timeout=10m
394393
395394
echo "Deploying to production..."
396395
kubectl apply -f k8s/
397396
```
398397

399-
**Supported comment keys:**
400-
- `name`, `verb`, `description`, `tags`, `aliases`, `visibility`, `timeout`
401-
402-
**Multi-line descriptions:**
403-
```bash
404-
# f:name=backup f:verb=run
405-
# <f|description>
406-
# Creates a backup of the database
407-
# and uploads it to S3 storage
408-
# <f|description>
409-
```
398+
See the [generated configuration reference](generated-config.md) for more details.
410399

411400
#### **Makefiles**
412401

@@ -428,7 +417,7 @@ clean:
428417
rm -rf bin/
429418
```
430419

431-
The same comment parsing syntax works in Makefiles - use `# f:key=value` to override executable configuration.
420+
See the [generated configuration reference](generated-config.md) for more details on overriding executable configuration.
432421

433422
#### **Package.json Scripts**
434423

docs/guide/generated-config.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Imported Executables Config Reference
2+
3+
flow can automatically generate executables from shell scripts and Makefiles using special comments.
4+
flow parses these comments during workspace synchronization and creates executable definitions that can be run
5+
like any other flow executable. See [Importing Executables](../guide/executables.md#importing-executables) for more details.
6+
7+
> [!NOTE] The configuration comments must be at the top of the shell script or right above the Makefile target definition.
8+
9+
## Supported Fields
10+
11+
| Field | Description | Example |
12+
|--------------------|-------------|---------|
13+
| `name` | Executable name | `f:name=deploy-app` |
14+
| `verb` | Action verb | `f:verb=deploy` |
15+
| `description` | Executable description | `f:description=Deploy to production` |
16+
| `tag` or `tags` | Pipe-separated tags | `f:tags=deployment\|production` |
17+
| `alias`or `aliases` | Pipe-separated aliases | `f:aliases=prod-deploy\|deploy-prod` |
18+
| `timeout` | Execution timeout | `f:timeout=10m` |
19+
| `visibility` | Executable visibility | `f:visibility=private` |
20+
| `dir` | Working directory | `f:dir=//` |
21+
| `logMode` | Log output format | `f:logMode=json` |
22+
23+
### Environment Parameters
24+
25+
Define environment variables that will be available to your script with `f:params` or `f:param`:
26+
27+
```bash
28+
#!/bin/bash
29+
# f:name=deploy-with-secrets f:verb=deploy
30+
# f:params=secretRef:api-key:API_TOKEN|prompt:Environment?:ENV_NAME|text:production:DEFAULT_ENV
31+
32+
echo "Deploying to $ENV_NAME with token: ${API_TOKEN:0:8}..."
33+
```
34+
35+
**Parameter Types:**
36+
- `secretRef:secret-name:ENV_VAR` - Reference a vault secret
37+
- `prompt:Question text:ENV_VAR` - Prompt user for input
38+
- `text:static-value:ENV_VAR` - Set static value
39+
40+
### Command Line Arguments
41+
42+
Define command line arguments that users can pass when running the executable with `f:args` or `f:arg`:
43+
44+
```bash
45+
#!/bin/bash
46+
# f:name=build-app f:verb=build
47+
# f:args=flag:dry-run:DRY_RUN|pos:1:VERSION|flag:verbose:VERBOSE
48+
49+
if [ "$DRY_RUN" = "true" ]; then
50+
echo "DRY RUN: Would build version $VERSION"
51+
else
52+
echo "Building version $VERSION"
53+
fi
54+
```
55+
56+
**Argument Types:**
57+
- `flag:flag-name:ENV_VAR` - Named flag (`--flag-name`)
58+
- `pos:1:ENV_VAR` - Positional argument (position 1, 2, etc.)
59+
60+
## Configuration Syntax
61+
62+
**Single Line Format**
63+
64+
Multiple configurations can be defined on a single line:
65+
66+
```bash
67+
# f:name=my-task f:verb=run f:timeout=5m f:visibility=private
68+
```
69+
70+
**Multi-Line Format**
71+
72+
Configurations can be split across multiple lines for readability:
73+
74+
```bash
75+
# f:name=complex-task
76+
# f:verb=deploy
77+
# f:description="Complex deployment with multiple parameters"
78+
# f:params=secretRef:api-key:API_TOKEN
79+
# f:params=prompt:Target environment?:ENV_NAME
80+
# f:args=flag:dry-run:DRY_RUN
81+
# f:args=pos:1:VERSION
82+
```
83+
84+
**Multi-Line Descriptions**
85+
86+
For longer descriptions, use the multi-line description syntax:
87+
88+
```bash
89+
# f:name=complex-deploy f:verb=deploy
90+
# <f|description>
91+
# Deploy application to production environment
92+
#
93+
# This executable handles the complete deployment process including:
94+
# - Database migrations
95+
# - Service deployment
96+
# - Health checks
97+
# <f|description>
98+
```

0 commit comments

Comments
 (0)