@autoposting.ai/cli 0.4.1 → 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 +191 -65
- 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",
|
|
@@ -1688,6 +1728,18 @@ async function handleToolCall(name, args, client) {
|
|
|
1688
1728
|
}
|
|
1689
1729
|
async function dispatchToolCall(name, args, client) {
|
|
1690
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));
|
|
1691
1743
|
// Posts
|
|
1692
1744
|
case "list-posts": {
|
|
1693
1745
|
const result = await client.posts.list({
|
|
@@ -2014,7 +2066,7 @@ async function dispatchToolCall(name, args, client) {
|
|
|
2014
2066
|
const filePath = args.filePath;
|
|
2015
2067
|
const filename = (0, import_node_path4.basename)(filePath);
|
|
2016
2068
|
const uploaded = await client.media.upload({
|
|
2017
|
-
data: new Uint8Array(await (0,
|
|
2069
|
+
data: new Uint8Array(await (0, import_promises3.readFile)(filePath)),
|
|
2018
2070
|
filename,
|
|
2019
2071
|
contentType: extToMime(filename)
|
|
2020
2072
|
});
|
|
@@ -2055,11 +2107,11 @@ async function dispatchToolCall(name, args, client) {
|
|
|
2055
2107
|
};
|
|
2056
2108
|
}
|
|
2057
2109
|
}
|
|
2058
|
-
var
|
|
2110
|
+
var import_promises3, import_node_path4, PLATFORMS, PLATFORM_SET, routeCache;
|
|
2059
2111
|
var init_handler = __esm({
|
|
2060
2112
|
"src/mcp/handler.ts"() {
|
|
2061
2113
|
"use strict";
|
|
2062
|
-
|
|
2114
|
+
import_promises3 = require("fs/promises");
|
|
2063
2115
|
import_node_path4 = require("path");
|
|
2064
2116
|
init_api_routes();
|
|
2065
2117
|
init_media_flags();
|
|
@@ -2110,7 +2162,7 @@ var init_server = __esm({
|
|
|
2110
2162
|
});
|
|
2111
2163
|
|
|
2112
2164
|
// src/cli.ts
|
|
2113
|
-
var
|
|
2165
|
+
var import_commander22 = require("commander");
|
|
2114
2166
|
init_dist();
|
|
2115
2167
|
|
|
2116
2168
|
// src/commands/agents.ts
|
|
@@ -2911,8 +2963,80 @@ function createBillingCommand() {
|
|
|
2911
2963
|
return billing;
|
|
2912
2964
|
}
|
|
2913
2965
|
|
|
2914
|
-
// src/commands/
|
|
2966
|
+
// src/commands/accounts.ts
|
|
2915
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");
|
|
2916
3040
|
init_dist();
|
|
2917
3041
|
init_media_flags();
|
|
2918
3042
|
|
|
@@ -3004,7 +3128,7 @@ function buildAuthStatusRow(c, now = Date.now()) {
|
|
|
3004
3128
|
};
|
|
3005
3129
|
}
|
|
3006
3130
|
function createBrandsCommand() {
|
|
3007
|
-
const brands = new
|
|
3131
|
+
const brands = new import_commander5.Command("brands").description("Manage brands");
|
|
3008
3132
|
brands.command("list").description("List all brands").action(async (_opts, cmd) => {
|
|
3009
3133
|
const globals = cmd.optsWithGlobals();
|
|
3010
3134
|
const printer = createPrinter(globals);
|
|
@@ -3144,7 +3268,7 @@ function createBrandsCommand() {
|
|
|
3144
3268
|
}
|
|
3145
3269
|
|
|
3146
3270
|
// src/commands/carousels.ts
|
|
3147
|
-
var
|
|
3271
|
+
var import_commander6 = require("commander");
|
|
3148
3272
|
init_dist();
|
|
3149
3273
|
function resolveExitCode3(err) {
|
|
3150
3274
|
const attached = err.exitCode;
|
|
@@ -3152,7 +3276,7 @@ function resolveExitCode3(err) {
|
|
|
3152
3276
|
return exitCodeFromError(err);
|
|
3153
3277
|
}
|
|
3154
3278
|
function createCarouselsCommand() {
|
|
3155
|
-
const carousels = new
|
|
3279
|
+
const carousels = new import_commander6.Command("carousels").description("Manage carousels");
|
|
3156
3280
|
carousels.command("list").description("List all carousels").action(async (_opts, cmd) => {
|
|
3157
3281
|
const globals = cmd.optsWithGlobals();
|
|
3158
3282
|
const printer = createPrinter(globals);
|
|
@@ -3270,7 +3394,7 @@ function createCarouselsCommand() {
|
|
|
3270
3394
|
}
|
|
3271
3395
|
|
|
3272
3396
|
// src/commands/clips.ts
|
|
3273
|
-
var
|
|
3397
|
+
var import_commander7 = require("commander");
|
|
3274
3398
|
init_dist();
|
|
3275
3399
|
function resolveExitCode4(err) {
|
|
3276
3400
|
const attached = err.exitCode;
|
|
@@ -3289,7 +3413,7 @@ async function resolveBrandId(client, explicit) {
|
|
|
3289
3413
|
);
|
|
3290
3414
|
}
|
|
3291
3415
|
function createClipsCommand() {
|
|
3292
|
-
const clips = new
|
|
3416
|
+
const clips = new import_commander7.Command("clips").description("Manage video clips");
|
|
3293
3417
|
clips.command("list").description("List all clips").action(async (_opts, cmd) => {
|
|
3294
3418
|
const globals = cmd.optsWithGlobals();
|
|
3295
3419
|
const printer = createPrinter(globals);
|
|
@@ -3434,11 +3558,11 @@ function createClipsCommand() {
|
|
|
3434
3558
|
}
|
|
3435
3559
|
|
|
3436
3560
|
// src/commands/posts.ts
|
|
3437
|
-
var
|
|
3561
|
+
var import_commander8 = require("commander");
|
|
3438
3562
|
init_dist();
|
|
3439
3563
|
|
|
3440
3564
|
// src/lib/post-create.ts
|
|
3441
|
-
var
|
|
3565
|
+
var import_promises2 = __toESM(require("fs/promises"));
|
|
3442
3566
|
var import_node_path3 = __toESM(require("path"));
|
|
3443
3567
|
init_media_flags();
|
|
3444
3568
|
|
|
@@ -3661,7 +3785,7 @@ async function buildAndCreatePost(client, fields, opts) {
|
|
|
3661
3785
|
const mediaInputs = [];
|
|
3662
3786
|
for (let i = 0; i < (fields.media ?? []).length; i++) {
|
|
3663
3787
|
const filePath = fields.media[i];
|
|
3664
|
-
const data = await
|
|
3788
|
+
const data = await import_promises2.default.readFile(filePath);
|
|
3665
3789
|
const filename = import_node_path3.default.basename(filePath);
|
|
3666
3790
|
const uploaded = await client.media.upload({
|
|
3667
3791
|
data: new Uint8Array(data),
|
|
@@ -3678,7 +3802,7 @@ async function buildAndCreatePost(client, fields, opts) {
|
|
|
3678
3802
|
for (const [p, paths] of Object.entries(platformMediaPaths)) {
|
|
3679
3803
|
const uploads = [];
|
|
3680
3804
|
for (const filePath of paths) {
|
|
3681
|
-
const data = await
|
|
3805
|
+
const data = await import_promises2.default.readFile(filePath);
|
|
3682
3806
|
const filename = import_node_path3.default.basename(filePath);
|
|
3683
3807
|
const uploaded = await client.media.upload({
|
|
3684
3808
|
data: new Uint8Array(data),
|
|
@@ -3815,7 +3939,7 @@ function resolveExitCode5(err) {
|
|
|
3815
3939
|
return exitCodeFromError(err);
|
|
3816
3940
|
}
|
|
3817
3941
|
function createPostsCommand() {
|
|
3818
|
-
const posts = new
|
|
3942
|
+
const posts = new import_commander8.Command("posts").description("Manage posts");
|
|
3819
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) => {
|
|
3820
3944
|
const globals = cmd.optsWithGlobals();
|
|
3821
3945
|
const printer = createPrinter(globals);
|
|
@@ -4067,7 +4191,7 @@ function createPostsCommand() {
|
|
|
4067
4191
|
}
|
|
4068
4192
|
|
|
4069
4193
|
// src/commands/kb.ts
|
|
4070
|
-
var
|
|
4194
|
+
var import_commander9 = require("commander");
|
|
4071
4195
|
init_dist();
|
|
4072
4196
|
function resolveExitCode6(err) {
|
|
4073
4197
|
const attached = err.exitCode;
|
|
@@ -4075,7 +4199,7 @@ function resolveExitCode6(err) {
|
|
|
4075
4199
|
return exitCodeFromError(err);
|
|
4076
4200
|
}
|
|
4077
4201
|
function createKbCommand() {
|
|
4078
|
-
const kb = new
|
|
4202
|
+
const kb = new import_commander9.Command("kb").description("Manage knowledge bases");
|
|
4079
4203
|
kb.command("list").description("List all knowledge bases").action(async (_opts, cmd) => {
|
|
4080
4204
|
const globals = cmd.optsWithGlobals();
|
|
4081
4205
|
const printer = createPrinter(globals);
|
|
@@ -4215,7 +4339,7 @@ function createKbCommand() {
|
|
|
4215
4339
|
}
|
|
4216
4340
|
|
|
4217
4341
|
// src/commands/ideas.ts
|
|
4218
|
-
var
|
|
4342
|
+
var import_commander10 = require("commander");
|
|
4219
4343
|
init_dist();
|
|
4220
4344
|
function resolveExitCode7(err) {
|
|
4221
4345
|
const attached = err.exitCode;
|
|
@@ -4240,7 +4364,7 @@ function parseIdeaPlatforms(raw) {
|
|
|
4240
4364
|
return parts.map((platform) => ({ platform }));
|
|
4241
4365
|
}
|
|
4242
4366
|
function createIdeasCommand() {
|
|
4243
|
-
const ideas = new
|
|
4367
|
+
const ideas = new import_commander10.Command("ideas").description("Manage content ideas");
|
|
4244
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) => {
|
|
4245
4369
|
const globals = cmd.optsWithGlobals();
|
|
4246
4370
|
const printer = createPrinter(globals);
|
|
@@ -4337,7 +4461,7 @@ function createIdeasCommand() {
|
|
|
4337
4461
|
}
|
|
4338
4462
|
|
|
4339
4463
|
// src/commands/usage.ts
|
|
4340
|
-
var
|
|
4464
|
+
var import_commander11 = require("commander");
|
|
4341
4465
|
init_dist();
|
|
4342
4466
|
function resolveExitCode8(err) {
|
|
4343
4467
|
const attached = err.exitCode;
|
|
@@ -4345,7 +4469,7 @@ function resolveExitCode8(err) {
|
|
|
4345
4469
|
return exitCodeFromError(err);
|
|
4346
4470
|
}
|
|
4347
4471
|
function createUsageCommand() {
|
|
4348
|
-
const usage = new
|
|
4472
|
+
const usage = new import_commander11.Command("usage").description("View usage statistics");
|
|
4349
4473
|
usage.command("summary").description("Show usage summary for the current period").action(async (_opts, cmd) => {
|
|
4350
4474
|
const globals = cmd.optsWithGlobals();
|
|
4351
4475
|
const printer = createPrinter(globals);
|
|
@@ -4384,7 +4508,7 @@ function createUsageCommand() {
|
|
|
4384
4508
|
}
|
|
4385
4509
|
|
|
4386
4510
|
// src/commands/webhooks.ts
|
|
4387
|
-
var
|
|
4511
|
+
var import_commander12 = require("commander");
|
|
4388
4512
|
init_dist();
|
|
4389
4513
|
function resolveExitCode9(err) {
|
|
4390
4514
|
const attached = err.exitCode;
|
|
@@ -4392,7 +4516,7 @@ function resolveExitCode9(err) {
|
|
|
4392
4516
|
return exitCodeFromError(err);
|
|
4393
4517
|
}
|
|
4394
4518
|
function createWebhooksCommand() {
|
|
4395
|
-
const webhooks = new
|
|
4519
|
+
const webhooks = new import_commander12.Command("webhooks").description("Manage webhooks");
|
|
4396
4520
|
webhooks.command("list").description("List all webhooks").action(async (_opts, cmd) => {
|
|
4397
4521
|
const globals = cmd.optsWithGlobals();
|
|
4398
4522
|
const printer = createPrinter(globals);
|
|
@@ -4518,7 +4642,7 @@ function createWebhooksCommand() {
|
|
|
4518
4642
|
}
|
|
4519
4643
|
|
|
4520
4644
|
// src/commands/workspaces.ts
|
|
4521
|
-
var
|
|
4645
|
+
var import_commander13 = require("commander");
|
|
4522
4646
|
init_dist();
|
|
4523
4647
|
function resolveExitCode10(err) {
|
|
4524
4648
|
const attached = err.exitCode;
|
|
@@ -4526,7 +4650,7 @@ function resolveExitCode10(err) {
|
|
|
4526
4650
|
return exitCodeFromError(err);
|
|
4527
4651
|
}
|
|
4528
4652
|
function createWorkspacesCommand() {
|
|
4529
|
-
const workspaces = new
|
|
4653
|
+
const workspaces = new import_commander13.Command("workspaces").description("Manage workspaces");
|
|
4530
4654
|
workspaces.command("list").description("List all workspaces").action(async (_opts, cmd) => {
|
|
4531
4655
|
const globals = cmd.optsWithGlobals();
|
|
4532
4656
|
const printer = createPrinter(globals);
|
|
@@ -4570,7 +4694,7 @@ function createWorkspacesCommand() {
|
|
|
4570
4694
|
}
|
|
4571
4695
|
|
|
4572
4696
|
// src/commands/doctor.ts
|
|
4573
|
-
var
|
|
4697
|
+
var import_commander14 = require("commander");
|
|
4574
4698
|
init_dist();
|
|
4575
4699
|
var import_node_fs5 = __toESM(require("fs"));
|
|
4576
4700
|
var API_HEALTH_URL = "https://app.autoposting.ai/api-proxy/health";
|
|
@@ -4624,7 +4748,7 @@ async function runChecks() {
|
|
|
4624
4748
|
return results;
|
|
4625
4749
|
}
|
|
4626
4750
|
function createDoctorCommand() {
|
|
4627
|
-
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) => {
|
|
4628
4752
|
const globals = cmd2.optsWithGlobals();
|
|
4629
4753
|
const results = await runChecks();
|
|
4630
4754
|
if (globals.json) {
|
|
@@ -4643,10 +4767,10 @@ function createDoctorCommand() {
|
|
|
4643
4767
|
}
|
|
4644
4768
|
|
|
4645
4769
|
// src/commands/whoami.ts
|
|
4646
|
-
var
|
|
4770
|
+
var import_commander15 = require("commander");
|
|
4647
4771
|
init_dist();
|
|
4648
4772
|
function createWhoamiCommand() {
|
|
4649
|
-
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) => {
|
|
4650
4774
|
const globals = cmd.optsWithGlobals();
|
|
4651
4775
|
let cred;
|
|
4652
4776
|
try {
|
|
@@ -4707,7 +4831,7 @@ function createWhoamiCommand() {
|
|
|
4707
4831
|
}
|
|
4708
4832
|
|
|
4709
4833
|
// src/commands/open.ts
|
|
4710
|
-
var
|
|
4834
|
+
var import_commander16 = require("commander");
|
|
4711
4835
|
var import_open = __toESM(require("open"));
|
|
4712
4836
|
var URLS = {
|
|
4713
4837
|
"": "https://app.autoposting.ai",
|
|
@@ -4719,7 +4843,7 @@ var URLS = {
|
|
|
4719
4843
|
};
|
|
4720
4844
|
var VALID_SECTIONS = Object.keys(URLS).filter((k) => k !== "");
|
|
4721
4845
|
function createOpenCommand() {
|
|
4722
|
-
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) => {
|
|
4723
4847
|
const key = section ?? "";
|
|
4724
4848
|
if (!(key in URLS)) {
|
|
4725
4849
|
console.error(`Error: unknown section "${key}". Valid sections: ${VALID_SECTIONS.join(", ")}`);
|
|
@@ -4742,12 +4866,12 @@ function createOpenCommand() {
|
|
|
4742
4866
|
}
|
|
4743
4867
|
|
|
4744
4868
|
// src/commands/update.ts
|
|
4745
|
-
var
|
|
4869
|
+
var import_commander17 = require("commander");
|
|
4746
4870
|
init_dist();
|
|
4747
4871
|
var import_node_child_process2 = require("child_process");
|
|
4748
4872
|
var REGISTRY_URL = "https://registry.npmjs.org/@autoposting.ai%2fcli/latest";
|
|
4749
4873
|
function createUpdateCommand() {
|
|
4750
|
-
return new
|
|
4874
|
+
return new import_commander17.Command("update").description(
|
|
4751
4875
|
"Check for a newer version of the CLI and optionally install it"
|
|
4752
4876
|
).option("--yes", "Install the latest version without prompting").action(async (opts) => {
|
|
4753
4877
|
let latest;
|
|
@@ -4792,10 +4916,11 @@ function createUpdateCommand() {
|
|
|
4792
4916
|
}
|
|
4793
4917
|
|
|
4794
4918
|
// src/commands/completion.ts
|
|
4795
|
-
var
|
|
4919
|
+
var import_commander18 = require("commander");
|
|
4796
4920
|
var ALL_COMMANDS = [
|
|
4797
4921
|
"posts",
|
|
4798
4922
|
"brands",
|
|
4923
|
+
"accounts",
|
|
4799
4924
|
"agents",
|
|
4800
4925
|
"kb",
|
|
4801
4926
|
"ideas",
|
|
@@ -4854,7 +4979,7 @@ Register-ArgumentCompleter -Native -CommandName @('ap', 'autoposting') -ScriptBl
|
|
|
4854
4979
|
`
|
|
4855
4980
|
};
|
|
4856
4981
|
function createCompletionCommand() {
|
|
4857
|
-
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) => {
|
|
4858
4983
|
if (!SHELLS.includes(shell)) {
|
|
4859
4984
|
console.error(`Error: unsupported shell "${shell}". Supported: ${SHELLS.join(", ")}`);
|
|
4860
4985
|
process.exit(1);
|
|
@@ -4864,18 +4989,18 @@ function createCompletionCommand() {
|
|
|
4864
4989
|
}
|
|
4865
4990
|
|
|
4866
4991
|
// src/commands/mcp.ts
|
|
4867
|
-
var
|
|
4992
|
+
var import_commander19 = require("commander");
|
|
4868
4993
|
function createMcpCommand() {
|
|
4869
|
-
return new
|
|
4994
|
+
return new import_commander19.Command("mcp").description("Start MCP stdio server for AI agent integration").action(async () => {
|
|
4870
4995
|
const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
4871
4996
|
await startMcpServer2();
|
|
4872
4997
|
});
|
|
4873
4998
|
}
|
|
4874
4999
|
|
|
4875
5000
|
// src/commands/config.ts
|
|
4876
|
-
var
|
|
5001
|
+
var import_commander20 = require("commander");
|
|
4877
5002
|
function createConfigCommand() {
|
|
4878
|
-
const config = new
|
|
5003
|
+
const config = new import_commander20.Command("config").description("Manage CLI defaults (stored in config.json)");
|
|
4879
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) => {
|
|
4880
5005
|
const printer = createPrinter(cmd.optsWithGlobals());
|
|
4881
5006
|
setContextBrand(opts.brand);
|
|
@@ -4899,7 +5024,7 @@ function createConfigCommand() {
|
|
|
4899
5024
|
}
|
|
4900
5025
|
|
|
4901
5026
|
// src/commands/api.ts
|
|
4902
|
-
var
|
|
5027
|
+
var import_commander21 = require("commander");
|
|
4903
5028
|
init_dist();
|
|
4904
5029
|
init_api_routes();
|
|
4905
5030
|
function validationError(message) {
|
|
@@ -4924,7 +5049,7 @@ function parseFields(pairs) {
|
|
|
4924
5049
|
return out;
|
|
4925
5050
|
}
|
|
4926
5051
|
function createApiCommand() {
|
|
4927
|
-
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) => {
|
|
4928
5053
|
const globals = cmd.optsWithGlobals();
|
|
4929
5054
|
const printer = createPrinter(globals);
|
|
4930
5055
|
try {
|
|
@@ -4964,12 +5089,13 @@ function createApiCommand() {
|
|
|
4964
5089
|
}
|
|
4965
5090
|
|
|
4966
5091
|
// src/cli.ts
|
|
4967
|
-
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) => {
|
|
4968
5093
|
const opts = thisCommand.opts();
|
|
4969
5094
|
if (!opts.color) disableColor();
|
|
4970
5095
|
});
|
|
4971
5096
|
program.addCommand(createAuthCommand());
|
|
4972
5097
|
program.addCommand(createBillingCommand());
|
|
5098
|
+
program.addCommand(createAccountsCommand());
|
|
4973
5099
|
program.addCommand(createBrandsCommand());
|
|
4974
5100
|
program.addCommand(createCarouselsCommand());
|
|
4975
5101
|
program.addCommand(createClipsCommand());
|