Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,8 @@ Required `data` fields:

Each item includes: `projectId`, `name`, `appId`, `projectType`, `status`, `createdAt`, `updatedAt`.

The API `projectType` is preserved as a string, including `paas`, `apaas`, `meeting`, `game-voice`, and `call-agent` for existing Call Agent projects. Consumers should allow additional types. This API field is distinct from the local `.agora/project.json` framework field; `project create` continues to create `paas` projects.

Safe branch fields:
- `items[].projectId`
- `items[].name`
Expand Down
43 changes: 43 additions & 0 deletions internal/cli/integration_project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@ import (
"testing"
)

func TestCLIProjectListAndShowCallAgent(t *testing.T) {
configHome := t.TempDir()
api := newFakeCLIBFF()
defer api.server.Close()
project := buildFakeProject("Call Agent Project", "callAgent123", "app_call_agent", "cn")
project.ProjectType = "call-agent"
api.projects[project.ProjectID] = &project
persistSessionForIntegration(t, configHome)
opts := cliRunOptions{env: map[string]string{
"XDG_CONFIG_HOME": configHome,
"AGORA_API_BASE_URL": api.baseURL,
"AGORA_LOG_LEVEL": "error",
}}

list := runCLI(t, []string{"project", "list", "--json"}, opts)
var envelope struct {
OK bool `json:"ok"`
Data projectListResponse `json:"data"`
}
if err := json.Unmarshal([]byte(list.stdout), &envelope); err != nil {
t.Fatal(err)
}
if list.exitCode != 0 || !envelope.OK || len(envelope.Data.Items) != 1 || envelope.Data.Items[0].ProjectType != "call-agent" {
t.Fatalf("expected call-agent project in list: %+v", list)
}

for _, selector := range []string{project.ProjectID, project.Name} {
show := runCLI(t, []string{"project", "show", selector, "--json"}, opts)
var detail struct {
OK bool `json:"ok"`
Data struct {
ProjectID string `json:"projectId"`
} `json:"data"`
}
if err := json.Unmarshal([]byte(show.stdout), &detail); err != nil {
t.Fatal(err)
}
if show.exitCode != 0 || !detail.OK || detail.Data.ProjectID != project.ProjectID {
t.Fatalf("expected call-agent project resolved by %q: %+v", selector, show)
}
}
}

func TestCLIProjectEnvAndDoctor(t *testing.T) {
configHome := t.TempDir()
projectDir := t.TempDir()
Expand Down