@posterly/cli 0.1.0 → 0.1.2
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 +33 -1
- package/bin/posterly.mjs +7 -3
- package/generated/platform-manifest.mjs +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
Command line access to the posterly API.
|
|
4
4
|
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
Run the CLI without installing anything globally:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @posterly/cli@latest auth:login
|
|
11
|
+
npx @posterly/cli@latest whoami --pretty
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`npx` downloads and runs the CLI for that command. It does not leave a permanent
|
|
15
|
+
`posterly` binary on your shell `PATH`, so keep using `npx @posterly/cli@latest`
|
|
16
|
+
for each command unless you install the CLI globally.
|
|
17
|
+
|
|
18
|
+
Optional global install:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i -g @posterly/cli@latest
|
|
22
|
+
posterly auth:login
|
|
23
|
+
posterly whoami --pretty
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If global install fails with `EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@posterly'`,
|
|
27
|
+
your npm global folder is not writable by your user. Use the `npx` commands
|
|
28
|
+
above, or fix your npm setup with a user-owned Node install such as `nvm`.
|
|
29
|
+
|
|
30
|
+
Running `npm i @posterly/cli` without `-g` installs the package into the current
|
|
31
|
+
folder. In that case `posterly` will only be available as
|
|
32
|
+
`./node_modules/.bin/posterly` from that folder, not as a global terminal command.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
5
36
|
```bash
|
|
6
37
|
posterly auth:login
|
|
7
38
|
posterly auth:key pst_live_your_key_here
|
|
@@ -27,7 +58,8 @@ posterly gbp:reply --account-id 123 --review-name accounts/123/locations/456/rev
|
|
|
27
58
|
```
|
|
28
59
|
|
|
29
60
|
The CLI outputs JSON by default so it can be piped into `jq` or other tools. Use
|
|
30
|
-
`--pretty` for formatted output.
|
|
61
|
+
`--pretty` for formatted output. `--human` is accepted as an alias for
|
|
62
|
+
`--pretty` for older examples.
|
|
31
63
|
|
|
32
64
|
Authentication order:
|
|
33
65
|
|
package/bin/posterly.mjs
CHANGED
|
@@ -55,7 +55,7 @@ async function main() {
|
|
|
55
55
|
posterly: 'CLI for the posterly API',
|
|
56
56
|
usage: 'posterly <command> [--flag value]',
|
|
57
57
|
commands: COMMANDS,
|
|
58
|
-
auth: 'Run `posterly auth:login
|
|
58
|
+
auth: 'Run `npx @posterly/cli@latest auth:login` for the no-install flow, `posterly auth:login` after global install, `posterly auth:key pst_live_...`, or set POSTERLY_API_KEY.',
|
|
59
59
|
}, flags);
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -358,6 +358,10 @@ function parseArgs(args) {
|
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
if (flags.human && flags.pretty === undefined) {
|
|
362
|
+
flags.pretty = true;
|
|
363
|
+
}
|
|
364
|
+
|
|
361
365
|
return { command, flags, positional };
|
|
362
366
|
}
|
|
363
367
|
|
|
@@ -365,7 +369,7 @@ async function createClient(flags) {
|
|
|
365
369
|
const config = await readConfig();
|
|
366
370
|
const apiKey = flags.apiKey || process.env.POSTERLY_API_KEY || config.apiKey;
|
|
367
371
|
const baseUrl = normalizeBaseUrl(flags.url || process.env.POSTERLY_URL || config.baseUrl || DEFAULT_BASE_URL);
|
|
368
|
-
if (!apiKey) throw new Error('Missing API key. Run `posterly auth:key pst_live_
|
|
372
|
+
if (!apiKey) throw new Error('Missing API key. Run `npx @posterly/cli@latest auth:login`, `posterly auth:key pst_live_...`, or set POSTERLY_API_KEY.');
|
|
369
373
|
|
|
370
374
|
async function request(method, path, body) {
|
|
371
375
|
const res = await fetch(`${baseUrl}/api/v1${path}`, {
|
|
@@ -400,7 +404,7 @@ async function createClient(flags) {
|
|
|
400
404
|
|
|
401
405
|
async function saveKey(key, flags) {
|
|
402
406
|
const apiKey = key || flags.apiKey || process.env.POSTERLY_API_KEY;
|
|
403
|
-
if (!apiKey) throw new Error('Pass an API key: posterly auth:key pst_live_...');
|
|
407
|
+
if (!apiKey) throw new Error('Pass an API key: posterly auth:key pst_live_... or npx @posterly/cli@latest auth:key pst_live_...');
|
|
404
408
|
await mkdir(CONFIG_DIR, { recursive: true });
|
|
405
409
|
const config = {
|
|
406
410
|
apiKey,
|
|
@@ -131,6 +131,7 @@ export const PLATFORM_MANIFEST = Object.freeze({
|
|
|
131
131
|
],
|
|
132
132
|
"analyticsPlatformIds": [
|
|
133
133
|
"instagram",
|
|
134
|
+
"facebook",
|
|
134
135
|
"linkedin",
|
|
135
136
|
"youtube",
|
|
136
137
|
"pinterest",
|
|
@@ -268,7 +269,7 @@ export const PLATFORM_MANIFEST = Object.freeze({
|
|
|
268
269
|
"story",
|
|
269
270
|
"cover_photo"
|
|
270
271
|
],
|
|
271
|
-
"analyticsSupported":
|
|
272
|
+
"analyticsSupported": true,
|
|
272
273
|
"helpers": []
|
|
273
274
|
},
|
|
274
275
|
{
|
|
@@ -692,4 +693,4 @@ export const ALL_PLATFORM_INPUTS = Object.freeze(["bluesky","devto","discord","f
|
|
|
692
693
|
export const PLATFORM_HELPER_NAMES = Object.freeze(["linkedin.recent_mentions","pinterest.boards","tiktok.creator_info","x.quota","youtube.playlists"]);
|
|
693
694
|
export const CONNECT_TARGET_IDS = Object.freeze(["instagram","meta","facebook","youtube","tiktok","linkedin","linkedin_page","threads","google_business","pinterest","twitter","telegram","bluesky","reddit","wordpress","mastodon","medium","devto","hashnode","discord","slack","skool","whop"]);
|
|
694
695
|
export const CONNECT_INPUTS = Object.freeze(["bluesky","devto","discord","facebook","facebook_instagram","facebook_pages","gmb","google-business","google_business","google_business_profile","hashnode","instagram","instagram-standalone","instagram_direct","linkedin","linkedin-company","linkedin-page","linkedin_company","linkedin_page","linkedin_personal","mastodon","medium","meta","meta_business","pinterest","reddit","skool","slack","telegram","threads","tiktok","twitter","whop","wordpress","x","x_twitter","youtube"]);
|
|
695
|
-
export const ANALYTICS_PLATFORM_IDS = Object.freeze(["instagram","linkedin","youtube","pinterest","google_business"]);
|
|
696
|
+
export const ANALYTICS_PLATFORM_IDS = Object.freeze(["instagram","facebook","linkedin","youtube","pinterest","google_business"]);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posterly/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Command line interface for the posterly API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
|
-
"posterly": "
|
|
8
|
+
"posterly": "bin/posterly.mjs"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=20"
|