@gravity-rail/cli 0.2.0 → 0.4.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
@@ -141,7 +141,7 @@ cat member.json | gr members update -w $WORKSPACE --id 42 --allow-write
141
141
 
142
142
  | Domain | Description |
143
143
  |---|---|
144
- | `tasks` | Workflow tasks — CRUD, archive, clone, convert-to-abilities |
144
+ | `tasks` | Workflow tasks — CRUD, archive, clone |
145
145
  | `chats` | Conversations — CRUD, labels, filters, messages, export, summaries |
146
146
  | `members` | Contacts and team — CRUD, labels, filters, roles, fields, import/export |
147
147
  | `workspaces` | Workspace management — CRUD, features, themes, invitations, export/import |
@@ -198,7 +198,7 @@ cat member.json | gr members update -w $WORKSPACE --id 42 --allow-write
198
198
  | `apps` | OAuth app management |
199
199
  | `oauth` | OAuth provider connections |
200
200
  | `auth` | Two-factor authentication, credentials, and password management |
201
- | `org` | Organization membership and invitations |
201
+ | `org` | Organization membership, invitations, and org domains |
202
202
 
203
203
  ## Recipes
204
204
 
@@ -208,6 +208,34 @@ cat member.json | gr members update -w $WORKSPACE --id 42 --allow-write
208
208
  gr chats list -w $WORKSPACE -o json > chats.json
209
209
  ```
210
210
 
211
+ ### List chat messages with pagination
212
+
213
+ ```sh
214
+ # Default returns up to 100 messages (API max)
215
+ gr chats messages list -w $WORKSPACE --id $CHAT_ID
216
+
217
+ # Paginate with --limit and --offset
218
+ gr chats messages list -w $WORKSPACE --id $CHAT_ID --limit 50 --offset 100
219
+ ```
220
+
221
+ ### Register and verify an org domain
222
+
223
+ ```sh
224
+ # Register the domain and get the ownership TXT record
225
+ gr org domains register --org-uuid $ORG_UUID --domain example.com --allow-write
226
+
227
+ # Verify ownership TXT
228
+ gr org domains verify-ownership --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
229
+
230
+ # Email DNS: enable records, then verify SPF/DKIM/DMARC/MX/return-path
231
+ gr org domains email enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
232
+ gr org domains email verify-mx --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
233
+
234
+ # Site DNS: enable custom site routing, then verify CNAME
235
+ gr org domains site enable --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
236
+ gr org domains site verify-cname --org-uuid $ORG_UUID --domain-uuid $DOMAIN_UUID --allow-write
237
+ ```
238
+
211
239
  ### Find members by label
212
240
 
213
241
  ```sh
@@ -0,0 +1,86 @@
1
+ /**
2
+ * CLI configuration for remote environments
3
+ */
4
+ interface EnvironmentConfig {
5
+ apiUrl: string;
6
+ frontendUrl: string;
7
+ }
8
+ declare const ENVIRONMENTS: Record<string, EnvironmentConfig>;
9
+ declare const CALLBACK_PORT = 31337;
10
+ declare const CALLBACK_PATH = "/oauth/callback";
11
+ declare const REDIRECT_URI = "http://localhost:31337/oauth/callback";
12
+ declare function getEnvironmentConfig(env: string): EnvironmentConfig;
13
+
14
+ /**
15
+ * CLI OAuth2 authentication utilities
16
+ *
17
+ * Provides OAuth2 with PKCE flow for CLI tools, including:
18
+ * - Credential caching (per environment)
19
+ * - Dynamic client registration
20
+ * - Token refresh
21
+ * - Browser-based authorization
22
+ */
23
+
24
+ interface CLICredentials {
25
+ clientId: string;
26
+ clientSecret: string;
27
+ accessToken?: string;
28
+ refreshToken?: string;
29
+ expiresAt?: string;
30
+ }
31
+ interface AuthResult {
32
+ accessToken: string;
33
+ credentials?: CLICredentials;
34
+ }
35
+ /**
36
+ * Manages CLI credentials storage (flat format, one file per environment)
37
+ */
38
+ declare class CredentialsManager {
39
+ private cacheDir;
40
+ private apiUrl?;
41
+ constructor(rootDir: string, apiUrl?: string);
42
+ private getCredentialsPath;
43
+ load(env: string): CLICredentials | null;
44
+ save(env: string, creds: CLICredentials): void;
45
+ clear(env: string): void;
46
+ getCacheDir(): string;
47
+ }
48
+ /**
49
+ * Generate PKCE code verifier and challenge
50
+ */
51
+ declare function generatePKCE(): {
52
+ codeVerifier: string;
53
+ codeChallenge: string;
54
+ };
55
+ /**
56
+ * Open a URL in the default browser
57
+ */
58
+ declare function openBrowser(url: string): void;
59
+ /**
60
+ * Start a local HTTP server to receive the OAuth callback
61
+ */
62
+ declare function startCallbackServer(): Promise<{
63
+ code: string;
64
+ state: string;
65
+ }>;
66
+ interface OAuthFlowOptions {
67
+ env: string;
68
+ envConfig: EnvironmentConfig;
69
+ credentialsManager: CredentialsManager;
70
+ clientName?: string;
71
+ }
72
+ /**
73
+ * Perform the full OAuth2 browser-based flow with PKCE.
74
+ *
75
+ * This always opens the browser for authorization. It never returns a cached
76
+ * token — that's the job of createAuthenticatedContext. The only thing reused
77
+ * is the registered OAuth client ID (which is identity, not auth).
78
+ */
79
+ declare function performOAuthFlow(options: OAuthFlowOptions): Promise<AuthResult>;
80
+ /**
81
+ * Refresh an access token using a stored refresh token.
82
+ * Returns updated credentials on success, null on failure.
83
+ */
84
+ declare function refreshAccessToken(envConfig: EnvironmentConfig, creds: CLICredentials, credentialsManager: CredentialsManager, env: string): Promise<CLICredentials | null>;
85
+
86
+ export { type AuthResult as A, CredentialsManager as C, type EnvironmentConfig as E, type OAuthFlowOptions as O, REDIRECT_URI as R, CALLBACK_PATH as a, CALLBACK_PORT as b, type CLICredentials as c, ENVIRONMENTS as d, getEnvironmentConfig as e, generatePKCE as g, openBrowser as o, performOAuthFlow as p, refreshAccessToken as r, startCallbackServer as s };