| 147 | // ── Command implementations ───────────────────────────────────────────── |
| 148 | |
| 149 | std::string CmdAuthStatus(const std::string& provider) { |
| 150 | std::string tokenPath = GetTokenPath(provider); |
| 151 | if (tokenPath.empty()) { |
| 152 | return JsonError("Cannot determine config directory"); |
| 153 | } |
| 154 | |
| 155 | auto prov = CreateCloudProvider(provider); |
| 156 | if (!prov) { |
| 157 | return JsonError("Unknown provider: " + provider); |
| 158 | } |
| 159 | |
| 160 | if (!prov->Init(tokenPath)) { |
| 161 | return JsonObject({ |
| 162 | {"authenticated", JsonBool(false)}, |
| 163 | {"error", JsonString("Failed to initialize provider")} |
| 164 | }); |
| 165 | } |
| 166 | |
| 167 | bool authenticated = prov->IsAuthenticated(); |
| 168 | prov->Shutdown(); |
| 169 | |
| 170 | return JsonObject({ |
| 171 | {"authenticated", JsonBool(authenticated)}, |
| 172 | {"token_path", JsonString(tokenPath)} |
| 173 | }); |
| 174 | } |
| 175 | |
| 176 | std::string CmdListRemoteApps(const std::string& provider, const std::string& accountId) { |
| 177 | std::string tokenPath = GetTokenPath(provider); |
no test coverage detected