@usesocial/cli 0.12.2 → 0.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @usesocial/cli
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#88](https://github.com/usesocial/monorepo/pull/88) [`6d3c8aa`](https://github.com/usesocial/monorepo/commit/6d3c8aaaafe23d461c97048bd3589a9b53001ade) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Remove `social x sync timeline` from the supported X sync collections.
8
+
9
+ ## 0.12.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#81](https://github.com/usesocial/monorepo/pull/81) [`f4ef94b`](https://github.com/usesocial/monorepo/commit/f4ef94ba089bf4d8bd4a0b42495be6f88608b85e) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Return a checkout URL from non-interactive account connect when a billing seat must be activated.
14
+
3
15
  ## 0.12.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -64,7 +64,7 @@ social x profile
64
64
  | "Surface the ten warm contacts worth reaching out to this week." | `linkedin search people`, `linkedin reactions`, `linkedin sql` |
65
65
  | "Pull everyone who reacted to my last LinkedIn post and flag the warm leads." | `linkedin posts <target>`, `linkedin reactions`, `linkedin profile` |
66
66
  | "Read this creator's recent posts and break down what makes them land." | `linkedin posts <target>`, `x tweets <target>` |
67
- | "Find what people are saying about AI agents this week and summarize the themes." | `linkedin search posts`, `x sync timeline`, `x sql` |
67
+ | "Find what people are saying about AI agents this week and summarize the themes." | `linkedin search posts` |
68
68
  | "Triage my inbox and draft replies for approval." | `sync messages`, `sql`, `linkedin message`, `x message` |
69
69
  | "Show this week's company Page visitors and invite the approved prospects." | `linkedin page visitors`, `linkedin page invite` |
70
70
  | "Draft a reply to this thread and post it once I approve." | `linkedin comment`, `x post` |
@@ -217,7 +217,7 @@ profile lookup is needed.
217
217
  | `quotes <target>` | List quote posts of a post. | |
218
218
  | `likers <target>` | List users who liked a post. | |
219
219
  | `reposters <target>` | List users who reposted a post. | |
220
- | `sync [collection]` | Pull your own `tweets`, `timeline`, `followers`, `following`, `bookmarks`, `liked`, `mentions`, or `messages` into the local mirror; costs usage. | local |
220
+ | `sync [collection]` | Pull your own `tweets`, `followers`, `following`, `bookmarks`, `liked`, `mentions`, or `messages` into the local mirror; costs usage. | local |
221
221
  | `sql [query]` | Query your local mirror with read-only SQL - free; bare `sql` prints compact schema metadata. | |
222
222
  | `post` | Create a post (body from stdin). | write |
223
223
  | `message <recipients>` | Send a DM (body from stdin). | write |
@@ -304,9 +304,6 @@ query it with `sql`. SQL reads show local freshness in `meta.cache.tables` and a
304
304
  ```sh
305
305
  social x sql "SELECT sender_username, text FROM x_messages ORDER BY created_at DESC LIMIT 5" \
306
306
  | jq '{cache: .meta.cache}'
307
- social x sync timeline
308
- social x sql "SELECT text, url FROM x_timeline ORDER BY created_at DESC LIMIT 20" \
309
- | jq '{cache: .meta.cache}'
310
307
  ```
311
308
 
312
309
  Agents should watch `.meta.cost` when it is present during high-fanout loops, use
@@ -334,8 +331,6 @@ social x sync messages
334
331
  social x sql "SELECT sender_username, text FROM x_messages ORDER BY created_at DESC LIMIT 20"
335
332
  social x sql "SELECT text, url FROM x_bookmarks ORDER BY created_at DESC LIMIT 50"
336
333
  social x sql "SELECT username, name, followers_count FROM x_followers ORDER BY followers_count DESC LIMIT 100"
337
- social x sync timeline
338
- social x sql "SELECT text, url FROM x_timeline ORDER BY created_at DESC LIMIT 50"
339
334
 
340
335
  # X live reads.
341
336
  social x tweets profile_id:<x-user-id> --limit 30
