@autoposting.ai/cli 0.4.0 → 0.5.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/dist/cli.cjs +197 -70
- package/dist/cli.cjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -75,11 +75,64 @@ async function putPart(url, body) {
|
|
|
75
75
|
}
|
|
76
76
|
return etag;
|
|
77
77
|
}
|
|
78
|
-
var VERSION, AutopostingError, AuthenticationError, ScopeError, NotFoundError, ValidationError, RateLimitError, ServerError,
|
|
78
|
+
var Resource, segment, AccountOnboardingResource, VERSION, AutopostingError, AuthenticationError, ScopeError, NotFoundError, ValidationError, RateLimitError, ServerError, MediaResource, AgentsResource, BillingResource, BrandsResource, CarouselsResource, MIN_PART_SIZE, DEFAULT_PART_SIZE, MAX_PARTS, VIDEO_MIME, ClipsResource, PostsResource, KbResource, IdeasResource, UsageResource, WebhooksResource, WorkspacesResource, IDEMPOTENT_METHODS, RETRYABLE_STATUS, sleep, Autoposting;
|
|
79
79
|
var init_dist = __esm({
|
|
80
80
|
"../sdk/dist/index.mjs"() {
|
|
81
81
|
"use strict";
|
|
82
|
-
|
|
82
|
+
Resource = class {
|
|
83
|
+
constructor(client) {
|
|
84
|
+
this.client = client;
|
|
85
|
+
}
|
|
86
|
+
client;
|
|
87
|
+
get(path3, query) {
|
|
88
|
+
return this.client.request("GET", path3, void 0, query);
|
|
89
|
+
}
|
|
90
|
+
post(path3, body) {
|
|
91
|
+
return this.client.request("POST", path3, body);
|
|
92
|
+
}
|
|
93
|
+
put(path3, body) {
|
|
94
|
+
return this.client.request("PUT", path3, body);
|
|
95
|
+
}
|
|
96
|
+
patch(path3, body) {
|
|
97
|
+
return this.client.request("PATCH", path3, body);
|
|
98
|
+
}
|
|
99
|
+
delete(path3) {
|
|
100
|
+
return this.client.request("DELETE", path3);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
segment = (value) => {
|
|
104
|
+
if (!/^[a-f0-9]{24}$/.test(value))
|
|
105
|
+
throw new Error(
|
|
106
|
+
"Import and row identifiers must be 24-character hexadecimal strings"
|
|
107
|
+
);
|
|
108
|
+
return value;
|
|
109
|
+
};
|
|
110
|
+
AccountOnboardingResource = class extends Resource {
|
|
111
|
+
remove(id) {
|
|
112
|
+
return this.delete(`/account-onboarding/${segment(id)}`);
|
|
113
|
+
}
|
|
114
|
+
create(input) {
|
|
115
|
+
return this.post("/account-onboarding", input);
|
|
116
|
+
}
|
|
117
|
+
status(id, query) {
|
|
118
|
+
return this.get(`/account-onboarding/${segment(id)}`, query);
|
|
119
|
+
}
|
|
120
|
+
prepare(id, offset = 0) {
|
|
121
|
+
return this.post(`/account-onboarding/${segment(id)}/prepare`, { offset });
|
|
122
|
+
}
|
|
123
|
+
authorize(id, rowId) {
|
|
124
|
+
return this.post(
|
|
125
|
+
`/account-onboarding/${segment(id)}/rows/${segment(rowId)}/authorize`
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
confirm(id, rowId, tokenId) {
|
|
129
|
+
return this.post(
|
|
130
|
+
`/account-onboarding/${segment(id)}/rows/${segment(rowId)}/confirm`,
|
|
131
|
+
{ tokenId: segment(tokenId) }
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
VERSION = "0.5.0";
|
|
83
136
|
AutopostingError = class extends Error {
|
|
84
137
|
status;
|
|
85
138
|
code;
|
|
@@ -104,27 +157,6 @@ var init_dist = __esm({
|
|
|
104
157
|
};
|
|
105
158
|
ServerError = class extends AutopostingError {
|
|
106
159
|
};
|
|
107
|
-
Resource = class {
|
|
108
|
-
constructor(client) {
|
|
109
|
-
this.client = client;
|
|
110
|
-
}
|
|
111
|
-
client;
|
|
112
|
-
get(path3, query) {
|
|
113
|
-
return this.client.request("GET", path3, void 0, query);
|
|
114
|
-
}
|
|
115
|
-
post(path3, body) {
|
|
116
|
-
return this.client.request("POST", path3, body);
|
|
117
|
-
}
|
|
118
|
-
put(path3, body) {
|
|
119
|
-
return this.client.request("PUT", path3, body);
|
|
120
|
-
}
|
|
121
|
-
patch(path3, body) {
|
|
122
|
-
return this.client.request("PATCH", path3, body);
|
|
123
|
-
}
|
|
124
|
-
delete(path3) {
|
|
125
|
-
return this.client.request("DELETE", path3);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
160
|
MediaResource = class extends Resource {
|
|
129
161
|
/** POST /media/upload — multipart/form-data, ≤20MB, image/* | video/*. */
|
|
130
162
|
upload(file) {
|
|
@@ -479,6 +511,7 @@ var init_dist = __esm({
|
|
|
479
511
|
media;
|
|
480
512
|
agents;
|
|
481
513
|
billing;
|
|
514
|
+
accountOnboarding;
|
|
482
515
|
brands;
|
|
483
516
|
carousels;
|
|
484
517
|
clips;
|
|
@@ -505,6 +538,7 @@ var init_dist = __esm({
|
|
|
505
538
|
this.media = new MediaResource(this);
|
|
506
539
|
this.agents = new AgentsResource(this);
|
|
507
540
|
this.billing = new BillingResource(this);
|
|
541
|
+
this.accountOnboarding = new AccountOnboardingResource(this);
|
|
508
542
|
this.brands = new BrandsResource(this);
|
|
509
543
|
this.carousels = new CarouselsResource(this);
|
|
510
544
|
this.clips = new ClipsResource(this);
|
|
@@ -809,6 +843,12 @@ var init_tools = __esm({
|
|
|
809
843
|
}
|
|
810
844
|
};
|
|
811
845
|
ALL_TOOLS = [
|
|
846
|
+
{ name: "delete-account-import", description: "Delete import progress only. Connected accounts and brands remain. Ask the user before discarding their progress.", inputSchema: { type: "object", properties: { id: { type: "string", description: "Import id" } }, required: ["id"] } },
|
|
847
|
+
{ name: "import-accounts", description: "Import 1\u20131000 social account rows from CSV. Headers: brand_name, platform, account_url; optional brand_slug, timezone, account_type. Returns a durable import id. Repeating the same import reuses progress. No passwords or provider tokens.", inputSchema: { type: "object", properties: { csv: { type: "string", maxLength: 9e4, description: "CSV contents, including header row" } }, required: ["csv"] } },
|
|
848
|
+
{ name: "prepare-account-import", description: "Create or reuse up to 25 brands. Repeat with nextOffset until null; safe to resume.", inputSchema: { type: "object", properties: { id: { type: "string", description: "Import id" }, offset: { type: "integer", minimum: 0, description: "Next row offset; default 0" } }, required: ["id"] } },
|
|
849
|
+
{ name: "account-import-status", description: "Check actual imported account connections and plan capacity. A link alone is not a connection. Vanity URLs may need explicit account confirmation.", inputSchema: { type: "object", properties: { id: { type: "string", description: "Import id" }, offset: { type: "integer", minimum: 0, description: "Row offset; default 0" }, limit: { type: "integer", minimum: 1, maximum: 100, description: "Rows per page; default 50" } }, required: ["id"] } },
|
|
850
|
+
{ name: "authorize-import-account", description: "Generate a fresh provider approval link for one row. Present it to the user, who opens it in their browser and approves the intended account. Then check status. Links expire after 10 minutes.", inputSchema: { type: "object", properties: { id: { type: "string", description: "Import id" }, rowId: { type: "string", description: "Row id from status" } }, required: ["id", "rowId"] } },
|
|
851
|
+
{ name: "confirm-import-account", description: "For needs_confirmation rows ONLY: show the actual account id/name and CSV URL to the user. Call only after the user explicitly confirms they match. tokenId must come from status; this never creates a connection.", inputSchema: { type: "object", properties: { id: { type: "string", description: "Import id" }, rowId: { type: "string", description: "Row id" }, tokenId: { type: "string", description: "User-confirmed tokenId from status" } }, required: ["id", "rowId", "tokenId"] } },
|
|
812
852
|
// Posts
|
|
813
853
|
{
|
|
814
854
|
name: "list-posts",
|
|
@@ -1166,9 +1206,10 @@ var init_tools = __esm({
|
|
|
1166
1206
|
inputSchema: {
|
|
1167
1207
|
type: "object",
|
|
1168
1208
|
properties: {
|
|
1169
|
-
name: { type: "string", description: "Knowledge base name" }
|
|
1209
|
+
name: { type: "string", minLength: 4, maxLength: 20, description: "Knowledge base name" },
|
|
1210
|
+
description: { type: "string", minLength: 20, maxLength: 500, description: "Knowledge base description" }
|
|
1170
1211
|
},
|
|
1171
|
-
required: ["name"],
|
|
1212
|
+
required: ["name", "description"],
|
|
1172
1213
|
additionalProperties: false
|
|
1173
1214
|
}
|
|
1174
1215
|
},
|
|
@@ -1687,6 +1728,18 @@ async function handleToolCall(name, args, client) {
|
|
|
1687
1728
|
}
|
|
1688
1729
|
async function dispatchToolCall(name, args, client) {
|
|
1689
1730
|
switch (name) {
|
|
1731
|
+
case "delete-account-import":
|
|
1732
|
+
return ok(await client.accountOnboarding.remove(args.id));
|
|
1733
|
+
case "import-accounts":
|
|
1734
|
+
return ok(await client.accountOnboarding.create({ csv: args.csv }));
|
|
1735
|
+
case "prepare-account-import":
|
|
1736
|
+
return ok(await client.accountOnboarding.prepare(args.id, args.offset));
|
|
1737
|
+
case "account-import-status":
|
|
1738
|
+
return ok(await client.accountOnboarding.status(args.id, { ...args.offset !== void 0 ? { offset: args.offset } : {}, ...args.limit !== void 0 ? { limit: args.limit } : {} }));
|
|
1739
|
+
case "authorize-import-account":
|
|
1740
|
+
return ok(await client.accountOnboarding.authorize(args.id, args.rowId));
|
|
1741
|
+
case "confirm-import-account":
|
|
1742
|
+
return ok(await client.accountOnboarding.confirm(args.id, args.rowId, args.tokenId));
|
|
1690
1743
|
// Posts
|
|
1691
1744
|
case "list-posts": {
|
|
1692
1745
|
const result = await client.posts.list({
|
|
@@ -1838,7 +1891,7 @@ async function dispatchToolCall(name, args, client) {
|
|
|
1838
1891
|
return ok(result);
|
|
1839
1892
|
}
|
|
1840
1893
|
case "create-kb": {
|
|
1841
|
-
const result = await client.kb.create({ name: args.name });
|
|
1894
|
+
const result = await client.kb.create({ name: args.name, description: args.description });
|
|
1842
1895
|
return ok(result);
|
|
1843
1896
|
}
|
|
1844
1897
|
case "delete-kb": {
|
|
@@ -2013,7 +2066,7 @@ async function dispatchToolCall(name, args, client) {
|
|
|
2013
2066
|
const filePath = args.filePath;
|
|
2014
2067
|
const filename = (0, import_node_path4.basename)(filePath);
|
|
2015
2068
|
const uploaded = await client.media.upload({
|
|
2016
|
-
data: new Uint8Array(await (0,
|
|
2069
|
+
data: new Uint8Array(await (0, import_promises3.readFile)(filePath)),
|
|
2017
2070
|
filename,
|
|
2018
2071
|
contentType: extToMime(filename)
|
|
2019
2072
|
});
|
|
@@ -2054,11 +2107,11 @@ async function dispatchToolCall(name, args, client) {
|
|
|
2054
2107
|
};
|
|
2055
2108
|
}
|
|
2056
2109
|
}
|
|
2057
|
-
var
|
|
2110
|
+
var import_promises3, import_node_path4, PLATFORMS, PLATFORM_SET, routeCache;
|
|
2058
2111
|
var init_handler = __esm({
|
|
2059
2112
|
"src/mcp/handler.ts"() {
|
|
2060
2113
|
"use strict";
|
|
2061
|
-
|
|
2114
|
+
import_promises3 = require("fs/promises");
|
|
2062
2115
|
import_node_path4 = require("path");
|
|
2063
2116
|
init_api_routes();
|
|
2064
2117
|
init_media_flags();
|
|
@@ -2109,7 +2162,7 @@ var init_server = __esm({
|
|
|
2109
2162
|
});
|
|
2110
2163
|
|
|
2111
2164
|
// src/cli.ts
|
|
2112
|
-
var
|
|
2165
|
+
var import_commander22 = require("commander");
|
|
2113
2166
|
init_dist();
|
|
2114
2167
|
|
|
2115
2168
|
// src/commands/agents.ts
|
|
@@ -2910,8 +2963,80 @@ function createBillingCommand() {
|
|
|
2910
2963
|
return billing;
|
|
2911
2964
|
}
|
|
2912
2965
|
|
|
2913
|
-
// src/commands/
|
|
2966
|
+
// src/commands/accounts.ts
|
|
2914
2967
|
var import_commander4 = require("commander");
|
|
2968
|
+
var import_promises = require("fs/promises");
|
|
2969
|
+
init_dist();
|
|
2970
|
+
async function run(cmd, action) {
|
|
2971
|
+
const globals = cmd.optsWithGlobals();
|
|
2972
|
+
const printer = createPrinter(globals);
|
|
2973
|
+
try {
|
|
2974
|
+
const cred = resolveAuth({ apiKey: globals.apiKey });
|
|
2975
|
+
printer.log(await action(new Autoposting({ apiKey: cred.apiKey })));
|
|
2976
|
+
} catch (err) {
|
|
2977
|
+
printer.error(err);
|
|
2978
|
+
process.exitCode = exitCodeFromError(err);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
function createAccountsCommand() {
|
|
2982
|
+
const command = new import_commander4.Command("accounts").description(
|
|
2983
|
+
"Import account CSVs and connect through browser approval; progress lives in the workspace"
|
|
2984
|
+
);
|
|
2985
|
+
command.command("import").requiredOption(
|
|
2986
|
+
"--from <csv>",
|
|
2987
|
+
"CSV with brand_name,platform,account_url; optional brand_slug,timezone"
|
|
2988
|
+
).action(
|
|
2989
|
+
async (opts, cmd) => run(
|
|
2990
|
+
cmd,
|
|
2991
|
+
async (client) => client.accountOnboarding.create({
|
|
2992
|
+
csv: await (0, import_promises.readFile)(opts.from, "utf8")
|
|
2993
|
+
})
|
|
2994
|
+
)
|
|
2995
|
+
);
|
|
2996
|
+
command.command("prepare <importId>").option("--offset <number>", "Resume at this row offset", "0").description(
|
|
2997
|
+
"Create/reuse the next 25 brands; repeat with nextOffset until null"
|
|
2998
|
+
).action(
|
|
2999
|
+
async (id, opts, cmd) => run(cmd, async (client) => {
|
|
3000
|
+
const offset = Number(opts.offset);
|
|
3001
|
+
if (!Number.isInteger(offset) || offset < 0)
|
|
3002
|
+
throw new Error("offset must be a nonnegative integer");
|
|
3003
|
+
return client.accountOnboarding.prepare(id, offset);
|
|
3004
|
+
})
|
|
3005
|
+
);
|
|
3006
|
+
command.command("status <importId>").option("--offset <number>", "Row offset", "0").option("--limit <number>", "Rows per page (1\u2013100)", "50").description("Show connected, pending, reconnect and confirmation rows").action(
|
|
3007
|
+
async (id, opts, cmd) => run(
|
|
3008
|
+
cmd,
|
|
3009
|
+
(client) => client.accountOnboarding.status(id, {
|
|
3010
|
+
offset: Number(opts.offset),
|
|
3011
|
+
limit: Number(opts.limit)
|
|
3012
|
+
})
|
|
3013
|
+
)
|
|
3014
|
+
);
|
|
3015
|
+
command.command("authorize <importId> <rowId>").description(
|
|
3016
|
+
"Print a fresh approval link. Open it in your browser, select the CSV account, then check status"
|
|
3017
|
+
).action(
|
|
3018
|
+
async (id, rowId, _opts, cmd) => run(cmd, (client) => client.accountOnboarding.authorize(id, rowId))
|
|
3019
|
+
);
|
|
3020
|
+
command.command("confirm <importId> <rowId>").requiredOption(
|
|
3021
|
+
"--token-id <id>",
|
|
3022
|
+
"Actual account tokenId from status; confirm only after comparing it with the CSV account"
|
|
3023
|
+
).action(
|
|
3024
|
+
async (id, rowId, opts, cmd) => run(
|
|
3025
|
+
cmd,
|
|
3026
|
+
(client) => client.accountOnboarding.confirm(id, rowId, opts.tokenId)
|
|
3027
|
+
)
|
|
3028
|
+
);
|
|
3029
|
+
command.command("delete <importId>").requiredOption(
|
|
3030
|
+
"--force",
|
|
3031
|
+
"Discard import progress; keeps brands and connected accounts"
|
|
3032
|
+
).action(
|
|
3033
|
+
async (id, _opts, cmd) => run(cmd, (client) => client.accountOnboarding.remove(id))
|
|
3034
|
+
);
|
|
3035
|
+
return command;
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
// src/commands/brands.ts
|
|
3039
|
+
var import_commander5 = require("commander");
|
|
2915
3040
|
init_dist();
|
|
2916
3041
|
init_media_flags();
|
|
2917
3042
|
|
|
@@ -3003,7 +3128,7 @@ function buildAuthStatusRow(c, now = Date.now()) {
|
|
|
3003
3128
|
};
|
|
3004
3129
|
}
|
|
3005
3130
|
function createBrandsCommand() {
|
|
3006
|
-
const brands = new
|
|
3131
|
+
const brands = new import_commander5.Command("brands").description("Manage brands");
|
|
3007
3132
|
brands.command("list").description("List all brands").action(async (_opts, cmd) => {
|
|
3008
3133
|
const globals = cmd.optsWithGlobals();
|
|
3009
3134
|
const printer = createPrinter(globals);
|
|
@@ -3143,7 +3268,7 @@ function createBrandsCommand() {
|
|
|
3143
3268
|
}
|
|
3144
3269
|
|
|
3145
3270
|
// src/commands/carousels.ts
|
|
3146
|
-
var
|
|
3271
|
+
var import_commander6 = require("commander");
|
|
3147
3272
|
init_dist();
|
|
3148
3273
|
function resolveExitCode3(err) {
|
|
3149
3274
|
const attached = err.exitCode;
|
|
@@ -3151,7 +3276,7 @@ function resolveExitCode3(err) {
|
|
|
3151
3276
|
return exitCodeFromError(err);
|
|
3152
3277
|
}
|
|
3153
3278
|
function createCarouselsCommand() {
|
|
3154
|
-
const carousels = new
|
|
3279
|
+
const carousels = new import_commander6.Command("carousels").description("Manage carousels");
|
|
3155
3280
|
carousels.command("list").description("List all carousels").action(async (_opts, cmd) => {
|
|
3156
3281
|
const globals = cmd.optsWithGlobals();
|
|
3157
3282
|
const printer = createPrinter(globals);
|
|
@@ -3269,7 +3394,7 @@ function createCarouselsCommand() {
|
|
|
3269
3394
|
}
|
|
3270
3395
|
|
|
3271
3396
|
// src/commands/clips.ts
|
|
3272
|
-
var
|
|
3397
|
+
var import_commander7 = require("commander");
|
|
3273
3398
|
init_dist();
|
|
3274
3399
|
function resolveExitCode4(err) {
|
|
3275
3400
|
const attached = err.exitCode;
|
|
@@ -3288,7 +3413,7 @@ async function resolveBrandId(client, explicit) {
|
|
|
3288
3413
|
);
|
|
3289
3414
|
}
|
|
3290
3415
|
function createClipsCommand() {
|
|
3291
|
-
const clips = new
|
|
3416
|
+
const clips = new import_commander7.Command("clips").description("Manage video clips");
|
|
3292
3417
|
clips.command("list").description("List all clips").action(async (_opts, cmd) => {
|
|
3293
3418
|
const globals = cmd.optsWithGlobals();
|
|
3294
3419
|
const printer = createPrinter(globals);
|
|
@@ -3433,11 +3558,11 @@ function createClipsCommand() {
|
|
|
3433
3558
|
}
|
|
3434
3559
|
|
|
3435
3560
|
// src/commands/posts.ts
|
|
3436
|
-
var
|
|
3561
|
+
var import_commander8 = require("commander");
|
|
3437
3562
|
init_dist();
|
|
3438
3563
|
|
|
3439
3564
|
// src/lib/post-create.ts
|
|
3440
|
-
var
|
|
3565
|
+
var import_promises2 = __toESM(require("fs/promises"));
|
|
3441
3566
|
var import_node_path3 = __toESM(require("path"));
|
|
3442
3567
|
init_media_flags();
|
|
3443
3568
|
|
|
@@ -3660,7 +3785,7 @@ async function buildAndCreatePost(client, fields, opts) {
|
|
|
3660
3785
|
const mediaInputs = [];
|
|
3661
3786
|
for (let i = 0; i < (fields.media ?? []).length; i++) {
|
|
3662
3787
|
const filePath = fields.media[i];
|
|
3663
|
-
const data = await
|
|
3788
|
+
const data = await import_promises2.default.readFile(filePath);
|
|
3664
3789
|
const filename = import_node_path3.default.basename(filePath);
|
|
3665
3790
|
const uploaded = await client.media.upload({
|
|
3666
3791
|
data: new Uint8Array(data),
|
|
@@ -3677,7 +3802,7 @@ async function buildAndCreatePost(client, fields, opts) {
|
|
|
3677
3802
|
for (const [p, paths] of Object.entries(platformMediaPaths)) {
|
|
3678
3803
|
const uploads = [];
|
|
3679
3804
|
for (const filePath of paths) {
|
|
3680
|
-
const data = await
|
|
3805
|
+
const data = await import_promises2.default.readFile(filePath);
|
|
3681
3806
|
const filename = import_node_path3.default.basename(filePath);
|
|
3682
3807
|
const uploaded = await client.media.upload({
|
|
3683
3808
|
data: new Uint8Array(data),
|
|
@@ -3814,7 +3939,7 @@ function resolveExitCode5(err) {
|
|
|
3814
3939
|
return exitCodeFromError(err);
|
|
3815
3940
|
}
|
|
3816
3941
|
function createPostsCommand() {
|
|
3817
|
-
const posts = new
|
|
3942
|
+
const posts = new import_commander8.Command("posts").description("Manage posts");
|
|
3818
3943
|
posts.command("list").description("List posts").option("--brand <slug>", "Filter by brand slug (defaults to the saved context)").option("--status <status>", "Filter by status (draft|scheduled|published|failed)").option("--limit <n>", "Max results per page", "20").option("--page <n>", "Page number", "1").action(async (opts, cmd) => {
|
|
3819
3944
|
const globals = cmd.optsWithGlobals();
|
|
3820
3945
|
const printer = createPrinter(globals);
|
|
@@ -4066,7 +4191,7 @@ function createPostsCommand() {
|
|
|
4066
4191
|
}
|
|
4067
4192
|
|
|
4068
4193
|
// src/commands/kb.ts
|
|
4069
|
-
var
|
|
4194
|
+
var import_commander9 = require("commander");
|
|
4070
4195
|
init_dist();
|
|
4071
4196
|
function resolveExitCode6(err) {
|
|
4072
4197
|
const attached = err.exitCode;
|
|
@@ -4074,7 +4199,7 @@ function resolveExitCode6(err) {
|
|
|
4074
4199
|
return exitCodeFromError(err);
|
|
4075
4200
|
}
|
|
4076
4201
|
function createKbCommand() {
|
|
4077
|
-
const kb = new
|
|
4202
|
+
const kb = new import_commander9.Command("kb").description("Manage knowledge bases");
|
|
4078
4203
|
kb.command("list").description("List all knowledge bases").action(async (_opts, cmd) => {
|
|
4079
4204
|
const globals = cmd.optsWithGlobals();
|
|
4080
4205
|
const printer = createPrinter(globals);
|
|
@@ -4113,14 +4238,14 @@ function createKbCommand() {
|
|
|
4113
4238
|
process.exit(resolveExitCode6(err));
|
|
4114
4239
|
}
|
|
4115
4240
|
});
|
|
4116
|
-
kb.command("create").description("Create a new knowledge base").requiredOption("--name <name>", "Knowledge base name").action(async (opts, cmd) => {
|
|
4241
|
+
kb.command("create").description("Create a new knowledge base").requiredOption("--name <name>", "Knowledge base name").requiredOption("--description <description>", "Knowledge base description (20\u2013500 characters)").action(async (opts, cmd) => {
|
|
4117
4242
|
const globals = cmd.optsWithGlobals();
|
|
4118
4243
|
const printer = createPrinter(globals);
|
|
4119
4244
|
const spinner = printer.spinner("Creating knowledge base\u2026");
|
|
4120
4245
|
try {
|
|
4121
4246
|
const cred = resolveAuth({ apiKey: globals.apiKey });
|
|
4122
4247
|
const client = new Autoposting({ apiKey: cred.apiKey });
|
|
4123
|
-
const result = await client.kb.create({ name: opts.name });
|
|
4248
|
+
const result = await client.kb.create({ name: opts.name, description: opts.description });
|
|
4124
4249
|
spinner.stop();
|
|
4125
4250
|
printer.log(result);
|
|
4126
4251
|
} catch (err) {
|
|
@@ -4214,7 +4339,7 @@ function createKbCommand() {
|
|
|
4214
4339
|
}
|
|
4215
4340
|
|
|
4216
4341
|
// src/commands/ideas.ts
|
|
4217
|
-
var
|
|
4342
|
+
var import_commander10 = require("commander");
|
|
4218
4343
|
init_dist();
|
|
4219
4344
|
function resolveExitCode7(err) {
|
|
4220
4345
|
const attached = err.exitCode;
|
|
@@ -4239,7 +4364,7 @@ function parseIdeaPlatforms(raw) {
|
|
|
4239
4364
|
return parts.map((platform) => ({ platform }));
|
|
4240
4365
|
}
|
|
4241
4366
|
function createIdeasCommand() {
|
|
4242
|
-
const ideas = new
|
|
4367
|
+
const ideas = new import_commander10.Command("ideas").description("Manage content ideas");
|
|
4243
4368
|
ideas.command("generate").description("Generate content ideas").option("--kb <id>", "Knowledge base ID to draw context from").option("--topic <text>", "Topic or theme for ideas").option("--count <n>", "Number of ideas to generate", "5").action(async (opts, cmd) => {
|
|
4244
4369
|
const globals = cmd.optsWithGlobals();
|
|
4245
4370
|
const printer = createPrinter(globals);
|
|
@@ -4336,7 +4461,7 @@ function createIdeasCommand() {
|
|
|
4336
4461
|
}
|
|
4337
4462
|
|
|
4338
4463
|
// src/commands/usage.ts
|
|
4339
|
-
var
|
|
4464
|
+
var import_commander11 = require("commander");
|
|
4340
4465
|
init_dist();
|
|
4341
4466
|
function resolveExitCode8(err) {
|
|
4342
4467
|
const attached = err.exitCode;
|
|
@@ -4344,7 +4469,7 @@ function resolveExitCode8(err) {
|
|
|
4344
4469
|
return exitCodeFromError(err);
|
|
4345
4470
|
}
|
|
4346
4471
|
function createUsageCommand() {
|
|
4347
|
-
const usage = new
|
|
4472
|
+
const usage = new import_commander11.Command("usage").description("View usage statistics");
|
|
4348
4473
|
usage.command("summary").description("Show usage summary for the current period").action(async (_opts, cmd) => {
|
|
4349
4474
|
const globals = cmd.optsWithGlobals();
|
|
4350
4475
|
const printer = createPrinter(globals);
|
|
@@ -4383,7 +4508,7 @@ function createUsageCommand() {
|
|
|
4383
4508
|
}
|
|
4384
4509
|
|
|
4385
4510
|
// src/commands/webhooks.ts
|
|
4386
|
-
var
|
|
4511
|
+
var import_commander12 = require("commander");
|
|
4387
4512
|
init_dist();
|
|
4388
4513
|
function resolveExitCode9(err) {
|
|
4389
4514
|
const attached = err.exitCode;
|
|
@@ -4391,7 +4516,7 @@ function resolveExitCode9(err) {
|
|
|
4391
4516
|
return exitCodeFromError(err);
|
|
4392
4517
|
}
|
|
4393
4518
|
function createWebhooksCommand() {
|
|
4394
|
-
const webhooks = new
|
|
4519
|
+
const webhooks = new import_commander12.Command("webhooks").description("Manage webhooks");
|
|
4395
4520
|
webhooks.command("list").description("List all webhooks").action(async (_opts, cmd) => {
|
|
4396
4521
|
const globals = cmd.optsWithGlobals();
|
|
4397
4522
|
const printer = createPrinter(globals);
|
|
@@ -4517,7 +4642,7 @@ function createWebhooksCommand() {
|
|
|
4517
4642
|
}
|
|
4518
4643
|
|
|
4519
4644
|
// src/commands/workspaces.ts
|
|
4520
|
-
var
|
|
4645
|
+
var import_commander13 = require("commander");
|
|
4521
4646
|
init_dist();
|
|
4522
4647
|
function resolveExitCode10(err) {
|
|
4523
4648
|
const attached = err.exitCode;
|
|
@@ -4525,7 +4650,7 @@ function resolveExitCode10(err) {
|
|
|
4525
4650
|
return exitCodeFromError(err);
|
|
4526
4651
|
}
|
|
4527
4652
|
function createWorkspacesCommand() {
|
|
4528
|
-
const workspaces = new
|
|
4653
|
+
const workspaces = new import_commander13.Command("workspaces").description("Manage workspaces");
|
|
4529
4654
|
workspaces.command("list").description("List all workspaces").action(async (_opts, cmd) => {
|
|
4530
4655
|
const globals = cmd.optsWithGlobals();
|
|
4531
4656
|
const printer = createPrinter(globals);
|
|
@@ -4569,7 +4694,7 @@ function createWorkspacesCommand() {
|
|
|
4569
4694
|
}
|
|
4570
4695
|
|
|
4571
4696
|
// src/commands/doctor.ts
|
|
4572
|
-
var
|
|
4697
|
+
var import_commander14 = require("commander");
|
|
4573
4698
|
init_dist();
|
|
4574
4699
|
var import_node_fs5 = __toESM(require("fs"));
|
|
4575
4700
|
var API_HEALTH_URL = "https://app.autoposting.ai/api-proxy/health";
|
|
@@ -4623,7 +4748,7 @@ async function runChecks() {
|
|
|
4623
4748
|
return results;
|
|
4624
4749
|
}
|
|
4625
4750
|
function createDoctorCommand() {
|
|
4626
|
-
const cmd = new
|
|
4751
|
+
const cmd = new import_commander14.Command("doctor").description("Run diagnostic checks on your CLI setup").option("--json", "Output results as JSON").action(async (_opts, cmd2) => {
|
|
4627
4752
|
const globals = cmd2.optsWithGlobals();
|
|
4628
4753
|
const results = await runChecks();
|
|
4629
4754
|
if (globals.json) {
|
|
@@ -4642,10 +4767,10 @@ function createDoctorCommand() {
|
|
|
4642
4767
|
}
|
|
4643
4768
|
|
|
4644
4769
|
// src/commands/whoami.ts
|
|
4645
|
-
var
|
|
4770
|
+
var import_commander15 = require("commander");
|
|
4646
4771
|
init_dist();
|
|
4647
4772
|
function createWhoamiCommand() {
|
|
4648
|
-
return new
|
|
4773
|
+
return new import_commander15.Command("whoami").description("Show the current identity and validate the key against the server").action(async (_opts, cmd) => {
|
|
4649
4774
|
const globals = cmd.optsWithGlobals();
|
|
4650
4775
|
let cred;
|
|
4651
4776
|
try {
|
|
@@ -4706,7 +4831,7 @@ function createWhoamiCommand() {
|
|
|
4706
4831
|
}
|
|
4707
4832
|
|
|
4708
4833
|
// src/commands/open.ts
|
|
4709
|
-
var
|
|
4834
|
+
var import_commander16 = require("commander");
|
|
4710
4835
|
var import_open = __toESM(require("open"));
|
|
4711
4836
|
var URLS = {
|
|
4712
4837
|
"": "https://app.autoposting.ai",
|
|
@@ -4718,7 +4843,7 @@ var URLS = {
|
|
|
4718
4843
|
};
|
|
4719
4844
|
var VALID_SECTIONS = Object.keys(URLS).filter((k) => k !== "");
|
|
4720
4845
|
function createOpenCommand() {
|
|
4721
|
-
return new
|
|
4846
|
+
return new import_commander16.Command("open").description(`Open the Autoposting dashboard in your browser. Sections: ${VALID_SECTIONS.join(", ")}`).argument("[section]", `Dashboard section to open (${VALID_SECTIONS.join("|")})`, "").option("--no-browser", "Print URL only, do not open browser").action(async (section, opts) => {
|
|
4722
4847
|
const key = section ?? "";
|
|
4723
4848
|
if (!(key in URLS)) {
|
|
4724
4849
|
console.error(`Error: unknown section "${key}". Valid sections: ${VALID_SECTIONS.join(", ")}`);
|
|
@@ -4741,12 +4866,12 @@ function createOpenCommand() {
|
|
|
4741
4866
|
}
|
|
4742
4867
|
|
|
4743
4868
|
// src/commands/update.ts
|
|
4744
|
-
var
|
|
4869
|
+
var import_commander17 = require("commander");
|
|
4745
4870
|
init_dist();
|
|
4746
4871
|
var import_node_child_process2 = require("child_process");
|
|
4747
4872
|
var REGISTRY_URL = "https://registry.npmjs.org/@autoposting.ai%2fcli/latest";
|
|
4748
4873
|
function createUpdateCommand() {
|
|
4749
|
-
return new
|
|
4874
|
+
return new import_commander17.Command("update").description(
|
|
4750
4875
|
"Check for a newer version of the CLI and optionally install it"
|
|
4751
4876
|
).option("--yes", "Install the latest version without prompting").action(async (opts) => {
|
|
4752
4877
|
let latest;
|
|
@@ -4791,10 +4916,11 @@ function createUpdateCommand() {
|
|
|
4791
4916
|
}
|
|
4792
4917
|
|
|
4793
4918
|
// src/commands/completion.ts
|
|
4794
|
-
var
|
|
4919
|
+
var import_commander18 = require("commander");
|
|
4795
4920
|
var ALL_COMMANDS = [
|
|
4796
4921
|
"posts",
|
|
4797
4922
|
"brands",
|
|
4923
|
+
"accounts",
|
|
4798
4924
|
"agents",
|
|
4799
4925
|
"kb",
|
|
4800
4926
|
"ideas",
|
|
@@ -4853,7 +4979,7 @@ Register-ArgumentCompleter -Native -CommandName @('ap', 'autoposting') -ScriptBl
|
|
|
4853
4979
|
`
|
|
4854
4980
|
};
|
|
4855
4981
|
function createCompletionCommand() {
|
|
4856
|
-
return new
|
|
4982
|
+
return new import_commander18.Command("completion").description(`Generate shell completion script. Shells: ${SHELLS.join(", ")}`).argument("<shell>", `Shell type (${SHELLS.join("|")})`).action((shell) => {
|
|
4857
4983
|
if (!SHELLS.includes(shell)) {
|
|
4858
4984
|
console.error(`Error: unsupported shell "${shell}". Supported: ${SHELLS.join(", ")}`);
|
|
4859
4985
|
process.exit(1);
|
|
@@ -4863,18 +4989,18 @@ function createCompletionCommand() {
|
|
|
4863
4989
|
}
|
|
4864
4990
|
|
|
4865
4991
|
// src/commands/mcp.ts
|
|
4866
|
-
var
|
|
4992
|
+
var import_commander19 = require("commander");
|
|
4867
4993
|
function createMcpCommand() {
|
|
4868
|
-
return new
|
|
4994
|
+
return new import_commander19.Command("mcp").description("Start MCP stdio server for AI agent integration").action(async () => {
|
|
4869
4995
|
const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
4870
4996
|
await startMcpServer2();
|
|
4871
4997
|
});
|
|
4872
4998
|
}
|
|
4873
4999
|
|
|
4874
5000
|
// src/commands/config.ts
|
|
4875
|
-
var
|
|
5001
|
+
var import_commander20 = require("commander");
|
|
4876
5002
|
function createConfigCommand() {
|
|
4877
|
-
const config = new
|
|
5003
|
+
const config = new import_commander20.Command("config").description("Manage CLI defaults (stored in config.json)");
|
|
4878
5004
|
config.command("set-context").description("Set the default brand used when --brand is omitted").requiredOption("--brand <slug>", "Brand slug to use as the default context").action((opts, cmd) => {
|
|
4879
5005
|
const printer = createPrinter(cmd.optsWithGlobals());
|
|
4880
5006
|
setContextBrand(opts.brand);
|
|
@@ -4898,7 +5024,7 @@ function createConfigCommand() {
|
|
|
4898
5024
|
}
|
|
4899
5025
|
|
|
4900
5026
|
// src/commands/api.ts
|
|
4901
|
-
var
|
|
5027
|
+
var import_commander21 = require("commander");
|
|
4902
5028
|
init_dist();
|
|
4903
5029
|
init_api_routes();
|
|
4904
5030
|
function validationError(message) {
|
|
@@ -4923,7 +5049,7 @@ function parseFields(pairs) {
|
|
|
4923
5049
|
return out;
|
|
4924
5050
|
}
|
|
4925
5051
|
function createApiCommand() {
|
|
4926
|
-
return new
|
|
5052
|
+
return new import_commander21.Command("api").description("Call any Autoposting REST route on the server allow-list, like `gh api`").argument("[method]", "GET, POST, PUT, PATCH or DELETE").argument("[path]", "Route path, e.g. /clips/abc123/jobs").option("-d, --data <json>", "JSON request body").option("-f, --field <key=value>", "Body field (repeatable)", collect, []).option("-q, --query <key=value>", "Query parameter (repeatable)", collect, []).option("--list [prefix]", "List the routes you may call").action(async (method, path3, opts, cmd) => {
|
|
4927
5053
|
const globals = cmd.optsWithGlobals();
|
|
4928
5054
|
const printer = createPrinter(globals);
|
|
4929
5055
|
try {
|
|
@@ -4963,12 +5089,13 @@ function createApiCommand() {
|
|
|
4963
5089
|
}
|
|
4964
5090
|
|
|
4965
5091
|
// src/cli.ts
|
|
4966
|
-
var program = new
|
|
5092
|
+
var program = new import_commander22.Command().name("autoposting").description("Autoposting CLI \u2014 manage social media from the terminal").version(VERSION).option("--json", "Output as JSON").option("--quiet", "Suppress spinners and non-essential output").option("--format <type>", "Output format: auto (table on a terminal, JSON when piped), table, json", "auto").option("--jq <expr>", 'Filter JSON output with a minimal jq expression (e.g. ".[].id")').option("--api-key <key>", "API key (overrides env/stored credentials)").option("--no-color", "Disable color output").hook("preAction", (thisCommand) => {
|
|
4967
5093
|
const opts = thisCommand.opts();
|
|
4968
5094
|
if (!opts.color) disableColor();
|
|
4969
5095
|
});
|
|
4970
5096
|
program.addCommand(createAuthCommand());
|
|
4971
5097
|
program.addCommand(createBillingCommand());
|
|
5098
|
+
program.addCommand(createAccountsCommand());
|
|
4972
5099
|
program.addCommand(createBrandsCommand());
|
|
4973
5100
|
program.addCommand(createCarouselsCommand());
|
|
4974
5101
|
program.addCommand(createClipsCommand());
|