@ssheleg/sheleg-dev 0.6.0 → 0.7.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +256 -0
  2. package/README.md +101 -1
  3. package/SECURITY.md +190 -52
  4. package/bin/sheleg-dev.js +18 -0
  5. package/package.json +2 -2
  6. package/plugins/sheleg-dev/.claude-plugin/plugin.json +1 -1
  7. package/plugins/sheleg-dev/hooks/hooks.json +29 -0
  8. package/plugins/sheleg-dev/hooks/lib/moneygate.js +587 -0
  9. package/plugins/sheleg-dev/hooks/money-gate.js +68 -0
  10. package/plugins/sheleg-dev/skills/ad-tracking/SKILL.md +7 -3
  11. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/README.md +76 -0
  12. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/assert-dedup-contract.mjs +249 -0
  13. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/manifest.json +75 -0
  14. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/purchase-capi-from-thank-you-page.json +32 -0
  15. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/purchase-capi-server.json +26 -0
  16. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/purchase-pixel-browser.json +12 -0
  17. package/plugins/sheleg-dev/skills/ad-tracking/fixtures/reference-emitter.mjs +129 -0
  18. package/plugins/sheleg-dev/skills/ad-tracking/references/meta-linkedin.md +13 -1
  19. package/plugins/sheleg-dev/skills/crypto-payments/SKILL.md +68 -0
  20. package/plugins/sheleg-dev/skills/crypto-payments/references/heleket-provider.md +349 -10
  21. package/plugins/sheleg-dev/skills/stripe-billing/SKILL.md +1 -1
  22. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/README.md +110 -0
  23. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/assert-money-invariants.mjs +404 -0
  24. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/charge-refunded-partial.json +52 -0
  25. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/charge-refunded-remainder.json +63 -0
  26. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/checkout-session-async-payment-failed.json +43 -0
  27. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/checkout-session-completed-async-unpaid.json +43 -0
  28. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/checkout-session-completed-paid.json +42 -0
  29. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/invoice-paid-subscription-cycle-next-period.json +70 -0
  30. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/invoice-paid-subscription-cycle-redelivery.json +70 -0
  31. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/invoice-paid-subscription-cycle.json +61 -0
  32. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/invoice-paid-subscription-update-proration.json +90 -0
  33. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/manifest.json +172 -0
  34. package/plugins/sheleg-dev/skills/stripe-billing/fixtures/reference-handler.mjs +315 -0
  35. package/plugins/sheleg-dev/skills/stripe-billing/references/testing-and-local-dev.md +38 -2
  36. package/plugins/sheleg-dev/skills/stripe-billing/references/webhook-events.md +43 -1