package/dist/index.mjs CHANGED
@@ -405,7 +405,7 @@ const U = (e) => e.status === `ok` ? {
405
405
  const org = "usesocial";
406
406
  const cliPackageName = `@${org}/cli`;
407
407
  const cliBin = "social";
408
- const skillInstallCommand = `npx skills add ${org}/skill`;
408
+ const skillInstallCommand = `npx --yes skills add ${org}/skill --global --yes --agent claude-code codex`;
409
409
  const publicWebURL = "https://usesocial.dev";
410
410
  const publicAPIURL = "https://api.usesocial.dev/v1";
411
411
  const publicLinks = {
@@ -444,10 +444,11 @@ const cliBrand = {
444
444
  installCommands: {
445
445
  setup: `curl -fsSL ${setupScriptURL} | bash`,
446
446
  bun: `bun install -g ${cliPackageName}`,
447
- npm: `npm install -g ${cliPackageName}`,
447
+ npm: `npm install -g ${cliPackageName}@latest`,
448
448
  skill: skillInstallCommand
449
449
  }
450
450
  };
451
+ `${cliBrand.installCommands.npm}${cliBrand.installCommands.skill}`;
451
452
  h("InvalidPublicBaseURL")();
452
453
  h("InvalidPublicRoute")();
453
454
  const publicURLForLiteral = (route) => new URL(route, brandURLs.publicWebURL).toString();
@@ -1598,7 +1599,7 @@ const LINKEDIN_COLLECTIONS = [
1598
1599
  parentCollection: "li_conversations",
1599
1600
  parentIdToken: ":chat_id",
1600
1601
  pagination: linkedinCursorPagination,
1601
- pageSize: 250,
1602
+ pageSize: 100,
1602
1603
  sinceField: "timestamp",
1603
1604
  lift: liftMessage
1604
1605
  },
@@ -1837,6 +1838,7 @@ const X_COLLECTIONS = [
1837
1838
  pageSize: 100,
1838
1839
  sinceField: "created_at",
1839
1840
  expectedFields: expectedTweetFields,
1841
+ syncable: false,
1840
1842
  lift: liftTweet
1841
1843
  },
1842
1844
  {
@@ -2011,7 +2013,7 @@ const collectionByKey = (key) => COLLECTIONS.find((collection) => collection.key
2011
2013
  const collectionsFor = (platform) => COLLECTIONS.filter((collection) => collection.platform === platform);
2012
2014
  const syncableCollectionsFor = (platform) => {
2013
2015
  const parentKeys = new Set(COLLECTIONS.map((collection) => collection.parentCollection).filter(Boolean));
2014
- return collectionsFor(platform).filter((collection) => !parentKeys.has(collection.key));
2016
+ return collectionsFor(platform).filter((collection) => collection.syncable !== false && !parentKeys.has(collection.key));
2015
2017
  };
2016
2018
  const physicalTableFor = (collection) => collection.table ?? collection.key;
2017
2019
  const resetTablesFor = (collection) => {
@@ -11047,6 +11049,8 @@ pgTable("wrapped", {
11047
11049
  status: text$1("status", { enum: WRAPPED_STATUSES }).notNull().default("pending"),
11048
11050
  quotedCredits: integer("quoted_credits").notNull().default(0),
11049
11051
  billedCredits: integer("billed_credits").notNull().default(0),
11052
+ readCount: integer("read_count").notNull().default(0),
11053
+ resumeCursor: text$1("resume_cursor"),
11050
11054
  workflowRunId: text$1("workflow_run_id"),
11051
11055
  snapshot: jsonb("snapshot").$type(),
11052
11056
  error: text$1("error"),
@@ -12663,6 +12667,45 @@ looseObject({
12663
12667
  });
12664
12668
  h("ChatListParseError")();
12665
12669
  h("ChatParticipantsFetchError")();
12670
+ const dropLinkedinInmailEligibility = (value) => {
12671
+ if (Array.isArray(value)) {
12672
+ let changed = false;
12673
+ const items = value.map((item) => {
12674
+ const stripped = dropLinkedinInmailEligibility(item);
12675
+ changed ||= stripped.changed;
12676
+ return stripped.value;
12677
+ });
12678
+ return changed ? {
12679
+ value: items,
12680
+ changed
12681
+ } : {
12682
+ value,
12683
+ changed
12684
+ };
12685
+ }
12686
+ if (!(value && typeof value === "object")) return {
12687
+ value,
12688
+ changed: false
12689
+ };
12690
+ let changed = false;
12691
+ const next = {};
12692
+ for (const [key, child] of Object.entries(value)) {
12693
+ if (key === "can_send_inmail") {
12694
+ changed = true;
12695
+ continue;
12696
+ }
12697
+ const stripped = dropLinkedinInmailEligibility(child);
12698
+ changed ||= stripped.changed;
12699
+ next[key] = stripped.value;
12700
+ }
12701
+ return changed ? {
12702
+ value: next,
12703
+ changed
12704
+ } : {
12705
+ value,
12706
+ changed
12707
+ };
12708
+ };
12666
12709
  const linkedinProfileExtractors = {
12667
12710
  "GET /users/me": extractProfile$1,
12668
12711
  "GET /users/:identifier": extractProfile$1,
@@ -23922,7 +23965,7 @@ function createEnv(opts) {
23922
23965
  }
23923
23966
  //#endregion
23924
23967
  //#region package.json
23925
- var version$1 = "0.12.2";
23968
+ var version$1 = "0.13.0";
23926
23969
  //#endregion
23927
23970
  //#region src/lib/env.ts
23928
23971
  const URLWithTrailingSlash = url().transform(ensureTrailingSlash);
@@ -31880,15 +31923,32 @@ const LifecycleAccountOutput = object({
31880
31923
  connectedAt: string().optional(),
31881
31924
  lastSeenAt: string().optional()
31882
31925
  }).passthrough();
31883
- const AccountConnectStateOutput = discriminatedUnion("status", [object({
31884
- status: literal("connected"),
31885
- platform: _enum(["linkedin", "x"]),
31886
- account: LifecycleAccountOutput
31887
- }), object({
31888
- status: literal("pending_approval"),
31889
- platform: _enum(["linkedin", "x"]),
31890
- connectURL: string()
31891
- })]);
31926
+ const AccountConnectStateOutput = discriminatedUnion("status", [
31927
+ object({
31928
+ status: literal("connected"),
31929
+ platform: _enum(["linkedin", "x"]),
31930
+ account: LifecycleAccountOutput
31931
+ }),
31932
+ object({
31933
+ status: literal("pending_billing"),
31934
+ platform: _enum(["linkedin", "x"]),
31935
+ paymentURL: string().nullable(),
31936
+ requiredAction: object({
31937
+ code: string(),
31938
+ reason: string()
31939
+ }).nullable(),
31940
+ seats: object({
31941
+ total: number().int().nonnegative(),
31942
+ used: number().int().nonnegative(),
31943
+ available: number().int().nonnegative()
31944
+ })
31945
+ }),
31946
+ object({
31947
+ status: literal("pending_approval"),
31948
+ platform: _enum(["linkedin", "x"]),
31949
+ connectURL: string()
31950
+ })
31951
+ ]);
31892
31952
  const AccountConnectOutput = union([string(), AccountConnectStateOutput]);
31893
31953
  const AccountDisconnectOutput = object({
31894
31954
  platform: _enum(["linkedin", "x"]),
@@ -32022,6 +32082,20 @@ const runConnectStep = async (deps, platform, listConnected, connectURL) => {
32022
32082
  });
32023
32083
  return;
32024
32084
  }
32085
+ const billing = await deps.client.billing.prepareAccountConnect();
32086
+ if (!billing.canConnect) {
32087
+ if (!billing.seats) throw new Error("billing_prepare_missing_seats");
32088
+ if (billing.paymentURL) writeText(deps, `Open this URL: ${billing.paymentURL}`);
32089
+ else if (billing.requiredAction) writeText(deps, billing.requiredAction.reason);
32090
+ await writeOutput(deps, {
32091
+ status: "pending_billing",
32092
+ platform,
32093
+ paymentURL: billing.paymentURL ?? null,
32094
+ requiredAction: billing.requiredAction ?? null,
32095
+ seats: billing.seats
32096
+ });
32097
+ return;
32098
+ }
32025
32099
  const url = await connectURL();
32026
32100
  writeText(deps, `Open this URL: ${url}`);
32027
32101
  await writeOutput(deps, {