{
  "repo": "pingcap/agent-git-service",
  "binary": "gh-server",
  "binary_path": "main.go",
  "dependencies": {
    "GHServerLifecycle.Bootstrap": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Local repository storage directory and optional TLS cert/key files are configured"
          ],
          "operations": [
            {
              "operation": "INITIALIZE GIT STORE",
              "trigger": "Open the on-disk git repository store used by Git Smart HTTP and repo operations",
              "conditions": [
                "gitstore.New(...) succeeds"
              ],
              "implementation": "initCoreDeps -> gitstore.New(cfg.GitRepoDir, ...)"
            }
          ]
        }
      },
      "services": [
        {
          "name": "mysql",
          "target_interface": "gorm database connection",
          "operation_type": "sql",
          "conditions": [
            "DBdsn is configured"
          ],
          "operations": [
            {
              "operation": "INITIALIZE MAIN DATABASE",
              "trigger": "Create the primary database connection and optional seed data",
              "conditions": [
                "db.Init(cfg.DBdsn) succeeds"
              ],
              "implementation": "initCoreDeps -> db.Init(cfg.DBdsn) -> db.Seed(...) when development"
            }
          ]
        },
        {
          "name": "auth0",
          "target_interface": "issuer/client validation endpoints",
          "operation_type": "http_get",
          "conditions": [
            "Auth0 issuer/client configuration is set"
          ],
          "operations": [
            {
              "operation": "INITIALIZE AUTH0 VALIDATOR",
              "trigger": "Enable Auth0-backed token validation for API requests",
              "conditions": [
                "Auth0 config is non-empty"
              ],
              "implementation": "initServiceDeps -> auth0.New(...)"
            }
          ]
        },
        {
          "name": "openai-compatible-embedding-api",
          "target_interface": "embedding API",
          "operation_type": "http_post",
          "conditions": [
            "Embedding API key is configured"
          ],
          "operations": [
            {
              "operation": "INITIALIZE EMBEDDING CLIENT",
              "trigger": "Enable vector embedding for search and related features",
              "conditions": [
                "EmbeddingAPIKey != \"\""
              ],
              "implementation": "initCoreDeps -> embedding.NewOpenAI(...)"
            }
          ]
        }
      ]
    },
    "GHServerLifecycle.StartProvisioningWorker": {
      "infrastructure": {},
      "services": [
        {
          "name": "control-plane-mysql",
          "target_interface": "control plane routing and provisioning tables",
          "operation_type": "sql",
          "conditions": [
            "CONTROL_PLANE_DSN is configured"
          ],
          "operations": [
            {
              "operation": "POLL PROVISIONING JOBS",
              "trigger": "Run the background provisioning worker over control-plane state",
              "conditions": [
                "initControlPlane(...) succeeds"
              ],
              "implementation": "initControlPlane -> initProvisioningWorker -> provisioningSvc.ProcessPendingJobs(...)"
            }
          ]
        },
        {
          "name": "tidbcloud-api",
          "target_interface": "cluster provisioning backend",
          "operation_type": "http_post",
          "conditions": [
            "TiDB Cloud API key and org ID are configured"
          ],
          "operations": [
            {
              "operation": "PROVISION CLUSTER RESOURCES",
              "trigger": "Execute background TiDB Cloud provisioning jobs",
              "conditions": [
                "TiDBCloudAPIKey != \"\"",
                "TiDBCloudOrgID != \"\""
              ],
              "implementation": "initProvisioningWorker -> provisioning.NewService(...) -> ProcessPendingJobs(...)"
            }
          ]
        }
      ]
    },
    "GHServerLifecycle.StartHTTPServers": {
      "infrastructure": {},
      "services": []
    },
    "GHServerLifecycle.GracefulShutdown": {
      "infrastructure": {},
      "services": []
    },
    "HTTP POST /login/device/code": {
      "infrastructure": {},
      "services": []
    },
    "HTTP POST /login/oauth/access_token": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /login/oauth/authorize": {
      "infrastructure": {},
      "services": []
    },
    "HTTP POST /api/graphql": {
      "infrastructure": {},
      "services": [
        {
          "name": "mysql",
          "target_interface": "service layer backing GraphQL resolvers",
          "operation_type": "sql",
          "conditions": [
            "GraphQL request reaches a resolver backed by the service layer"
          ],
          "operations": [
            {
              "operation": "RESOLVE GRAPHQL DATA",
              "trigger": "Read or mutate GitHub-like entities through GraphQL",
              "conditions": [
                "gqlSrv.Handler executes a resolver"
              ],
              "implementation": "buildHTTPMux -> graphql.NewServer(svcDeps) -> gqlSrv.Handler"
            }
          ]
        }
      ]
    },
    "HTTP GET /metrics": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /readyz": {
      "infrastructure": {},
      "services": [
        {
          "name": "mysql",
          "target_interface": "readiness database checks",
          "operation_type": "sql",
          "conditions": [
            "Readyz probe is invoked"
          ],
          "operations": [
            {
              "operation": "CHECK MAIN DATABASE",
              "trigger": "Verify the main database connection is healthy",
              "conditions": [
                "readyzHandler is executed"
              ],
              "implementation": "buildHTTPMux -> readyzHandler(...)"
            }
          ]
        }
      ]
    },
    "HTTP GET /api/v3/*": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Requests touch repository contents or Git Smart HTTP storage"
          ],
          "operations": [
            {
              "operation": "READ OR WRITE GIT REPOSITORIES",
              "trigger": "Serve repository metadata, files, refs, issues, releases, actions metadata, and related repo-scoped operations",
              "conditions": [
                "The selected REST handler touches gitstore"
              ],
              "implementation": "router.RegisterRoutes -> handlers.* -> service.Service -> gitstore.Store"
            }
          ]
        }
      },
      "services": [
        {
          "name": "mysql",
          "target_interface": "REST backing store",
          "operation_type": "sql",
          "conditions": [
            "Selected REST handler uses the service layer database"
          ],
          "operations": [
            {
              "operation": "SERVE GITHUB-COMPATIBLE REST API",
              "trigger": "Handle authenticated user/org/repo/actions/search operations",
              "conditions": [
                "Any /api/v3/* handler executes through service layer"
              ],
              "implementation": "router.RegisterRoutes -> registerAuthenticatedRoutes(...) -> handlers.* -> service.Service"
            }
          ]
        }
      ]
    },
    "HTTP GET /{owner}/{repo}/info/refs": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Requested repository exists in local git storage"
          ],
          "operations": [
            {
              "operation": "SERVE GIT SMART HTTP DISCOVERY",
              "trigger": "Advertise refs for fetch and push transport over local git repositories",
              "conditions": [
                "Git info/refs route is matched"
              ],
              "implementation": "registerGitHTTPRoutes -> githttp.Handler.InfoRefs"
            }
          ]
        }
      },
      "services": []
    },
    "HTTP POST /{owner}/{repo}/git-*": {
      "infrastructure": {
        "filesystem": {
          "conditions": [
            "Requested repository exists in local git storage"
          ],
          "operations": [
            {
              "operation": "SERVE GIT SMART HTTP",
              "trigger": "Handle fetch and push transport over local git repositories",
              "conditions": [
                "Git upload-pack or receive-pack route is matched"
              ],
              "implementation": "registerGitHTTPRoutes -> githttp.Handler.UploadPack/ReceivePack"
            }
          ]
        }
      },
      "services": []
    }
  }
}
