Add durable Paseo Hub CLI login (#3022)

* feat(cli): add durable Hub login

Keep organization-scoped human credentials separate from daemon relationship authority. Connect now exchanges explicit or stored CLI authority for a one-time enrollment token, while logout removes human access without implicitly disconnecting automation.

* fix(cli): require TLS for remote Hub credentials

Durable Hub credentials are bearer secrets, so remote origins must not receive them over cleartext HTTP. Keep literal loopback HTTP available for local Hub development.

* fix(cli): make Hub destinations explicit

Resolve optional Hub origins through one shared precedence policy so active logins remain the default context and credentials stay origin-bound. Report the selected destination before human-facing work, keep structured output auditable, and preserve login authority until requested daemon disconnection succeeds.
This commit is contained in:
Mohamed Boudra
2026-08-08 15:27:43 +02:00
committed by GitHub
parent e36842b234
commit b669dad221
40 changed files with 2369 additions and 1032 deletions
@@ -1,4 +1,18 @@
import { createHubCommand } from "../../../../../cli/src/commands/hub/index.js";
import { HubHttpClient } from "../../../../../cli/src/commands/hub/client.js";
const CONTRACT_API_KEY_PREFIX = "hub-contract-api-key:";
class HubContractHttpClient extends HubHttpClient {
override async issueEnrollmentToken(_origin: string, apiKey: string): Promise<string> {
if (!apiKey.startsWith(CONTRACT_API_KEY_PREFIX)) {
throw new Error("Hub contract API key is invalid");
}
return apiKey.slice(CONTRACT_API_KEY_PREFIX.length);
}
}
const argv = [process.argv[0] ?? "node", process.argv[1] ?? "paseo", ...process.argv.slice(3)];
await createHubCommand().parseAsync(argv, { from: "node" });
await createHubCommand({ hub: new HubContractHttpClient(), env: {} }).parseAsync(argv, {
from: "node",
});
@@ -458,7 +458,9 @@ export class HubRelationshipHarness {
}
beginConnect(token = "ceremony-token", hubUrl = HUB_ORIGIN): CliProcess {
return { result: this.runCli(["hub", "connect", hubUrl, "--token", token]) };
return {
result: this.runCli(["hub", "connect", hubUrl, "--api-key", `hub-contract-api-key:${token}`]),
};
}
async status(): Promise<Record<string, unknown>> {