@optima-chat/dev-skills 0.7.32 → 0.7.35
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/AGENTS.md +2 -0
- package/bin/helpers/billing-http.ts +162 -0
- package/bin/helpers/confirm-prompt.ts +23 -0
- package/bin/helpers/db-utils.ts +38 -2
- package/bin/helpers/entitlement/grant.ts +70 -0
- package/bin/helpers/entitlement/list.ts +77 -0
- package/bin/helpers/entitlement/revoke.ts +116 -0
- package/bin/helpers/entitlement.ts +32 -0
- package/bin/helpers/infisical-secrets.ts +41 -0
- package/bin/helpers/product/add-channel.ts +78 -0
- package/bin/helpers/product/create.ts +96 -0
- package/bin/helpers/product/show.ts +43 -0
- package/bin/helpers/product/toggle-channel.ts +56 -0
- package/bin/helpers/product/update.ts +72 -0
- package/bin/helpers/product.ts +46 -0
- package/dist/bin/helpers/billing-http.js +139 -0
- package/dist/bin/helpers/confirm-prompt.js +54 -0
- package/dist/bin/helpers/db-utils.js +36 -3
- package/dist/bin/helpers/entitlement/grant.js +73 -0
- package/dist/bin/helpers/entitlement/list.js +62 -0
- package/dist/bin/helpers/entitlement/revoke.js +105 -0
- package/dist/bin/helpers/entitlement.js +39 -0
- package/dist/bin/helpers/generate-test-token.js +0 -0
- package/dist/bin/helpers/grant-balance.js +0 -0
- package/dist/bin/helpers/grant-credits.js +71 -0
- package/dist/bin/helpers/grant-subscription.js +0 -0
- package/dist/bin/helpers/infisical-secrets.js +33 -0
- package/dist/bin/helpers/product/add-channel.js +95 -0
- package/dist/bin/helpers/product/create.js +124 -0
- package/dist/bin/helpers/product/show.js +46 -0
- package/dist/bin/helpers/product/toggle-channel.js +61 -0
- package/dist/bin/helpers/product/update.js +92 -0
- package/dist/bin/helpers/product.js +53 -0
- package/dist/bin/helpers/query-db.js +0 -0
- package/dist/bin/helpers/show-env.js +0 -0
- package/docs/superpowers/plans/2026-05-24-marketplace-admin-cli-impl.md +1973 -0
- package/docs/superpowers/specs/2026-05-24-marketplace-admin-cli-design.md +324 -0
- package/package.json +7 -5
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runUpdate = runUpdate;
|
|
4
|
+
const billing_http_1 = require("../billing-http");
|
|
5
|
+
function parseArgs(argv) {
|
|
6
|
+
if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
|
|
7
|
+
console.log(`Usage: optima-product update --key <productKey> [options]
|
|
8
|
+
|
|
9
|
+
Required:
|
|
10
|
+
--key <productKey>
|
|
11
|
+
|
|
12
|
+
Optional (PATCH — only included fields are updated):
|
|
13
|
+
--refund-window-days N | null
|
|
14
|
+
--refund-prorate-max-days N | null
|
|
15
|
+
--bundled-plan-id <planId> | null (joint with --bundled-duration-days)
|
|
16
|
+
--bundled-duration-days N | null
|
|
17
|
+
--revoke-bundled-on-refund true|false
|
|
18
|
+
--metadata '<json>' FULL REPLACE — Prisma does not deep-merge JSON
|
|
19
|
+
--env stage|prod (default: stage)
|
|
20
|
+
|
|
21
|
+
Note: productKey, type, and pluginSlugs are immutable post-create. To change plugin
|
|
22
|
+
membership, create a new Product with a new key.`);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
const out = { env: 'stage' };
|
|
26
|
+
for (let i = 0; i < argv.length; i++) {
|
|
27
|
+
const a = argv[i];
|
|
28
|
+
const next = argv[i + 1];
|
|
29
|
+
const parseNullable = (v) => v === 'null' ? null : parseInt(v, 10);
|
|
30
|
+
switch (a) {
|
|
31
|
+
case '--key':
|
|
32
|
+
out.key = next;
|
|
33
|
+
i++;
|
|
34
|
+
break;
|
|
35
|
+
case '--refund-window-days':
|
|
36
|
+
out.refundWindowDays = parseNullable(next);
|
|
37
|
+
i++;
|
|
38
|
+
break;
|
|
39
|
+
case '--refund-prorate-max-days':
|
|
40
|
+
out.refundProrateMaxDays = parseNullable(next);
|
|
41
|
+
i++;
|
|
42
|
+
break;
|
|
43
|
+
case '--bundled-plan-id':
|
|
44
|
+
out.bundledPlanId = next === 'null' ? null : next;
|
|
45
|
+
i++;
|
|
46
|
+
break;
|
|
47
|
+
case '--bundled-duration-days':
|
|
48
|
+
out.bundledDurationDays = parseNullable(next);
|
|
49
|
+
i++;
|
|
50
|
+
break;
|
|
51
|
+
case '--revoke-bundled-on-refund':
|
|
52
|
+
out.revokeBundledOnRefund = next === 'true';
|
|
53
|
+
i++;
|
|
54
|
+
break;
|
|
55
|
+
case '--metadata':
|
|
56
|
+
out.metadata = JSON.parse(next);
|
|
57
|
+
i++;
|
|
58
|
+
break;
|
|
59
|
+
case '--env':
|
|
60
|
+
out.env = next;
|
|
61
|
+
i++;
|
|
62
|
+
break;
|
|
63
|
+
default: throw new Error(`Unknown arg: ${a}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!out.key)
|
|
67
|
+
throw new Error('--key required');
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
async function runUpdate(argv) {
|
|
71
|
+
const args = parseArgs(argv);
|
|
72
|
+
(0, billing_http_1.validateEnv)(args.env);
|
|
73
|
+
const body = {};
|
|
74
|
+
if (args.refundWindowDays !== undefined)
|
|
75
|
+
body.refundWindowDays = args.refundWindowDays;
|
|
76
|
+
if (args.refundProrateMaxDays !== undefined)
|
|
77
|
+
body.refundProrateMaxDays = args.refundProrateMaxDays;
|
|
78
|
+
if (args.bundledPlanId !== undefined)
|
|
79
|
+
body.bundledPlanId = args.bundledPlanId;
|
|
80
|
+
if (args.bundledDurationDays !== undefined)
|
|
81
|
+
body.bundledDurationDays = args.bundledDurationDays;
|
|
82
|
+
if (args.revokeBundledOnRefund !== undefined)
|
|
83
|
+
body.revokeBundledOnRefund = args.revokeBundledOnRefund;
|
|
84
|
+
if (args.metadata !== undefined)
|
|
85
|
+
body.metadata = args.metadata;
|
|
86
|
+
if (Object.keys(body).length === 0)
|
|
87
|
+
throw new Error('At least one updatable field must be passed');
|
|
88
|
+
console.log(`\n✏️ Updating product ${args.key} on ${args.env.toUpperCase()}...`);
|
|
89
|
+
const res = await (0, billing_http_1.callBilling)(args.env, 'PATCH', `/api/billing/admin/products/${encodeURIComponent(args.key)}`, body);
|
|
90
|
+
console.log(`✓ Updated Product (HTTP ${res.status}):`);
|
|
91
|
+
console.log(JSON.stringify(res.body, null, 2));
|
|
92
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const create_1 = require("./product/create");
|
|
5
|
+
const update_1 = require("./product/update");
|
|
6
|
+
const add_channel_1 = require("./product/add-channel");
|
|
7
|
+
const toggle_channel_1 = require("./product/toggle-channel");
|
|
8
|
+
const show_1 = require("./product/show");
|
|
9
|
+
const SUBCOMMANDS = ['create', 'update', 'add-channel', 'toggle-channel', 'show'];
|
|
10
|
+
function printHelp() {
|
|
11
|
+
console.log(`Usage: optima-product <subcommand> [options]
|
|
12
|
+
|
|
13
|
+
Subcommands:
|
|
14
|
+
create Create a Product bundling 1+ plugin slugs
|
|
15
|
+
update Patch refund policy / metadata on an existing Product
|
|
16
|
+
add-channel Attach a payment channel (Stripe Price ID) to a Product
|
|
17
|
+
toggle-channel Enable/disable an existing channel
|
|
18
|
+
show Show a Product's bare row (note: does NOT include plugins/channels)
|
|
19
|
+
|
|
20
|
+
Run 'optima-product <subcommand> --help' for subcommand-specific options.`);
|
|
21
|
+
}
|
|
22
|
+
async function main() {
|
|
23
|
+
const [, , subcommand, ...rest] = process.argv;
|
|
24
|
+
if (!subcommand || subcommand === '-h' || subcommand === '--help') {
|
|
25
|
+
printHelp();
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
switch (subcommand) {
|
|
29
|
+
case 'create':
|
|
30
|
+
await (0, create_1.runCreate)(rest);
|
|
31
|
+
break;
|
|
32
|
+
case 'update':
|
|
33
|
+
await (0, update_1.runUpdate)(rest);
|
|
34
|
+
break;
|
|
35
|
+
case 'add-channel':
|
|
36
|
+
await (0, add_channel_1.runAddChannel)(rest);
|
|
37
|
+
break;
|
|
38
|
+
case 'toggle-channel':
|
|
39
|
+
await (0, toggle_channel_1.runToggleChannel)(rest);
|
|
40
|
+
break;
|
|
41
|
+
case 'show':
|
|
42
|
+
await (0, show_1.runShow)(rest);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
console.error(`Unknown subcommand: ${subcommand}`);
|
|
46
|
+
printHelp();
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
main().catch((err) => {
|
|
51
|
+
console.error(err.message);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
});
|
|
File without changes
|
|
File without changes
|