@neta-art/cohub-cli 10.15.0 → 10.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -122,8 +122,10 @@ cohub spaces create --name "<name>" --checkpoint <checkpointId> --json
122
122
  cohub spaces update <spaceId> --slug <space-slug>
123
123
  cohub spaces rename <spaceId> "<new name>"
124
124
  cohub -s <spaceId> spaces invites create --role builder --days 7
125
- cohub -s <spaceId> spaces invites ls
125
+ cohub -s <spaceId> spaces invites create --role guest --never-expires
126
+ cohub -s <spaceId> spaces invites ls --all
126
127
  cohub -s <spaceId> spaces invites revoke <code> --yes
128
+ cohub spaces config <spaceId> --guest-app <app>
127
129
  cohub -s <spaceId> run -- git status
128
130
  ```
129
131
 
package/dist/auth.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type CohubEnvironment } from "@neta-art/cohub";
2
2
  export type AuthSource = "execution-token" | "logto" | null;
3
- type DeviceCode = {
3
+ export type DeviceCode = {
4
4
  deviceCode: string;
5
5
  userCode: string;
6
6
  verificationUri: string;
@@ -29,6 +29,7 @@ export declare class AuthRequiredError extends Error {
29
29
  constructor(message?: string);
30
30
  }
31
31
  export declare const readAuthSession: () => AuthSession | null;
32
+ export declare const authSessionPath: () => string;
32
33
  export declare const clearAuthSession: (env?: CohubEnvironment, baseUrl?: string) => void;
33
34
  export declare const authSource: () => AuthSource;
34
35
  export declare function resolveAccessToken(options?: {
@@ -39,5 +40,6 @@ export declare function refreshAccessToken(session?: AuthSession | null): Promis
39
40
  export declare function requestDeviceCode(): Promise<DeviceCode>;
40
41
  export declare function verifyDeviceCode(): Promise<AuthSession>;
41
42
  export declare function loginWithDeviceFlow(onCode: (code: DeviceCode) => void, onPoll?: () => void): Promise<AuthSession>;
43
+ export declare function pollDeviceCode(code: DeviceCode, onPoll?: () => void): Promise<AuthSession>;
42
44
  export declare function revokeAndClearAuthSession(): Promise<void>;
43
45
  export {};
package/dist/auth.js CHANGED
@@ -129,6 +129,7 @@ const toSession = (token, config, env, previous) => {
129
129
  };
130
130
  };
131
131
  export const readAuthSession = () => readJson(sessionPath());
132
+ export const authSessionPath = () => sessionPath();
132
133
  export const clearAuthSession = (env = currentEnv(), baseUrl = resolveApiBaseUrl({ env })) => {
133
134
  removeIfExists(sessionPath(env, baseUrl));
134
135
  removeIfExists(deviceCodePath(env, baseUrl));
@@ -262,6 +263,9 @@ export async function verifyDeviceCode() {
262
263
  export async function loginWithDeviceFlow(onCode, onPoll) {
263
264
  const code = await requestDeviceCode();
264
265
  onCode(code);
266
+ return pollDeviceCode(code, onPoll);
267
+ }
268
+ export async function pollDeviceCode(code, onPoll) {
265
269
  while (Date.now() < code.expiresAt) {
266
270
  await delay(code.interval * 1000);
267
271
  onPoll?.();