@@ -20,38 +20,71 @@ if isdarwin; then
20
20
awk () { gawk " $@ " ; }
21
21
fi
22
22
23
- # Generate the experimental features table
24
- generate_experiments_table () {
25
- # Get ExperimentsSafe entries from deployment.go
26
- echo " | Feature | Description | Available in |"
27
- echo " |---------|-------------|--------------|"
28
-
29
- # For now, hardcode the features we know are in ExperimentsSafe
30
- # This is simpler and more reliable than trying to parse the Go code
31
- echo " | \` dev-containers\` | Enables dev containers support. | mainline, stable |"
32
- echo " | \` agentic-chat\` | Enables the new agentic AI chat feature. | mainline, stable |"
33
- echo " | \` workspace-prebuilds\` | Enables the new workspace prebuilds feature. | mainline, stable |"
23
+ DEPLOYMENT_GO_FILE=" codersdk/deployment.go"
24
+
25
+ # Extract and parse experiment information from deployment.go
26
+ extract_experiment_info () {
27
+ # Extract the experiment descriptions, stages, and doc paths
28
+ # We'll use Go code to capture this information and print it in a structured format
29
+ cat > /tmp/extract_experiment_info.go << 'EOT '
30
+ package main
31
+
32
+ import (
33
+ "encoding/json"
34
+ "os"
35
+
36
+ "github.com/coder/coder/v2/codersdk"
37
+ )
38
+
39
+ func main() {
40
+ experiments := []struct {
41
+ Name string `json:"name"`
42
+ Value string `json:"value"`
43
+ Description string `json:"description"`
44
+ Stage string `json:"stage"`
45
+ }{}
46
+
47
+ // Get experiments from ExperimentsSafe
48
+ for _, exp := range codersdk.ExperimentsSafe {
49
+ experiments = append(experiments, struct {
50
+ Name string `json:"name"`
51
+ Value string `json:"value"`
52
+ Description string `json:"description"`
53
+ Stage string `json:"stage"`
54
+ }{
55
+ Name: string(exp),
56
+ Value: string(exp),
57
+ Description: exp.GetDescription(),
58
+ Stage: string(exp.GetStage()),
59
+ })
60
+ }
61
+
62
+ json.NewEncoder(os.Stdout).Encode(experiments)
34
63
}
64
+ EOT
35
65
36
- # Extract early access features from deployment.go
37
- generate_early_access_table () {
38
- echo " | Feature | Description | Documentation Path |"
39
- echo " |---------|-------------|------------------|"
66
+ # Run the Go code to extract the information
67
+ cd /home/coder/coder
68
+ go run /tmp/extract_experiment_info.go
69
+ rm /tmp/extract_experiment_info.go
70
+ }
40
71
41
- # For now, hardcode the Dev Containers as early access feature
42
- # This is simpler and more reliable than complex grep/awk parsing
43
- echo " | Dev Containers Integration | Dev Containers Integration | ai-coder/dev-containers.md |"
72
+ # Generate the experimental features table with flag name
73
+ generate_experiments_table () {
74
+ echo " | Feature Flag | Name | Available in |"
75
+ echo " |-------------|------|--------------|"
76
+
77
+ # Extract the experiment information
78
+ extract_experiment_info | jq -r ' .[] | select(.stage=="early access") | "| `\(.value)` | \(.description) | mainline, stable |"'
44
79
}
45
80
46
81
# Extract beta features from deployment.go
47
82
generate_beta_table () {
48
- echo " | Feature | Description | Documentation Path |"
49
- echo " |---------| -------------|------------ ------|"
83
+ echo " | Feature Flag | Name |"
84
+ echo " |-------------| ------|"
50
85
51
- # For now, hardcode the beta features
52
- # This is simpler and more reliable than complex grep/awk parsing
53
- echo " | AI Coding Agents | AI Coding Agents | ai-coder/agents.md |"
54
- echo " | Prebuilt workspaces | Prebuilt workspaces | workspaces/prebuilds.md |"
86
+ # Extract beta features with flag name only
87
+ extract_experiment_info | jq -r ' .[] | select(.stage=="beta") | "| `\(.value)` | \(.description) |"'
55
88
}
56
89
57
90
dest=docs/install/releases/feature-stages.md
@@ -60,49 +93,74 @@ log "Updating feature stages documentation in ${dest}"
60
93
61
94
# Generate the tables
62
95
experiments_table=$( generate_experiments_table)
63
- early_access_table=$( generate_early_access_table)
64
96
beta_table=$( generate_beta_table)
65
97
66
98
# We're using a single-pass awk script that replaces content between markers
67
99
# No need for cleanup operations
68
100
69
- # Create a single awk script to update all sections without requiring multiple temp files
70
- awk -v exp_table=" ${experiments_table} " -v ea_table=" ${early_access_table} " -v beta_table=" ${beta_table} " '
71
- # State variables to track which section we are in
72
- BEGIN { in_exp = 0; in_ea = 0; in_beta = 0; }
101
+ # Create temporary files with the new content
102
+ cat > /tmp/ea_content.md << EOT
103
+ <!-- BEGIN: available-experimental-features -->
73
104
74
- # For experimental features section
75
- /<!-- BEGIN: available-experimental-features -->/ {
76
- print; print exp_table; in_exp = 1; next;
77
- }
78
- /<!-- END: available-experimental-features -->/ {
79
- in_exp = 0; print; next;
80
- }
105
+ $( echo " $experiments_table " )
106
+
107
+ <!-- END: available-experimental-features -->
108
+ EOT
109
+
110
+ cat > /tmp/beta_content.md << EOT
111
+ <!-- BEGIN: beta-features -->
81
112
82
- # For early access features section
83
- /<!-- BEGIN: early-access-features -->/ {
84
- print; print ea_table; in_ea = 1; next;
113
+ $( echo " $beta_table " )
114
+
115
+ <!-- END: beta-features -->
116
+ EOT
117
+
118
+ # Use awk to replace the sections
119
+ awk '
120
+ BEGIN {
121
+ ea = 0; beta = 0;
122
+ while (getline < "/tmp/ea_content.md") ea_lines[++ea] = $0;
123
+ while (getline < "/tmp/beta_content.md") beta_lines[++beta] = $0;
124
+ ea = beta = 0;
85
125
}
86
- /<!-- END: early-access-features -->/ {
87
- in_ea = 0; print; next;
126
+
127
+ /<!-- BEGIN: available-experimental-features -->/ {
128
+ for (i = 1; i <= length(ea_lines); i++) print ea_lines[i];
129
+ ea = 1;
130
+ next;
88
131
}
89
-
90
- # For beta features section
132
+
133
+ /<!-- END: available-experimental-features -->/ {
134
+ ea = 0;
135
+ next;
136
+ }
137
+
91
138
/<!-- BEGIN: beta-features -->/ {
92
- print; print beta_table; in_beta = 1; next;
139
+ for (i = 1; i <= length(beta_lines); i++) print beta_lines[i];
140
+ beta = 1;
141
+ next;
93
142
}
143
+
94
144
/<!-- END: beta-features -->/ {
95
- in_beta = 0; print; next;
145
+ beta = 0;
146
+ next;
96
147
}
97
-
148
+
98
149
# Skip lines between markers
99
- (in_exp || in_ea || in_beta ) { next; }
100
-
150
+ (ea || beta ) { next; }
151
+
101
152
# Print all other lines
102
153
{ print; }
103
- ' " ${dest} " > " ${dest} .new"
154
+ ' " ${dest} " > " ${dest} .new"
104
155
105
156
# Move the new file into place
106
157
mv " ${dest} .new" " ${dest} "
107
158
159
+ # Clean up temporary files
160
+ rm -f /tmp/ea_content.md /tmp/beta_content.md
161
+
162
+ # Clean up backup files
163
+ rm -f " ${dest} .bak"
164
+
165
+ # Format the file with prettier
108
166
(cd site && pnpm exec prettier --cache --write ../" ${dest} " )
0 commit comments