@autoposting.ai/cli 0.4.1 → 0.5.1

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 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, Resource, 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;
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
- VERSION = "0.4.1";
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.1";
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, import_promises2.readFile)(filePath)),
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 import_promises2, import_node_path4, PLATFORMS, PLATFORM_SET, routeCache;
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
- import_promises2 = require("fs/promises");
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 import_commander21 = require("commander");
2165
+ var import_commander22 = require("commander");
2114
2166
  init_dist();
2115
2167
 
2116
2168
  // src/commands/agents.ts
@@ -2884,6 +2936,10 @@ function createBillingCommand() {
2884
2936
  const client = new Autoposting({ apiKey: cred.apiKey });
2885
2937
  const credits = await client.billing.credits();
2886
2938
  spinner.stop();
2939
+ if (!printer.isTty()) {
2940
+ printer.log(credits);
2941
+ return;
2942
+ }
2887
2943
  printer.table(
2888
2944
  [
2889
2945
  {
@@ -2911,8 +2967,80 @@ function createBillingCommand() {
2911
2967
  return billing;
2912
2968
  }
2913
2969
 
2914
- // src/commands/brands.ts
2970
+ // src/commands/accounts.ts
2915
2971
  var import_commander4 = require("commander");
2972
+ var import_promises = require("fs/promises");
2973
+ init_dist();
2974
+ async function run(cmd, action) {
2975
+ const globals = cmd.optsWithGlobals();
2976
+ const printer = createPrinter(globals);
2977
+ try {
2978
+ const cred = resolveAuth({ apiKey: globals.apiKey });
2979
+ printer.log(await action(new Autoposting({ apiKey: cred.apiKey })));
2980
+ } catch (err) {
2981
+ printer.error(err);
2982
+ process.exitCode = exitCodeFromError(err);
2983
+ }
2984
+ }
2985
+ function createAccountsCommand() {
2986
+ const command = new import_commander4.Command("accounts").description(
2987
+ "Import account CSVs and connect through browser approval; progress lives in the workspace"
2988
+ );
2989
+ command.command("import").requiredOption(
2990
+ "--from <csv>",
2991
+ "CSV with brand_name,platform,account_url; optional brand_slug,timezone"
2992
+ ).action(
2993
+ async (opts, cmd) => run(
2994
+ cmd,
2995
+ async (client) => client.accountOnboarding.create({
2996
+ csv: await (0, import_promises.readFile)(opts.from, "utf8")
2997
+ })
2998
+ )
2999
+ );
3000
+ command.command("prepare <importId>").option("--offset <number>", "Resume at this row offset", "0").description(
3001
+ "Create/reuse the next 25 brands; repeat with nextOffset until null"
3002
+ ).action(
3003
+ async (id, opts, cmd) => run(cmd, async (client) => {
3004
+ const offset = Number(opts.offset);
3005
+ if (!Number.isInteger(offset) || offset < 0)
3006
+ throw new Error("offset must be a nonnegative integer");
3007
+ return client.accountOnboarding.prepare(id, offset);
3008
+ })
3009
+ );
3010
+ 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(
3011
+ async (id, opts, cmd) => run(
3012
+ cmd,
3013
+ (client) => client.accountOnboarding.status(id, {
3014
+ offset: Number(opts.offset),
3015
+ limit: Number(opts.limit)
3016
+ })
3017
+ )
3018
+ );
3019
+ command.command("authorize <importId> <rowId>").description(
3020
+ "Print a fresh approval link. Open it in your browser, select the CSV account, then check status"
3021
+ ).action(
3022
+ async (id, rowId, _opts, cmd) => run(cmd, (client) => client.accountOnboarding.authorize(id, rowId))
3023
+ );
3024
+ command.command("confirm <importId> <rowId>").requiredOption(
3025
+ "--token-id <id>",
3026
+ "Actual account tokenId from status; confirm only after comparing it with the CSV account"
3027
+ ).action(
3028
+ async (id, rowId, opts, cmd) => run(
3029
+ cmd,
3030
+ (client) => client.accountOnboarding.confirm(id, rowId, opts.tokenId)
3031
+ )
3032
+ );
3033
+ command.command("delete <importId>").requiredOption(
3034
+ "--force",
3035
+ "Discard import progress; keeps brands and connected accounts"
3036
+ ).action(
3037
+ async (id, _opts, cmd) => run(cmd, (client) => client.accountOnboarding.remove(id))
3038
+ );
3039
+ return command;
3040
+ }
3041
+
3042
+ // src/commands/brands.ts
3043
+ var import_commander5 = require("commander");
2916
3044
  init_dist();
2917
3045
  init_media_flags();
2918
3046
 
@@ -3004,7 +3132,7 @@ function buildAuthStatusRow(c, now = Date.now()) {
3004
3132
  };
3005
3133
  }
3006
3134
  function createBrandsCommand() {
3007
- const brands = new import_commander4.Command("brands").description("Manage brands");
3135
+ const brands = new import_commander5.Command("brands").description("Manage brands");
3008
3136
  brands.command("list").description("List all brands").action(async (_opts, cmd) => {
3009
3137
  const globals = cmd.optsWithGlobals();
3010
3138
  const printer = createPrinter(globals);
@@ -3144,7 +3272,7 @@ function createBrandsCommand() {
3144
3272
  }
3145
3273
 
3146
3274
  // src/commands/carousels.ts
3147
- var import_commander5 = require("commander");
3275
+ var import_commander6 = require("commander");
3148
3276
  init_dist();
3149
3277
  function resolveExitCode3(err) {
3150
3278
  const attached = err.exitCode;
@@ -3152,7 +3280,7 @@ function resolveExitCode3(err) {
3152
3280
  return exitCodeFromError(err);
3153
3281
  }
3154
3282
  function createCarouselsCommand() {
3155
- const carousels = new import_commander5.Command("carousels").description("Manage carousels");
3283
+ const carousels = new import_commander6.Command("carousels").description("Manage carousels");
3156
3284
  carousels.command("list").description("List all carousels").action(async (_opts, cmd) => {
3157
3285
  const globals = cmd.optsWithGlobals();
3158
3286
  const printer = createPrinter(globals);
@@ -3270,7 +3398,7 @@ function createCarouselsCommand() {
3270
3398
  }
3271
3399
 
3272
3400
  // src/commands/clips.ts
3273
- var import_commander6 = require("commander");
3401
+ var import_commander7 = require("commander");
3274
3402
  init_dist();
3275
3403
  function resolveExitCode4(err) {
3276
3404
  const attached = err.exitCode;
@@ -3289,7 +3417,7 @@ async function resolveBrandId(client, explicit) {
3289
3417
  );
3290
3418
  }
3291
3419
  function createClipsCommand() {
3292
- const clips = new import_commander6.Command("clips").description("Manage video clips");
3420
+ const clips = new import_commander7.Command("clips").description("Manage video clips");
3293
3421
  clips.command("list").description("List all clips").action(async (_opts, cmd) => {
3294
3422
  const globals = cmd.optsWithGlobals();
3295
3423
  const printer = createPrinter(globals);
@@ -3434,11 +3562,11 @@ function createClipsCommand() {
3434
3562
  }
3435
3563
 
3436
3564
  // src/commands/posts.ts
3437
- var import_commander7 = require("commander");
3565
+ var import_commander8 = require("commander");
3438
3566
  init_dist();
3439
3567
 
3440
3568
  // src/lib/post-create.ts
3441
- var import_promises = __toESM(require("fs/promises"));
3569
+ var import_promises2 = __toESM(require("fs/promises"));
3442
3570
  var import_node_path3 = __toESM(require("path"));
3443
3571
  init_media_flags();
3444
3572
 
@@ -3661,7 +3789,7 @@ async function buildAndCreatePost(client, fields, opts) {
3661
3789
  const mediaInputs = [];
3662
3790
  for (let i = 0; i < (fields.media ?? []).length; i++) {
3663
3791
  const filePath = fields.media[i];
3664
- const data = await import_promises.default.readFile(filePath);
3792
+ const data = await import_promises2.default.readFile(filePath);
3665
3793
  const filename = import_node_path3.default.basename(filePath);
3666
3794
  const uploaded = await client.media.upload({
3667
3795
  data: new Uint8Array(data),
@@ -3678,7 +3806,7 @@ async function buildAndCreatePost(client, fields, opts) {
3678
3806
  for (const [p, paths] of Object.entries(platformMediaPaths)) {
3679
3807
  const uploads = [];
3680
3808
  for (const filePath of paths) {
3681
- const data = await import_promises.default.readFile(filePath);
3809
+ const data = await import_promises2.default.readFile(filePath);
3682
3810
  const filename = import_node_path3.default.basename(filePath);
3683
3811
  const uploaded = await client.media.upload({
3684
3812
  data: new Uint8Array(data),
@@ -3815,7 +3943,7 @@ function resolveExitCode5(err) {
3815
3943
  return exitCodeFromError(err);
3816
3944
  }
3817
3945
  function createPostsCommand() {
3818
- const posts = new import_commander7.Command("posts").description("Manage posts");
3946
+ const posts = new import_commander8.Command("posts").description("Manage posts");
3819
3947
  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
3948
  const globals = cmd.optsWithGlobals();
3821
3949
  const printer = createPrinter(globals);
@@ -4067,7 +4195,7 @@ function createPostsCommand() {
4067
4195
  }
4068
4196
 
4069
4197
  // src/commands/kb.ts
4070
- var import_commander8 = require("commander");
4198
+ var import_commander9 = require("commander");
4071
4199
  init_dist();
4072
4200
  function resolveExitCode6(err) {
4073
4201
  const attached = err.exitCode;
@@ -4075,7 +4203,7 @@ function resolveExitCode6(err) {
4075
4203
  return exitCodeFromError(err);
4076
4204
  }
4077
4205
  function createKbCommand() {
4078
- const kb = new import_commander8.Command("kb").description("Manage knowledge bases");
4206
+ const kb = new import_commander9.Command("kb").description("Manage knowledge bases");
4079
4207
  kb.command("list").description("List all knowledge bases").action(async (_opts, cmd) => {
4080
4208
  const globals = cmd.optsWithGlobals();
4081
4209
  const printer = createPrinter(globals);
@@ -4215,7 +4343,7 @@ function createKbCommand() {
4215
4343
  }
4216
4344
 
4217
4345
  // src/commands/ideas.ts
4218
- var import_commander9 = require("commander");
4346
+ var import_commander10 = require("commander");
4219
4347
  init_dist();
4220
4348
  function resolveExitCode7(err) {
4221
4349
  const attached = err.exitCode;
@@ -4240,7 +4368,7 @@ function parseIdeaPlatforms(raw) {
4240
4368
  return parts.map((platform) => ({ platform }));
4241
4369
  }
4242
4370
  function createIdeasCommand() {
4243
- const ideas = new import_commander9.Command("ideas").description("Manage content ideas");
4371
+ const ideas = new import_commander10.Command("ideas").description("Manage content ideas");
4244
4372
  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
4373
  const globals = cmd.optsWithGlobals();
4246
4374
  const printer = createPrinter(globals);
@@ -4337,7 +4465,7 @@ function createIdeasCommand() {
4337
4465
  }
4338
4466
 
4339
4467
  // src/commands/usage.ts
4340
- var import_commander10 = require("commander");
4468
+ var import_commander11 = require("commander");
4341
4469
  init_dist();
4342
4470
  function resolveExitCode8(err) {
4343
4471
  const attached = err.exitCode;
@@ -4345,7 +4473,7 @@ function resolveExitCode8(err) {
4345
4473
  return exitCodeFromError(err);
4346
4474
  }
4347
4475
  function createUsageCommand() {
4348
- const usage = new import_commander10.Command("usage").description("View usage statistics");
4476
+ const usage = new import_commander11.Command("usage").description("View usage statistics");
4349
4477
  usage.command("summary").description("Show usage summary for the current period").action(async (_opts, cmd) => {
4350
4478
  const globals = cmd.optsWithGlobals();
4351
4479
  const printer = createPrinter(globals);
@@ -4355,6 +4483,10 @@ function createUsageCommand() {
4355
4483
  const client = new Autoposting({ apiKey: cred.apiKey });
4356
4484
  const summary = await client.usage.summary();
4357
4485
  spinner.stop();
4486
+ if (!printer.isTty()) {
4487
+ printer.log(summary);
4488
+ return;
4489
+ }
4358
4490
  printer.log(`Period: ${summary.range.from.slice(0, 10)} \u2192 ${summary.range.to.slice(0, 10)}`);
4359
4491
  printer.table(
4360
4492
  [
@@ -4384,7 +4516,7 @@ function createUsageCommand() {
4384
4516
  }
4385
4517
 
4386
4518
  // src/commands/webhooks.ts
4387
- var import_commander11 = require("commander");
4519
+ var import_commander12 = require("commander");
4388
4520
  init_dist();
4389
4521
  function resolveExitCode9(err) {
4390
4522
  const attached = err.exitCode;
@@ -4392,7 +4524,7 @@ function resolveExitCode9(err) {
4392
4524
  return exitCodeFromError(err);
4393
4525
  }
4394
4526
  function createWebhooksCommand() {
4395
- const webhooks = new import_commander11.Command("webhooks").description("Manage webhooks");
4527
+ const webhooks = new import_commander12.Command("webhooks").description("Manage webhooks");
4396
4528
  webhooks.command("list").description("List all webhooks").action(async (_opts, cmd) => {
4397
4529
  const globals = cmd.optsWithGlobals();
4398
4530
  const printer = createPrinter(globals);
@@ -4518,7 +4650,7 @@ function createWebhooksCommand() {
4518
4650
  }
4519
4651
 
4520
4652
  // src/commands/workspaces.ts
4521
- var import_commander12 = require("commander");
4653
+ var import_commander13 = require("commander");
4522
4654
  init_dist();
4523
4655
  function resolveExitCode10(err) {
4524
4656
  const attached = err.exitCode;
@@ -4526,7 +4658,7 @@ function resolveExitCode10(err) {
4526
4658
  return exitCodeFromError(err);
4527
4659
  }
4528
4660
  function createWorkspacesCommand() {
4529
- const workspaces = new import_commander12.Command("workspaces").description("Manage workspaces");
4661
+ const workspaces = new import_commander13.Command("workspaces").description("Manage workspaces");
4530
4662
  workspaces.command("list").description("List all workspaces").action(async (_opts, cmd) => {
4531
4663
  const globals = cmd.optsWithGlobals();
4532
4664
  const printer = createPrinter(globals);
@@ -4570,7 +4702,7 @@ function createWorkspacesCommand() {
4570
4702
  }
4571
4703
 
4572
4704
  // src/commands/doctor.ts
4573
- var import_commander13 = require("commander");
4705
+ var import_commander14 = require("commander");
4574
4706
  init_dist();
4575
4707
  var import_node_fs5 = __toESM(require("fs"));
4576
4708
  var API_HEALTH_URL = "https://app.autoposting.ai/api-proxy/health";
@@ -4624,7 +4756,7 @@ async function runChecks() {
4624
4756
  return results;
4625
4757
  }
4626
4758
  function createDoctorCommand() {
4627
- const cmd = new import_commander13.Command("doctor").description("Run diagnostic checks on your CLI setup").option("--json", "Output results as JSON").action(async (_opts, cmd2) => {
4759
+ 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
4760
  const globals = cmd2.optsWithGlobals();
4629
4761
  const results = await runChecks();
4630
4762
  if (globals.json) {
@@ -4643,10 +4775,10 @@ function createDoctorCommand() {
4643
4775
  }
4644
4776
 
4645
4777
  // src/commands/whoami.ts
4646
- var import_commander14 = require("commander");
4778
+ var import_commander15 = require("commander");
4647
4779
  init_dist();
4648
4780
  function createWhoamiCommand() {
4649
- return new import_commander14.Command("whoami").description("Show the current identity and validate the key against the server").action(async (_opts, cmd) => {
4781
+ return new import_commander15.Command("whoami").description("Show the current identity and validate the key against the server").action(async (_opts, cmd) => {
4650
4782
  const globals = cmd.optsWithGlobals();
4651
4783
  let cred;
4652
4784
  try {
@@ -4707,7 +4839,7 @@ function createWhoamiCommand() {
4707
4839
  }
4708
4840
 
4709
4841
  // src/commands/open.ts
4710
- var import_commander15 = require("commander");
4842
+ var import_commander16 = require("commander");
4711
4843
  var import_open = __toESM(require("open"));
4712
4844
  var URLS = {
4713
4845
  "": "https://app.autoposting.ai",
@@ -4719,7 +4851,7 @@ var URLS = {
4719
4851
  };
4720
4852
  var VALID_SECTIONS = Object.keys(URLS).filter((k) => k !== "");
4721
4853
  function createOpenCommand() {
4722
- return new import_commander15.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) => {
4854
+ 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
4855
  const key = section ?? "";
4724
4856
  if (!(key in URLS)) {
4725
4857
  console.error(`Error: unknown section "${key}". Valid sections: ${VALID_SECTIONS.join(", ")}`);
@@ -4742,12 +4874,12 @@ function createOpenCommand() {
4742
4874
  }
4743
4875
 
4744
4876
  // src/commands/update.ts
4745
- var import_commander16 = require("commander");
4877
+ var import_commander17 = require("commander");
4746
4878
  init_dist();
4747
4879
  var import_node_child_process2 = require("child_process");
4748
4880
  var REGISTRY_URL = "https://registry.npmjs.org/@autoposting.ai%2fcli/latest";
4749
4881
  function createUpdateCommand() {
4750
- return new import_commander16.Command("update").description(
4882
+ return new import_commander17.Command("update").description(
4751
4883
  "Check for a newer version of the CLI and optionally install it"
4752
4884
  ).option("--yes", "Install the latest version without prompting").action(async (opts) => {
4753
4885
  let latest;
@@ -4792,10 +4924,11 @@ function createUpdateCommand() {
4792
4924
  }
4793
4925
 
4794
4926
  // src/commands/completion.ts
4795
- var import_commander17 = require("commander");
4927
+ var import_commander18 = require("commander");
4796
4928
  var ALL_COMMANDS = [
4797
4929
  "posts",
4798
4930
  "brands",
4931
+ "accounts",
4799
4932
  "agents",
4800
4933
  "kb",
4801
4934
  "ideas",
@@ -4854,7 +4987,7 @@ Register-ArgumentCompleter -Native -CommandName @('ap', 'autoposting') -ScriptBl
4854
4987
  `
4855
4988
  };
4856
4989
  function createCompletionCommand() {
4857
- return new import_commander17.Command("completion").description(`Generate shell completion script. Shells: ${SHELLS.join(", ")}`).argument("<shell>", `Shell type (${SHELLS.join("|")})`).action((shell) => {
4990
+ return new import_commander18.Command("completion").description(`Generate shell completion script. Shells: ${SHELLS.join(", ")}`).argument("<shell>", `Shell type (${SHELLS.join("|")})`).action((shell) => {
4858
4991
  if (!SHELLS.includes(shell)) {
4859
4992
  console.error(`Error: unsupported shell "${shell}". Supported: ${SHELLS.join(", ")}`);
4860
4993
  process.exit(1);
@@ -4864,18 +4997,18 @@ function createCompletionCommand() {
4864
4997
  }
4865
4998
 
4866
4999
  // src/commands/mcp.ts
4867
- var import_commander18 = require("commander");
5000
+ var import_commander19 = require("commander");
4868
5001
  function createMcpCommand() {
4869
- return new import_commander18.Command("mcp").description("Start MCP stdio server for AI agent integration").action(async () => {
5002
+ return new import_commander19.Command("mcp").description("Start MCP stdio server for AI agent integration").action(async () => {
4870
5003
  const { startMcpServer: startMcpServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
4871
5004
  await startMcpServer2();
4872
5005
  });
4873
5006
  }
4874
5007
 
4875
5008
  // src/commands/config.ts
4876
- var import_commander19 = require("commander");
5009
+ var import_commander20 = require("commander");
4877
5010
  function createConfigCommand() {
4878
- const config = new import_commander19.Command("config").description("Manage CLI defaults (stored in config.json)");
5011
+ const config = new import_commander20.Command("config").description("Manage CLI defaults (stored in config.json)");
4879
5012
  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
5013
  const printer = createPrinter(cmd.optsWithGlobals());
4881
5014
  setContextBrand(opts.brand);
@@ -4899,7 +5032,7 @@ function createConfigCommand() {
4899
5032
  }
4900
5033
 
4901
5034
  // src/commands/api.ts
4902
- var import_commander20 = require("commander");
5035
+ var import_commander21 = require("commander");
4903
5036
  init_dist();
4904
5037
  init_api_routes();
4905
5038
  function validationError(message) {
@@ -4924,7 +5057,7 @@ function parseFields(pairs) {
4924
5057
  return out;
4925
5058
  }
4926
5059
  function createApiCommand() {
4927
- return new import_commander20.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) => {
5060
+ 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
5061
  const globals = cmd.optsWithGlobals();
4929
5062
  const printer = createPrinter(globals);
4930
5063
  try {
@@ -4964,12 +5097,13 @@ function createApiCommand() {
4964
5097
  }
4965
5098
 
4966
5099
  // src/cli.ts
4967
- var program = new import_commander21.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) => {
5100
+ 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
5101
  const opts = thisCommand.opts();
4969
5102
  if (!opts.color) disableColor();
4970
5103
  });
4971
5104
  program.addCommand(createAuthCommand());
4972
5105
  program.addCommand(createBillingCommand());
5106
+ program.addCommand(createAccountsCommand());
4973
5107
  program.addCommand(createBrandsCommand());
4974
5108
  program.addCommand(createCarouselsCommand());
4975
5109
  program.addCommand(createClipsCommand());