## Summary Coder has only Community and Premium license tiers, but several docs pages, CLI help strings, and SDK field comments still called features "Enterprise" or "enterprise-only". This PR changes them to say Premium and regenerates the reference docs built from those strings. Resolves [DOCS-1298](https://linear.app/codercom/issue/DOCS-1298/remove-references-to-the-retired-enterprise-license-tier). ## Changes - `docs/admin/users/quotas.md`: Replace "scoped to Groups in Enterprise and organizations in Premium" with a correct sentence. Quotas are Premium, allowances are set on groups, and each user's budget is calculated separately in each organization (per `GetQuotaAllowanceForUser`). - `docs/user-guides/workspace-lifecycle.md`: Replace "Enterprise" with Premium, and correct the quotas sentence to match the quotas page. - `docs/ai-coder/agents/platform-controls/mcp-servers.md`: Replace "enterprise entitlement" with Premium license. - `cli/templatecreate.go`, `cli/templateedit.go`: Update `--require-active-version`, `--allow-user-autostart`, and `--allow-user-autostop` help text. Point the `--require-active-version` help at the renamed `#template-update-policies` section, because the old `#require-automatic-updates-enterprise` anchor is broken. Make the errors for these flags tier-neutral. - `enterprise/cli/features.go`: `coder features` now says "List license features and entitlements", and its AGPL error no longer names a tier. - `codersdk/templates.go`, `codersdk/organizations.go`: Update field comments that feed the API reference and TypeScript types. - `docs/reference/glossary.md`: The Premium entry now says "paid license tier" instead of "paid enterprise tier". - `docs/.style/style-guide/voice-and-tone.md`: The example sentence now says "Premium licensing". - Regenerated: CLI golden files, `docs/reference/cli/`, `docs/manifest.json`, `docs/manifest/generated/cli.json`, `docs/reference/api/`, `coderd/apidoc/`, and `site/src/api/typesGenerated.ts`. ## Testing - `go test ./cli -run 'TestCommandHelp|TestCliTemplateCreate'` and `go test ./enterprise/cli -run 'TestEnterpriseCommandHelp|TestTemplateCreate|TestTemplateEdit|TestFeaturesList'` pass. - The pre-commit hook passed, including `make gen`, `fmt`, `lint/go`, `lint/ts`, `lint/markdown`, and a slim build. <details> <summary>Decisions and out-of-scope items</summary> ### Decisions - **Premium wording and legacy Enterprise licenses:** Coder still accepts existing Enterprise licenses, and `FeatureSetEnterprise` includes the features labeled Premium here. Docs and help text say "Premium" because that is the tier sold today, and about 25 other docs pages already use "Premium feature". Error strings are tier-neutral, so they're accurate for every license holder. - **Glossary and style guide:** The issue marked these as borderline. Both were one-word changes, so I made them. ### Not changed - `docs/reference/api/enterprise.md` keeps the "Enterprise" sidebar title. It comes from the swagger tag on the `enterprise/` Go package, so renaming it is a larger change. - Other "Enterprise" references the review flagged as out of scope: the `coder server --help` option group, quiet hours SDK comments, internal `coderd` comments, and the dashboard's "Enterprise" badge on the require-active-version option. - No docs page says that legacy Enterprise licenses are still valid. - Uses that don't refer to the license tier: GitHub Enterprise, Red Hat Enterprise Linux, "enterprise environments", and `enterprise/` package paths. </details> --- _This PR was generated by Coder Agents on behalf of @nickvigilante._
130 lines
3.4 KiB
Go
130 lines
3.4 KiB
Go
package cli
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"errors"
|
|
"fmt"
|
|
"net/http"
|
|
"strings"
|
|
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/coder/coder/v2/cli/cliui"
|
|
"github.com/coder/coder/v2/codersdk"
|
|
"github.com/coder/serpent"
|
|
)
|
|
|
|
func (r *RootCmd) features() *serpent.Command {
|
|
cmd := &serpent.Command{
|
|
Short: "List license features and entitlements",
|
|
Use: "features",
|
|
Aliases: []string{"feature"},
|
|
Handler: func(inv *serpent.Invocation) error {
|
|
return inv.Command.HelpHandler(inv)
|
|
},
|
|
Children: []*serpent.Command{
|
|
r.featuresList(),
|
|
},
|
|
}
|
|
return cmd
|
|
}
|
|
|
|
func (r *RootCmd) featuresList() *serpent.Command {
|
|
var (
|
|
featureColumns = []string{"name", "entitlement", "enabled", "limit", "actual"}
|
|
columns []string
|
|
outputFormat string
|
|
)
|
|
|
|
cmd := &serpent.Command{
|
|
Use: "list",
|
|
Aliases: []string{"ls"},
|
|
Middleware: serpent.Chain(),
|
|
Handler: func(inv *serpent.Invocation) error {
|
|
client, err := r.InitClient(inv)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
entitlements, err := client.Entitlements(inv.Context())
|
|
var apiError *codersdk.Error
|
|
if errors.As(err, &apiError) && apiError.StatusCode() == http.StatusNotFound {
|
|
return xerrors.New("You are on the AGPL licensed version of Coder, which does not support licensed features.")
|
|
}
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// This uses custom formatting as the JSON output outputs an object
|
|
// as opposed to a list from the table output.
|
|
out := ""
|
|
switch outputFormat {
|
|
case "table", "":
|
|
out, err = displayFeatures(columns, entitlements.Features)
|
|
if err != nil {
|
|
return xerrors.Errorf("render table: %w", err)
|
|
}
|
|
case "json":
|
|
buf := new(bytes.Buffer)
|
|
enc := json.NewEncoder(buf)
|
|
enc.SetIndent("", " ")
|
|
err = enc.Encode(entitlements)
|
|
if err != nil {
|
|
return xerrors.Errorf("marshal features to JSON: %w", err)
|
|
}
|
|
out = buf.String()
|
|
default:
|
|
return xerrors.Errorf(`unknown output format %q, only "table" and "json" are supported`, outputFormat)
|
|
}
|
|
|
|
_, err = fmt.Fprintln(inv.Stdout, out)
|
|
return err
|
|
},
|
|
}
|
|
|
|
cmd.Options = serpent.OptionSet{
|
|
{
|
|
Flag: "column",
|
|
FlagShorthand: "c",
|
|
Description: "Specify columns to filter in the table.",
|
|
Default: strings.Join(featureColumns, ","),
|
|
Value: serpent.EnumArrayOf(&columns, featureColumns...),
|
|
},
|
|
{
|
|
Flag: "output",
|
|
FlagShorthand: "o",
|
|
Description: "Output format.",
|
|
Default: "table",
|
|
Value: serpent.EnumOf(&outputFormat, "table", "json"),
|
|
},
|
|
}
|
|
|
|
return cmd
|
|
}
|
|
|
|
type featureRow struct {
|
|
Name codersdk.FeatureName `table:"name,default_sort"`
|
|
Entitlement string `table:"entitlement"`
|
|
Enabled bool `table:"enabled"`
|
|
Limit *int64 `table:"limit"`
|
|
Actual *int64 `table:"actual"`
|
|
}
|
|
|
|
// displayFeatures will return a table displaying all features passed in.
|
|
// filterColumns must be a subset of the feature fields and will determine which
|
|
// columns to display
|
|
func displayFeatures(filterColumns []string, features map[codersdk.FeatureName]codersdk.Feature) (string, error) {
|
|
rows := make([]featureRow, 0, len(features))
|
|
for name, feat := range features {
|
|
rows = append(rows, featureRow{
|
|
Name: name,
|
|
Entitlement: string(feat.Entitlement),
|
|
Enabled: feat.Enabled,
|
|
Limit: feat.Limit,
|
|
Actual: feat.Actual,
|
|
})
|
|
}
|
|
|
|
return cliui.DisplayTable(rows, "name", filterColumns)
|
|
}
|