@@ -0,0 +1,70 @@
1
+ {
2
+ "id": "evt_PLACEHOLDER_cycle_feb",
3
+ "object": "event",
4
+ "api_version": "2026-07-29.dahlia",
5
+ "created": 1769904000,
6
+ "livemode": false,
7
+ "pending_webhooks": 1,
8
+ "request": {
9
+ "id": null,
10
+ "idempotency_key": null
11
+ },
12
+ "type": "invoice.paid",
13
+ "data": {
14
+ "object": {
15
+ "id": "in_PLACEHOLDER_feb",
16
+ "object": "invoice",
17
+ "status": "paid",
18
+ "billing_reason": "subscription_cycle",
19
+ "collection_method": "charge_automatically",
20
+ "currency": "usd",
21
+ "customer": "cus_PLACEHOLDER_alice",
22
+ "amount_due": 2900,
23
+ "amount_paid": 2900,
24
+ "amount_remaining": 0,
25
+ "attempt_count": 1,
26
+ "charge": "ch_PLACEHOLDER_feb",
27
+ "period_start": 1769904000,
28
+ "period_end": 1772323200,
29
+ "parent": {
30
+ "type": "subscription_details",
31
+ "subscription_details": {
32
+ "subscription": "sub_PLACEHOLDER_alice",
33
+ "metadata": {
34
+ "userId": "usr_PLACEHOLDER_alice",
35
+ "productId": "prod_PLACEHOLDER_pro",
36
+ "quantity": "1",
37
+ "conversionEventId": "evtid_PLACEHOLDER_purchase_feb"
38
+ }
39
+ }
40
+ },
41
+ "lines": {
42
+ "object": "list",
43
+ "has_more": false,
44
+ "total_count": 1,
45
+ "data": [
46
+ {
47
+ "id": "il_PLACEHOLDER_feb",
48
+ "object": "line_item",
49
+ "amount": 2900,
50
+ "currency": "usd",
51
+ "quantity": 1,
52
+ "proration": false,
53
+ "subscription_item": "si_PLACEHOLDER_alice",
54
+ "period": {
55
+ "start": 1769904000,
56
+ "end": 1772323200
57
+ },
58
+ "pricing": {
59
+ "type": "price_details",
60
+ "price_details": {
61
+ "price": "price_PLACEHOLDER_pro_monthly",
62
+ "product": "prod_PLACEHOLDER_pro"
63
+ }
64
+ }
65
+ }
66
+ ]
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "id": "evt_PLACEHOLDER_cycle_jan",
3
+ "object": "event",
4
+ "api_version": "2026-07-29.dahlia",
5
+ "created": 1767225600,
6
+ "livemode": false,
7
+ "pending_webhooks": 0,
8
+ "request": {
9
+ "id": null,
10
+ "idempotency_key": null
11
+ },
12
+ "type": "invoice.paid",
13
+ "data": {
14
+ "object": {
15
+ "id": "in_PLACEHOLDER_jan",
16
+ "object": "invoice",
17
+ "status": "paid",
18
+ "billing_reason": "subscription_cycle",
19
+ "collection_method": "charge_automatically",
20
+ "currency": "usd",
21
+ "customer": "cus_PLACEHOLDER_alice",
22
+ "amount_due": 2900,
23
+ "amount_paid": 2900,
24
+ "amount_remaining": 0,
25
+ "attempt_count": 1,
26
+ "charge": "ch_PLACEHOLDER_jan",
27
+ "period_start": 1767225600,
28
+ "period_end": 1769904000,
29
+ "parent": {
30
+ "type": "subscription_details",
31
+ "subscription_details": {
32
+ "subscription": "sub_PLACEHOLDER_alice",
33
+ "metadata": {
34
+ "userId": "usr_PLACEHOLDER_alice",
35
+ "productId": "prod_PLACEHOLDER_pro",
36
+ "quantity": "1",
37
+ "conversionEventId": "evtid_PLACEHOLDER_purchase_jan"
38
+ }
39
+ }
40
+ },
41
+ "lines": {
42
+ "object": "list",
43
+ "has_more": false,
44
+ "total_count": 1,
45
+ "data": [
46
+ {
47
+ "id": "il_PLACEHOLDER_jan",
48
+ "object": "line_item",
49
+ "amount": 2900,
50
+ "currency": "usd",
51
+ "quantity": 1,
52
+ "proration": false,
53
+ "subscription_item": "si_PLACEHOLDER_alice",
54
+ "period": {
55
+ "start": 1767225600,
56
+ "end": 1769904000
57
+ },
58
+ "pricing": {
59
+ "type": "price_details",
60
+ "price_details": {
61
+ "price": "price_PLACEHOLDER_pro_monthly",
62
+ "product": "prod_PLACEHOLDER_pro"
63
+ }
64
+ }
65
+ }
66
+ ]
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "evt_PLACEHOLDER_cycle_jan",
3
+ "object": "event",
4
+ "api_version": "2026-07-29.dahlia",
5
+ "created": 1767225600,
6
+ "livemode": false,
7
+ "pending_webhooks": 1,
8
+ "request": { "id": null, "idempotency_key": null },
9
+ "type": "invoice.paid",
10
+ "data": {
11
+ "object": {
12
+ "id": "in_PLACEHOLDER_jan",
13
+ "object": "invoice",
14
+ "status": "paid",
15
+ "billing_reason": "subscription_cycle",
16
+ "collection_method": "charge_automatically",
17
+ "currency": "usd",
18
+ "customer": "cus_PLACEHOLDER_alice",
19
+ "amount_due": 2900,
20
+ "amount_paid": 2900,
21
+ "amount_remaining": 0,
22
+ "attempt_count": 1,
23
+ "charge": "ch_PLACEHOLDER_jan",
24
+ "period_start": 1767225600,
25
+ "period_end": 1769904000,
26
+ "parent": {
27
+ "type": "subscription_details",
28
+ "subscription_details": {
29
+ "subscription": "sub_PLACEHOLDER_alice",
30
+ "metadata": {
31
+ "userId": "usr_PLACEHOLDER_alice",
32
+ "productId": "prod_PLACEHOLDER_pro",
33
+ "quantity": "1",
34
+ "conversionEventId": "evtid_PLACEHOLDER_purchase_jan"
35
+ }
36
+ }
37
+ },
38
+ "lines": {
39
+ "object": "list",
40
+ "has_more": false,
41
+ "total_count": 1,
42
+ "data": [
43
+ {
44
+ "id": "il_PLACEHOLDER_jan",
45
+ "object": "line_item",
46
+ "amount": 2900,
47
+ "currency": "usd",
48
+ "quantity": 1,
49
+ "proration": false,
50
+ "subscription_item": "si_PLACEHOLDER_alice",
51
+ "period": { "start": 1767225600, "end": 1769904000 },
52
+ "pricing": {
53
+ "type": "price_details",
54
+ "price_details": { "price": "price_PLACEHOLDER_pro_monthly", "product": "prod_PLACEHOLDER_pro" }
55
+ }
56
+ }
57
+ ]
58
+ }
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "id": "evt_PLACEHOLDER_proration_jan15",
3
+ "object": "event",
4
+ "api_version": "2026-07-29.dahlia",
5
+ "created": 1768435200,
6
+ "livemode": false,
7
+ "pending_webhooks": 1,
8
+ "request": {
9
+ "id": null,
10
+ "idempotency_key": null
11
+ },
12
+ "type": "invoice.paid",
13
+ "data": {
14
+ "object": {
15
+ "id": "in_PLACEHOLDER_proration",
16
+ "object": "invoice",
17
+ "status": "paid",
18
+ "billing_reason": "subscription_update",
19
+ "collection_method": "charge_automatically",
20
+ "currency": "usd",
21
+ "customer": "cus_PLACEHOLDER_alice",
22
+ "amount_due": 4000,
23
+ "amount_paid": 4000,
24
+ "amount_remaining": 0,
25
+ "attempt_count": 1,
26
+ "charge": "ch_PLACEHOLDER_proration",
27
+ "period_start": 1768435200,
28
+ "period_end": 1768435200,
29
+ "parent": {
30
+ "type": "subscription_details",
31
+ "subscription_details": {
32
+ "subscription": "sub_PLACEHOLDER_alice",
33
+ "metadata": {
34
+ "userId": "usr_PLACEHOLDER_alice",
35
+ "productId": "prod_PLACEHOLDER_pro",
36
+ "quantity": "2",
37
+ "conversionEventId": "evtid_PLACEHOLDER_proration_jan15"
38
+ }
39
+ }
40
+ },
41
+ "lines": {
42
+ "object": "list",
43
+ "has_more": false,
44
+ "total_count": 2,
45
+ "data": [
46
+ {
47
+ "id": "il_PLACEHOLDER_proration_credit",
48
+ "object": "line_item",
49
+ "amount": -1450,
50
+ "currency": "usd",
51
+ "quantity": 1,
52
+ "proration": true,
53
+ "subscription_item": "si_PLACEHOLDER_alice",
54
+ "period": {
55
+ "start": 1768435200,
56
+ "end": 1769904000
57
+ },
58
+ "pricing": {
59
+ "type": "price_details",
60
+ "price_details": {
61
+ "price": "price_PLACEHOLDER_pro_monthly",
62
+ "product": "prod_PLACEHOLDER_pro"
63
+ }
64
+ }
65
+ },
66
+ {
67
+ "id": "il_PLACEHOLDER_proration_charge",
68
+ "object": "line_item",
69
+ "amount": 5450,
70
+ "currency": "usd",
71
+ "quantity": 2,
72
+ "proration": true,
73
+ "subscription_item": "si_PLACEHOLDER_alice",
74
+ "period": {
75
+ "start": 1768435200,
76
+ "end": 1769904000
77
+ },
78
+ "pricing": {
79
+ "type": "price_details",
80
+ "price_details": {
81
+ "price": "price_PLACEHOLDER_pro_monthly",
82
+ "product": "prod_PLACEHOLDER_pro"
83
+ }
84
+ }
85
+ }
86
+ ]
87
+ }
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,172 @@
1
+ {
2
+ "skill": "stripe-billing",
3
+ "assertionPack": "assert-money-invariants.mjs",
4
+ "referenceHandler": "reference-handler.mjs",
5
+ "runbook": "README.md",
6
+ "note": "The single home of the invariant -> fixture -> document mapping. test/validate.py in this repository reads it: every fixture must be claimed by a row, every row's fixtures must exist, and every claiming document must still carry its phrase, name the invariant id, and name a path under fixtures/. A claim whose fixture is gone and a fixture nobody claims are both failures.",
7
+ "invariants": [
8
+ {
9
+ "id": "renewal-grants-exactly-once",
10
+ "isolates": "grant-on-renewal",
11
+ "fixtures": [
12
+ "invoice-paid-subscription-cycle.json"
13
+ ],
14
+ "claimedBy": [
15
+ {
16
+ "document": "references/webhook-events.md",
17
+ "phrase": "| `subscription_cycle` | the renewal | **yes** |"
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "id": "proration-invoice-grants-nothing",
23
+ "isolates": "billing-reason",
24
+ "fixtures": [
25
+ "invoice-paid-subscription-cycle.json",
26
+ "invoice-paid-subscription-update-proration.json"
27
+ ],
28
+ "claimedBy": [
29
+ {
30
+ "document": "references/webhook-events.md",
31
+ "phrase": "mid-cycle proration (quantity or plan change)"
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ "id": "sequential-redelivery-grants-once",
37
+ "isolates": "claim",
38
+ "fixtures": [
39
+ "invoice-paid-subscription-cycle.json",
40
+ "invoice-paid-subscription-cycle-redelivery.json"
41
+ ],
42
+ "claimedBy": [
43
+ {
44
+ "document": "references/webhook-events.md",
45
+ "phrase": "- `claimEvent` = `INSERT`; unique violation means duplicate."
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "id": "concurrent-redelivery-grants-once",
51
+ "isolates": "claim",
52
+ "fixtures": [
53
+ "invoice-paid-subscription-cycle.json",
54
+ "invoice-paid-subscription-cycle-redelivery.json"
55
+ ],
56
+ "claimedBy": [
57
+ {
58
+ "document": "references/webhook-events.md",
59
+ "phrase": "A failure to *claim* (database down) is a 503"
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "id": "sequential-redelivery-grants-once-by-count-alone",
65
+ "isolates": null,
66
+ "fixtures": [
67
+ "invoice-paid-subscription-cycle.json",
68
+ "invoice-paid-subscription-cycle-redelivery.json"
69
+ ],
70
+ "claimedBy": [
71
+ {
72
+ "document": "references/testing-and-local-dev.md",
73
+ "phrase": "two mechanisms cover each other"
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "id": "reconciliation-does-not-regrant",
79
+ "isolates": "grant-marker",
80
+ "fixtures": [
81
+ "invoice-paid-subscription-cycle.json"
82
+ ],
83
+ "claimedBy": [
84
+ {
85
+ "document": "references/webhook-events.md",
86
+ "phrase": "Guard the grant with a marker that survives a replay"
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "id": "out-of-order-pair-does-not-rewind-state",
92
+ "isolates": "ordering",
93
+ "fixtures": [
94
+ "invoice-paid-subscription-cycle.json",
95
+ "invoice-paid-subscription-cycle-next-period.json"
96
+ ],
97
+ "claimedBy": [
98
+ {
99
+ "document": "references/webhook-events.md",
100
+ "phrase": "**Never derive state from arrival order.**"
101
+ }
102
+ ]
103
+ },
104
+ {
105
+ "id": "refund-total-is-cumulative",
106
+ "isolates": "cumulative-refund",
107
+ "fixtures": [
108
+ "charge-refunded-partial.json",
109
+ "charge-refunded-remainder.json"
110
+ ],
111
+ "claimedBy": [
112
+ {
113
+ "document": "references/webhook-events.md",
114
+ "phrase": "`amount_refunded` is **cumulative**."
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ "id": "duplicate-refund-claws-back-once",
120
+ "isolates": null,
121
+ "fixtures": [
122
+ "charge-refunded-partial.json"
123
+ ],
124
+ "claimedBy": [
125
+ {
126
+ "document": "references/testing-and-local-dev.md",
127
+ "phrase": "two mechanisms cover each other"
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "id": "unpaid-session-grants-nothing",
133
+ "isolates": "async-gate",
134
+ "fixtures": [
135
+ "checkout-session-completed-async-unpaid.json",
136
+ "checkout-session-async-payment-failed.json"
137
+ ],
138
+ "claimedBy": [
139
+ {
140
+ "document": "references/webhook-events.md",
141
+ "phrase": "grant belongs to `async_payment_succeeded`"
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ "id": "paid-session-grants-once",
147
+ "isolates": "grant-on-checkout",
148
+ "fixtures": [
149
+ "checkout-session-completed-paid.json"
150
+ ],
151
+ "claimedBy": [
152
+ {
153
+ "document": "references/webhook-events.md",
154
+ "phrase": "Uniqueness key: the subscription id for subscriptions, the payment intent id"
155
+ }
156
+ ]
157
+ },
158
+ {
159
+ "id": "conversion-id-survives-the-session",
160
+ "isolates": "conversion-id-from-metadata",
161
+ "fixtures": [
162
+ "invoice-paid-subscription-cycle.json"
163
+ ],
164
+ "claimedBy": [
165
+ {
166
+ "document": "references/testing-and-local-dev.md",
167
+ "phrase": "the id the browser will reuse"
168
+ }
169
+ ]
170
+ }
171
+ ]
172
+ }