33# Usage: ./docs_update_experiments.sh
44#
55# This script updates the following sections in the documentation:
6- # - Available experimental features from ExperimentsSafe in deployment.go
7- # - Early access features from FeatureRegistry in featurestages .go
8- # - Beta features from FeatureRegistry in featurestages .go
6+ # - Available experimental features from ExperimentsSafe in codersdk/ deployment.go
7+ # - Early access features from GetStage() in codersdk/deployment .go
8+ # - Beta features from GetStage() in codersdk/deployment .go
99#
1010# The script will update feature-stages.md with tables for each section.
1111
2222
2323# Generate the experimental features table
2424generate_experiments_table () {
25- # We know the experimental features we want to show are in ExperimentsSafe
26- # Hard-code the features with their descriptions to avoid the Go compilation issues
25+ # Get ExperimentsSafe entries from deployment.go
2726 echo " | Feature | Description | Available in |"
2827 echo " |---------|-------------|--------------|"
29- echo " | \` dev-containers\` | Enables dev containers support | mainline, stable |"
30- echo " | \` agentic-chat\` | Enables the new agentic AI chat feature | mainline, stable |"
31- echo " | \` workspace-prebuilds\` | Enables the new workspace prebuilds feature | mainline, stable |"
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 |"
3234}
3335
34- # Extract early access features from featurestages .go
36+ # Extract early access features from deployment .go
3537generate_early_access_table () {
36- # Use grep and awk to extract early access features from featurestages.go
37- # without requiring Go compilation
38- features=$( grep -A 5 " FeatureStageEarlyAccess" " ${PROJECT_ROOT} /codersdk/featurestages.go" |
39- grep -B 5 -A 2 " Name:" |
40- awk ' BEGIN {OFS="|"; print "| Feature | Description | Documentation Path |"; print "|---------|-------------|------------------|"}
41- /Name:/ {name=$2; gsub(/"/, "", name)}
42- /Description:/ {desc=$0; gsub(/.*Description: "/, "", desc); gsub(/",$/, "", desc)}
43- /DocsPath:/ {path=$2; gsub(/"/, "", path); if (name != "" && desc != "" && path != "") {print " " name, " " desc, " " path; name=""; desc=""; path=""}}' )
38+ echo " | Feature | Description | Documentation Path |"
39+ echo " |---------|-------------|------------------|"
4440
45- echo " $features "
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 |"
4644}
4745
48- # Extract beta features from featurestages .go
46+ # Extract beta features from deployment .go
4947generate_beta_table () {
50- # Use grep and awk to extract beta features from featurestages.go
51- # without requiring Go compilation
52- features=$( grep -A 5 " FeatureStageBeta" " ${PROJECT_ROOT} /codersdk/featurestages.go" |
53- grep -B 5 -A 2 " Name:" |
54- awk ' BEGIN {OFS="|"; print "| Feature | Description | Documentation Path |"; print "|---------|-------------|------------------|"}
55- /Name:/ {name=$2; gsub(/"/, "", name)}
56- /Description:/ {desc=$0; gsub(/.*Description: "/, "", desc); gsub(/",$/, "", desc)}
57- /DocsPath:/ {path=$2; gsub(/"/, "", path); if (name != "" && desc != "" && path != "") {print " " name, " " desc, " " path; name=""; desc=""; path=""}}' )
48+ echo " | Feature | Description | Documentation Path |"
49+ echo " |---------|-------------|------------------|"
5850
59- echo " $features "
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 |"
6055}
6156
6257workdir=build/docs/experiments
@@ -76,37 +71,37 @@ beta_table=$(generate_beta_table)
7671awk -v exp_table=" ${experiments_table} " -v ea_table=" ${early_access_table} " -v beta_table=" ${beta_table} " '
7772 # State variables to track which section we are in
7873 BEGIN { in_exp = 0; in_ea = 0; in_beta = 0; }
79-
74+
8075 # For experimental features section
81- /<!-- BEGIN: available-experimental-features -->/ {
82- print; print exp_table; in_exp = 1; next;
76+ /<!-- BEGIN: available-experimental-features -->/ {
77+ print; print exp_table; in_exp = 1; next;
8378 }
84- /<!-- END: available-experimental-features -->/ {
85- in_exp = 0; print; next;
79+ /<!-- END: available-experimental-features -->/ {
80+ in_exp = 0; print; next;
8681 }
87-
82+
8883 # For early access features section
89- /<!-- BEGIN: early-access-features -->/ {
90- print; print ea_table; in_ea = 1; next;
84+ /<!-- BEGIN: early-access-features -->/ {
85+ print; print ea_table; in_ea = 1; next;
9186 }
92- /<!-- END: early-access-features -->/ {
93- in_ea = 0; print; next;
87+ /<!-- END: early-access-features -->/ {
88+ in_ea = 0; print; next;
9489 }
95-
90+
9691 # For beta features section
97- /<!-- BEGIN: beta-features -->/ {
98- print; print beta_table; in_beta = 1; next;
92+ /<!-- BEGIN: beta-features -->/ {
93+ print; print beta_table; in_beta = 1; next;
9994 }
100- /<!-- END: beta-features -->/ {
101- in_beta = 0; print; next;
95+ /<!-- END: beta-features -->/ {
96+ in_beta = 0; print; next;
10297 }
103-
98+
10499 # Skip lines between markers
105100 (in_exp || in_ea || in_beta) { next; }
106-
101+
107102 # Print all other lines
108103 { print; }
109- ' " ${dest} " > " ${dest} .new"
104+ ' " ${dest} " > " ${dest} .new"
110105
111106# Move the new file into place
112107mv " ${dest} .new" " ${dest} "
0 commit comments