Skip to content

Commit becaee6

Browse files
committed
remove GetDocsPath
1 parent 422586f commit becaee6

File tree

3 files changed

+118
-85
lines changed

3 files changed

+118
-85
lines changed

codersdk/deployment.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,19 +3374,8 @@ func (e Experiment) GetDescription() string {
33743374
}
33753375
}
33763376

3377-
// GetDocsPath returns the path to documentation for the feature
3378-
func (e Experiment) GetDocsPath() string {
3379-
switch e {
3380-
case ExperimentDevContainers:
3381-
return "ai-coder/dev-containers.md"
3382-
case ExperimentAgenticChat:
3383-
return "ai-coder/agents.md"
3384-
case ExperimentWorkspacePrebuilds:
3385-
return "workspaces/prebuilds.md"
3386-
default:
3387-
return ""
3388-
}
3389-
}
3377+
// GetDocsPath is removed to simplify the process for adding new features
3378+
// Documentation paths are now managed directly in the documentation itself
33903379

33913380
// ExperimentsSafe should include all experiments that are safe for
33923381
// users to opt-in to via --experimental='*'.

docs/install/releases/feature-stages.md

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ If you encounter an issue with any Coder feature, please submit a
1010
## Feature stages
1111

1212
| Feature stage | Stable | Production-ready | Support | Description |
13-
|----------------------------------------|--------|------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------------------|
13+
| -------------------------------------- | ------ | ---------------- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
1414
| [Early Access](#early-access-features) | No | No | GitHub issues | For staging only. Not feature-complete or stable. Disabled by default. |
1515
| [Beta](#beta) | No | Not fully | Docs, Discord, GitHub | Publicly available. In active development with minor bugs. Suitable for staging; optional for production. Not covered by SLA. |
1616
| [GA](#general-availability-ga) | Yes | Yes | License-based | Stable and tested. Enabled by default. Fully documented. Support based on license. |
@@ -65,25 +65,12 @@ You can opt-out of a feature after you've enabled it.
6565
<!-- Code generated by scripts/release/docs_update_experiments.sh. DO NOT EDIT. -->
6666
<!-- BEGIN: available-experimental-features -->
6767

68-
| Feature | Description | Available in |
69-
|-----------------------|----------------------------------------------|------------------|
70-
| `dev-containers` | Enables dev containers support. | mainline, stable |
71-
| `agentic-chat` | Enables the new agentic AI chat feature. | mainline, stable |
72-
| `workspace-prebuilds` | Enables the new workspace prebuilds feature. | mainline, stable |
68+
| Feature Flag | Name | Available in |
69+
| ---------------- | -------------------------- | ---------------- |
70+
| `dev-containers` | Dev Containers Integration | mainline, stable |
7371

7472
<!-- END: available-experimental-features -->
7573

76-
### Early access features in documentation
77-
78-
<!-- Code generated by scripts/release/docs_update_experiments.sh. DO NOT EDIT. -->
79-
<!-- BEGIN: early-access-features -->
80-
81-
| Feature | Description | Documentation Path |
82-
|----------------------------|----------------------------|----------------------------|
83-
| Dev Containers Integration | Dev Containers Integration | ai-coder/dev-containers.md |
84-
85-
<!-- END: early-access-features -->
86-
8774
## Beta
8875

8976
- **Stable**: No
@@ -115,15 +102,14 @@ Most beta features are enabled by default. Beta features are announced through
115102
the [Coder Changelog](https://coder.com/changelog), and more information is
116103
available in the documentation.
117104

118-
### Beta features in documentation
105+
### Beta features
119106

120-
<!-- Code generated by scripts/release/docs_update_experiments.sh. DO NOT EDIT. -->
121107
<!-- BEGIN: beta-features -->
122108

123-
| Feature | Description | Documentation Path |
124-
|---------------------|---------------------|-------------------------|
125-
| AI Coding Agents | AI Coding Agents | ai-coder/agents.md |
126-
| Prebuilt workspaces | Prebuilt workspaces | workspaces/prebuilds.md |
109+
| Feature Flag | Name |
110+
| --------------------- | ------------------- |
111+
| `workspace-prebuilds` | Prebuilt workspaces |
112+
| `agentic-chat` | AI Coding Agents |
127113

128114
<!-- END: beta-features -->
129115

scripts/release/docs_update_experiments.sh

Lines changed: 107 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,71 @@ if isdarwin; then
2020
awk() { gawk "$@"; }
2121
fi
2222

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)
3463
}
64+
EOT
3565

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+
}
4071

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 |"'
4479
}
4580

4681
# Extract beta features from deployment.go
4782
generate_beta_table() {
48-
echo "| Feature | Description | Documentation Path |"
49-
echo "|---------|-------------|------------------|"
83+
echo "| Feature Flag | Name |"
84+
echo "|-------------|------|"
5085

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) |"'
5588
}
5689

5790
dest=docs/install/releases/feature-stages.md
@@ -60,49 +93,74 @@ log "Updating feature stages documentation in ${dest}"
6093

6194
# Generate the tables
6295
experiments_table=$(generate_experiments_table)
63-
early_access_table=$(generate_early_access_table)
6496
beta_table=$(generate_beta_table)
6597

6698
# We're using a single-pass awk script that replaces content between markers
6799
# No need for cleanup operations
68100

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 -->
73104
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 -->
81112
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;
85125
}
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;
88131
}
89-
90-
# For beta features section
132+
133+
/<!-- END: available-experimental-features -->/ {
134+
ea = 0;
135+
next;
136+
}
137+
91138
/<!-- 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;
93142
}
143+
94144
/<!-- END: beta-features -->/ {
95-
in_beta = 0; print; next;
145+
beta = 0;
146+
next;
96147
}
97-
148+
98149
# Skip lines between markers
99-
(in_exp || in_ea || in_beta) { next; }
100-
150+
(ea || beta) { next; }
151+
101152
# Print all other lines
102153
{ print; }
103-
' "${dest}" >"${dest}.new"
154+
' "${dest}" > "${dest}.new"
104155

105156
# Move the new file into place
106157
mv "${dest}.new" "${dest}"
107158

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
108166
(cd site && pnpm exec prettier --cache --write ../"${dest}")

0 commit comments

Comments
 (0)