@getmaito/cli 0.1.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 +70 -0
- package/dist/auth.d.ts +42 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18133 -0
- package/dist/output.d.ts +4 -0
- package/dist/output.d.ts.map +1 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Maito CLI
|
|
2
|
+
|
|
3
|
+
Command-line client for Maito.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Install the CLI:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install -g @getmaito/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then sign in:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
maito login
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Run commands:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
maito posts list
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Auth
|
|
26
|
+
|
|
27
|
+
Sign in for full CLI access:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
maito login
|
|
31
|
+
maito auth status
|
|
32
|
+
maito logout
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
API keys are supported for customer API automation:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
maito auth use-api-key --api-key <key>
|
|
39
|
+
MAITO_API_KEY=<key> maito newsletter subscribers list --json
|
|
40
|
+
maito posts list --api-key <key>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Auth precedence is:
|
|
44
|
+
|
|
45
|
+
1. `--api-key`
|
|
46
|
+
2. `MAITO_API_KEY`
|
|
47
|
+
3. Saved sign-in session
|
|
48
|
+
4. Stored API key
|
|
49
|
+
|
|
50
|
+
API keys are intentionally limited to supported customer API endpoints. Run `maito login` for full user CLI access.
|
|
51
|
+
|
|
52
|
+
## Updating
|
|
53
|
+
|
|
54
|
+
Update the global install:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm update -g @getmaito/cli
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Release
|
|
61
|
+
|
|
62
|
+
The CLI package is published as `@getmaito/cli`.
|
|
63
|
+
|
|
64
|
+
1. Bump `packages/cli/package.json` with semver.
|
|
65
|
+
2. Run `bun run typecheck` from `packages/cli`.
|
|
66
|
+
3. Run `bun run build` from `packages/cli`.
|
|
67
|
+
4. Run `npm pack --dry-run` from `packages/cli` and verify the tarball only includes `dist`, `package.json`, and this README.
|
|
68
|
+
5. Run `npm publish --access public` from `packages/cli`.
|
|
69
|
+
|
|
70
|
+
Use patch versions for fixes, minor versions for new commands or backwards-compatible flags, and major versions for command or flag breaking changes.
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type StoredAuthSession = {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
refreshToken: string;
|
|
4
|
+
clientId: string;
|
|
5
|
+
tokenEndpoint: string;
|
|
6
|
+
authorizationServer: string;
|
|
7
|
+
userinfoEndpoint?: string;
|
|
8
|
+
scope?: string;
|
|
9
|
+
tokenType?: string;
|
|
10
|
+
expiresAt: string;
|
|
11
|
+
};
|
|
12
|
+
export type StoredApiKey = {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
};
|
|
16
|
+
export type AuthStatus = {
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
session: StoredAuthSession;
|
|
19
|
+
user?: {
|
|
20
|
+
id?: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
username?: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function resolveApiBaseUrl(value?: string): string;
|
|
27
|
+
export declare function login(input: {
|
|
28
|
+
baseUrl: string;
|
|
29
|
+
clientId?: string;
|
|
30
|
+
}): Promise<AuthStatus>;
|
|
31
|
+
export declare function logout(baseUrl: string): Promise<boolean>;
|
|
32
|
+
export declare function saveApiKey(baseUrl: string, apiKey: string): Promise<void>;
|
|
33
|
+
export declare function removeApiKey(baseUrl: string): Promise<boolean>;
|
|
34
|
+
export declare function getStoredApiKey(baseUrl: string): Promise<string | null>;
|
|
35
|
+
export declare function getAuthStatus(baseUrl: string): Promise<AuthStatus | null>;
|
|
36
|
+
export declare function getAccessToken(baseUrl: string): Promise<string>;
|
|
37
|
+
export declare function getCommandAuthToken(input: {
|
|
38
|
+
baseUrl: string;
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
}): Promise<string>;
|
|
41
|
+
export declare function resetAuthStore(): Promise<void>;
|
|
42
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAwEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,CAAC,EAAE;QACL,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ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