@usesocial/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/CHANGELOG.md +6 -0
- package/README.md +13 -3
- package/dist/index.d.mts +2 -4
- package/dist/index.mjs +101 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @usesocial/cli
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#29](https://github.com/usesocial/monorepo/pull/29) [`f99f1b3`](https://github.com/usesocial/monorepo/commit/f99f1b3da1215c74a1044aac3aed210604562fcc) Thanks [@CyrusNuevoDia](https://github.com/CyrusNuevoDia)! - Add `social account billing` and `social account billing portal` for CLI billing status and hosted portal handoff.
|
|
8
|
+
|
|
3
9
|
## 0.4.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ stdin; if stdin parses as JSON but is not an object, the command rejects it.
|
|
|
90
90
|
|
|
91
91
|
| Command | Description |
|
|
92
92
|
|---|---|
|
|
93
|
-
| `social account` | Show auth state and connected accounts; login, logout, connect accounts, inspect usage/logs, and configure local CLI settings. |
|
|
93
|
+
| `social account` | Show auth state and connected accounts; login, logout, connect accounts, inspect billing/usage/logs, and configure local CLI settings. |
|
|
94
94
|
| `social schema` | Print the compact command tree, inspect one command with `social schema "<command path>"`, or emit agent command contracts with `social schema --leaves`. |
|
|
95
95
|
| `social x <…>` | X operations (below). |
|
|
96
96
|
| `social linkedin <…>` | LinkedIn operations (below). |
|
|
@@ -108,6 +108,8 @@ stdin; if stdin parses as JSON but is not an object, the command rejects it.
|
|
|
108
108
|
| `reconnect x <account>` | Re-auth an existing X account by opening or printing an OAuth URL. | ✎ write |
|
|
109
109
|
| `disconnect linkedin <account>` | Disconnect a LinkedIn account. | ✎ write |
|
|
110
110
|
| `disconnect x <account>` | Disconnect an X account. | ✎ write |
|
|
111
|
+
| `billing` | Show seats, subscription, and current usage billing. | |
|
|
112
|
+
| `billing portal` | Open the hosted billing portal and print its URL. | |
|
|
111
113
|
| `usage` | Aggregate proxy usage and billing stats. | |
|
|
112
114
|
| `logs` | Recent proxy calls. | |
|
|
113
115
|
| `config cache mode` | Read or set the cache mode preset. | |
|
|
@@ -227,6 +229,11 @@ namespace, verified session when available, and connected accounts.
|
|
|
227
229
|
`social account login` requires an interactive terminal and is not supported from CI,
|
|
228
230
|
background jobs, or agent-mediated setup flows.
|
|
229
231
|
|
|
232
|
+
`social account billing` prints the current seat/subscription snapshot plus
|
|
233
|
+
aggregate usage billing. `social account billing portal` opens the hosted billing
|
|
234
|
+
portal when possible and always prints the portal URL as JSON; use the portal for
|
|
235
|
+
payment methods, invoices, plan changes, seat changes, and cancellation.
|
|
236
|
+
|
|
230
237
|
## Cache config
|
|
231
238
|
|
|
232
239
|
Allowlisted GET requests use a local proxy cache. Cacheable commands send
|
|
@@ -266,8 +273,9 @@ social linkedin messages --limit 20 | jq '{cost: .meta.cost, cursor: .meta.curso
|
|
|
266
273
|
social x bookmarks --limit 20 | jq '{cost: .meta.cost, cursor: .meta.cursor}'
|
|
267
274
|
```
|
|
268
275
|
|
|
269
|
-
Agents should watch `.meta.cost` during high-fanout loops
|
|
270
|
-
|
|
276
|
+
Agents should watch `.meta.cost` during high-fanout loops, use `social account billing`
|
|
277
|
+
for the current plan snapshot, and use `social account usage` or `social account logs`
|
|
278
|
+
after a run to summarize actual spend.
|
|
271
279
|
|
|
272
280
|
## Account safety
|
|
273
281
|
|
|
@@ -300,6 +308,8 @@ echo "gm" | social x post
|
|
|
300
308
|
social linkedin post < draft.md
|
|
301
309
|
|
|
302
310
|
# Usage / billing
|
|
311
|
+
social account billing
|
|
312
|
+
social account billing portal
|
|
303
313
|
social account usage
|
|
304
314
|
social account logs --limit 20 --from 2026-05-01T00:00:00Z
|
|
305
315
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1377,16 +1377,14 @@ declare const createSocialCommand: (deps?: {
|
|
|
1377
1377
|
disconnect: any;
|
|
1378
1378
|
};
|
|
1379
1379
|
billing: {
|
|
1380
|
-
status: () => Promise<
|
|
1381
|
-
canConnect: any;
|
|
1382
|
-
seats: any;
|
|
1383
|
-
}>;
|
|
1380
|
+
status: () => Promise<any>;
|
|
1384
1381
|
prepareAccountConnect: () => Promise<{
|
|
1385
1382
|
canConnect: any;
|
|
1386
1383
|
paymentURL: any;
|
|
1387
1384
|
requiredAction: any;
|
|
1388
1385
|
seats: any;
|
|
1389
1386
|
}>;
|
|
1387
|
+
portalURL: any;
|
|
1390
1388
|
};
|
|
1391
1389
|
usage: {
|
|
1392
1390
|
summary: any;
|
package/dist/index.mjs
CHANGED
|
@@ -21110,7 +21110,7 @@ const createInstance = (defaults) => {
|
|
|
21110
21110
|
const ky = createInstance();
|
|
21111
21111
|
//#endregion
|
|
21112
21112
|
//#region package.json
|
|
21113
|
-
var version$1 = "0.
|
|
21113
|
+
var version$1 = "0.5.0";
|
|
21114
21114
|
//#endregion
|
|
21115
21115
|
//#region src/lib/env.ts
|
|
21116
21116
|
const URLWithTrailingSlash = url().transform(ensureTrailingSlash);
|
|
@@ -22038,6 +22038,102 @@ const configCommand = defineCommand({
|
|
|
22038
22038
|
}) }
|
|
22039
22039
|
});
|
|
22040
22040
|
//#endregion
|
|
22041
|
+
//#region src/billing/index.ts
|
|
22042
|
+
const readAuthContract$1 = {
|
|
22043
|
+
required: true,
|
|
22044
|
+
scope: "read"
|
|
22045
|
+
};
|
|
22046
|
+
const BillingOutput = object({
|
|
22047
|
+
seats: object({
|
|
22048
|
+
total: number().int().nonnegative(),
|
|
22049
|
+
used: number().int().nonnegative(),
|
|
22050
|
+
available: number().int().nonnegative()
|
|
22051
|
+
}),
|
|
22052
|
+
subscription: object({
|
|
22053
|
+
active: boolean$1(),
|
|
22054
|
+
quantity: number().int().nonnegative(),
|
|
22055
|
+
currentPeriodEnd: string().nullable()
|
|
22056
|
+
}).nullable(),
|
|
22057
|
+
usage: object({
|
|
22058
|
+
calls: object({ total: number().int().nonnegative() }),
|
|
22059
|
+
credits: object({
|
|
22060
|
+
available: number().nonnegative(),
|
|
22061
|
+
used: number().nonnegative(),
|
|
22062
|
+
additional: number().nonnegative()
|
|
22063
|
+
}),
|
|
22064
|
+
billing: object({
|
|
22065
|
+
seats: number().nonnegative(),
|
|
22066
|
+
usage: number().nonnegative()
|
|
22067
|
+
})
|
|
22068
|
+
})
|
|
22069
|
+
});
|
|
22070
|
+
const BillingPortalOutput = object({
|
|
22071
|
+
url: string(),
|
|
22072
|
+
opened: boolean$1()
|
|
22073
|
+
});
|
|
22074
|
+
const writeOutput$2 = async (deps, value) => {
|
|
22075
|
+
if (deps.writeOutput) {
|
|
22076
|
+
await deps.writeOutput(value);
|
|
22077
|
+
return;
|
|
22078
|
+
}
|
|
22079
|
+
printData(value);
|
|
22080
|
+
};
|
|
22081
|
+
const clientFrom = (deps) => deps.client ?? createORPCAPIClient();
|
|
22082
|
+
const createBillingCommand = (deps = {}) => {
|
|
22083
|
+
const portal = defineCommand({
|
|
22084
|
+
meta: commandMeta({
|
|
22085
|
+
name: "portal",
|
|
22086
|
+
description: "Open the hosted billing portal.",
|
|
22087
|
+
capability: "read",
|
|
22088
|
+
contract: {
|
|
22089
|
+
capability: "read",
|
|
22090
|
+
auth: readAuthContract$1,
|
|
22091
|
+
mutates: false,
|
|
22092
|
+
outputSchema: BillingPortalOutput,
|
|
22093
|
+
confirmation: {
|
|
22094
|
+
required: true,
|
|
22095
|
+
reason: "Opens a hosted billing portal where payment methods, seats, plan, and cancellation can be managed."
|
|
22096
|
+
},
|
|
22097
|
+
hazards: [{
|
|
22098
|
+
code: "billing_portal_handoff",
|
|
22099
|
+
message: "Hosted billing portal handoff; billing changes happen outside the CLI after the URL opens."
|
|
22100
|
+
}]
|
|
22101
|
+
}
|
|
22102
|
+
}),
|
|
22103
|
+
run: async () => {
|
|
22104
|
+
const { url } = await clientFrom(deps).billing.portalURL();
|
|
22105
|
+
const result = deps.isInteractiveTerminal?.() === true && deps.openURL !== void 0 ? await deps.openURL?.(url) : void 0;
|
|
22106
|
+
await writeOutput$2(deps, {
|
|
22107
|
+
url: result?.url ?? url,
|
|
22108
|
+
opened: result?.opened === true
|
|
22109
|
+
});
|
|
22110
|
+
}
|
|
22111
|
+
});
|
|
22112
|
+
return defineCommand({
|
|
22113
|
+
meta: commandMeta({
|
|
22114
|
+
name: "billing",
|
|
22115
|
+
description: "Show billing status and manage the hosted billing portal.",
|
|
22116
|
+
capability: "read",
|
|
22117
|
+
contract: {
|
|
22118
|
+
capability: "read",
|
|
22119
|
+
auth: readAuthContract$1,
|
|
22120
|
+
mutates: false,
|
|
22121
|
+
outputSchema: BillingOutput
|
|
22122
|
+
}
|
|
22123
|
+
}),
|
|
22124
|
+
subCommands: { portal },
|
|
22125
|
+
run: async () => {
|
|
22126
|
+
const client = clientFrom(deps);
|
|
22127
|
+
const [status, usage] = await Promise.all([client.billing.status(), client.usage.summary({})]);
|
|
22128
|
+
await writeOutput$2(deps, {
|
|
22129
|
+
seats: status.seats,
|
|
22130
|
+
subscription: status.subscription,
|
|
22131
|
+
usage
|
|
22132
|
+
});
|
|
22133
|
+
}
|
|
22134
|
+
});
|
|
22135
|
+
};
|
|
22136
|
+
//#endregion
|
|
22041
22137
|
//#region ../../node_modules/.bun/posthog-node@5.35.6+63120419cc93e79b/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
22042
22138
|
function createModulerModifier() {
|
|
22043
22139
|
const getModuleFromFileName = createGetModuleFromFilename();
|
|
@@ -28469,6 +28565,7 @@ const createAccountCommand = (deps) => {
|
|
|
28469
28565
|
})
|
|
28470
28566
|
}
|
|
28471
28567
|
}),
|
|
28568
|
+
billing: createBillingCommand(deps),
|
|
28472
28569
|
usage: createUsageCommand(deps),
|
|
28473
28570
|
logs: createUsageLogsCommand(deps),
|
|
28474
28571
|
config: configCommand
|
|
@@ -28700,11 +28797,7 @@ const createCLIDeps = () => {
|
|
|
28700
28797
|
},
|
|
28701
28798
|
billing: {
|
|
28702
28799
|
status: async () => {
|
|
28703
|
-
|
|
28704
|
-
return {
|
|
28705
|
-
canConnect: status.canConnect,
|
|
28706
|
-
seats: status.seats
|
|
28707
|
-
};
|
|
28800
|
+
return await client.billing.status();
|
|
28708
28801
|
},
|
|
28709
28802
|
prepareAccountConnect: async () => {
|
|
28710
28803
|
const status = await client.billing.prepareAccountConnect();
|
|
@@ -28714,7 +28807,8 @@ const createCLIDeps = () => {
|
|
|
28714
28807
|
requiredAction: status.requiredAction,
|
|
28715
28808
|
seats: status.seats
|
|
28716
28809
|
};
|
|
28717
|
-
}
|
|
28810
|
+
},
|
|
28811
|
+
portalURL: client.billing.portalURL
|
|
28718
28812
|
},
|
|
28719
28813
|
usage: {
|
|
28720
28814
|
summary: client.usage.summary,
|