Services can resolve legacy aliases and expose the catalog over CLI and HTTP instead of ad-hoc error strings. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
508 B
Go
26 lines
508 B
Go
package domains
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"error-code-system/errcode"
|
|
)
|
|
|
|
func TestWriteCatalog(t *testing.T) {
|
|
if os.Getenv("WRITE_CATALOG") != "1" {
|
|
t.Skip("set WRITE_CATALOG=1 to regenerate sys.json agent.json squad.json")
|
|
}
|
|
r := errcode.NewRegistry()
|
|
RegisterAll(r)
|
|
for _, domain := range []string{"sys", "agent", "squad"} {
|
|
data, err := ExportDomain(r, domain)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := os.WriteFile(domain+".json", data, 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
}
|