atmn 1.1.24 → 2.0.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/README.md +120 -0
- package/dist/bin.js +23102 -0
- package/dist/index.js +2906 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -74
- package/src/actions/api/callApi.ts +280 -0
- package/src/actions/api/registerApiCommands.ts +121 -0
- package/src/actions/env/fetchOrgInfo.ts +32 -0
- package/src/actions/env/types/orgInfo.ts +18 -0
- package/src/actions/env.ts +94 -0
- package/src/actions/init/runInit.ts +401 -0
- package/src/actions/login/keyless.ts +135 -0
- package/src/actions/login.ts +144 -0
- package/src/actions/pull/appendPlanVersionFixture.ts +373 -0
- package/src/actions/pull/applyPreview.ts +553 -0
- package/src/actions/pull/applySettingsPreview.ts +114 -0
- package/src/actions/pull/changedFixtureKeys.ts +88 -0
- package/src/actions/pull/listSourceFiles.ts +29 -0
- package/src/actions/pull/locateFixture.ts +78 -0
- package/src/actions/pull/resolveCollectionTarget.ts +198 -0
- package/src/actions/pull/rewriteConfig.ts +57 -0
- package/src/actions/pull/scaffoldConfig.ts +118 -0
- package/src/actions/pull.ts +399 -0
- package/src/actions/push/backfillInternalIds.ts +394 -0
- package/src/actions/push/deprecatedFields.ts +55 -0
- package/src/actions/push.ts +294 -0
- package/src/actions/reset/runReset.ts +58 -0
- package/src/actions/sandbox/createSandbox.ts +83 -0
- package/src/actions/sandbox/deleteSandbox.ts +91 -0
- package/src/actions/sandbox/listSandboxes.ts +28 -0
- package/src/actions/sandbox/types/sandboxClient.ts +16 -0
- package/src/actions/sandbox/useSandbox.ts +157 -0
- package/src/actions/sandbox/withSandboxScopeHint.ts +27 -0
- package/src/actions/skills/skills.ts +246 -0
- package/src/auth/announceAuthorizationUrl.ts +26 -0
- package/src/auth/browser/openSystemBrowser.ts +7 -0
- package/src/auth/browser/tryOpenBrowser.ts +17 -0
- package/src/auth/browser/watchLauncher.ts +46 -0
- package/src/auth/buildAuthorizationUrl.ts +36 -0
- package/src/auth/callbackPages.ts +126 -0
- package/src/auth/createOrgApiKeys.ts +46 -0
- package/src/auth/keyless.ts +119 -0
- package/src/auth/oauthConfig.ts +63 -0
- package/src/auth/runOAuthFlow.ts +230 -0
- package/src/auth/types/browserOpener.ts +5 -0
- package/src/auth/types/impersonationTokens.ts +23 -0
- package/src/auth/types/oauthTokens.ts +13 -0
- package/src/auth/types/orgApiKeys.ts +6 -0
- package/src/bin.ts +9 -0
- package/src/cli.ts +648 -0
- package/src/config/configPackageName.ts +9 -0
- package/src/config/legacyConfig.ts +25 -0
- package/src/config/loadConfig.ts +231 -0
- package/src/env/assertSandboxTarget.ts +20 -0
- package/src/env/loadEnv.ts +184 -0
- package/src/env/resolveTarget.ts +134 -0
- package/src/env/sandboxKeyName.ts +18 -0
- package/src/generated/apiRoutes.ts +3787 -0
- package/src/generated/client.ts +51564 -0
- package/src/generated/emit.ts +1163 -0
- package/src/generated/emitRuntime.ts +522 -0
- package/src/generated/features.ts +146 -0
- package/src/generated/labels.ts +29 -0
- package/src/generated/licenses.ts +287 -0
- package/src/generated/lintRules.ts +2207 -0
- package/src/generated/lintRuntime.ts +865 -0
- package/src/generated/plans.ts +1628 -0
- package/src/generated/referralPrograms.ts +22 -0
- package/src/generated/rewards.ts +58 -0
- package/src/generated/settings.ts +21 -0
- package/src/generated/skills.ts +305 -0
- package/src/generated/variants.ts +934 -0
- package/src/generated/wire.ts +334 -0
- package/src/http/autumnFetch.ts +30 -0
- package/src/index.ts +20 -0
- package/src/project/chooseConfigDir.ts +41 -0
- package/src/project/resolveProject.ts +115 -0
- package/src/project/rootMarker.ts +40 -0
- package/src/prompt/prompt.ts +186 -0
- package/src/prompt/select.ts +162 -0
- package/src/render/renderEnv.ts +77 -0
- package/src/render/renderPreview.ts +945 -0
- package/src/render/renderSandboxes.ts +92 -0
- package/src/render/stripTerminalControls.ts +19 -0
- package/src/repo/findRepoRoot.ts +79 -0
- package/src/surgery/appendPropertyEdit.ts +67 -0
- package/src/surgery/appendToArray.ts +87 -0
- package/src/surgery/appendToBinding.ts +19 -0
- package/src/surgery/appendToCollection.ts +40 -0
- package/src/surgery/appendToFixtureArray.ts +71 -0
- package/src/surgery/arrayBinding.ts +30 -0
- package/src/surgery/deleteFixtureLiteral.ts +81 -0
- package/src/surgery/deleteReference.ts +48 -0
- package/src/surgery/ensureBuilderImport.ts +65 -0
- package/src/surgery/findFixture.ts +238 -0
- package/src/surgery/fixtureEdit.ts +156 -0
- package/src/surgery/fixtureLocation.ts +32 -0
- package/src/surgery/insertCollection.ts +86 -0
- package/src/surgery/insertFirstProperty.ts +73 -0
- package/src/surgery/patchFixtureProperty.ts +152 -0
- package/src/surgery/patchSingletonProperty.ts +221 -0
- package/src/surgery/replaceFixture.ts +28 -0
- package/src/surgery/setFixtureProperty.ts +55 -0
- package/src/surgery/staticFixtureRule.ts +48 -0
- package/src/version.ts +5 -0
- package/dist/cli.js +0 -142410
- package/dist/compose/index.js +0 -122
- package/dist/src/compose/builders/builderFunctions.d.ts +0 -84
- package/dist/src/compose/builders/rewardFunctions.d.ts +0 -5
- package/dist/src/compose/builders/variantFunctions.d.ts +0 -2
- package/dist/src/compose/index.d.ts +0 -19
- package/dist/src/compose/models/featureModels.d.ts +0 -262
- package/dist/src/compose/models/index.d.ts +0 -3
- package/dist/src/compose/models/planModels.d.ts +0 -367
- package/dist/src/compose/models/rewardModels.d.ts +0 -52
- package/dist/src/compose/models/variantModels.d.ts +0 -34
- package/readme.md +0 -186
|
@@ -1,367 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
export declare const AdditionalCurrencySchema: z.ZodObject<{
|
|
3
|
-
currency: z.ZodString;
|
|
4
|
-
amount: z.ZodNumber;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
export declare const AdditionalCurrencyTierSchema: z.ZodObject<{
|
|
7
|
-
currency: z.ZodString;
|
|
8
|
-
amount: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
flatAmount: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
}, z.core.$strip>;
|
|
11
|
-
export declare const UsageTierSchema: z.ZodObject<{
|
|
12
|
-
to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
13
|
-
amount: z.ZodNumber;
|
|
14
|
-
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
-
currency: z.ZodString;
|
|
16
|
-
amount: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
flatAmount: z.ZodOptional<z.ZodNumber>;
|
|
18
|
-
}, z.core.$strip>>>;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
type AutoTopupPurchaseLimit = {
|
|
21
|
-
interval: "hour" | "day" | "week" | "month";
|
|
22
|
-
interval_count?: number;
|
|
23
|
-
limit: number;
|
|
24
|
-
};
|
|
25
|
-
type AutoTopup = {
|
|
26
|
-
feature_id: string;
|
|
27
|
-
enabled?: boolean;
|
|
28
|
-
threshold: number;
|
|
29
|
-
quantity: number;
|
|
30
|
-
purchase_limit?: AutoTopupPurchaseLimit;
|
|
31
|
-
invoice_mode?: boolean;
|
|
32
|
-
};
|
|
33
|
-
type SpendLimit = {
|
|
34
|
-
feature_id?: string;
|
|
35
|
-
enabled?: boolean;
|
|
36
|
-
limit_type?: "absolute" | "usage_percentage";
|
|
37
|
-
overage_limit?: number;
|
|
38
|
-
skip_overage_billing?: boolean;
|
|
39
|
-
};
|
|
40
|
-
type UsageLimit = {
|
|
41
|
-
feature_id: string;
|
|
42
|
-
enabled?: boolean;
|
|
43
|
-
limit: number;
|
|
44
|
-
interval: "day" | "week" | "month" | "year";
|
|
45
|
-
anchor?: "billing_cycle" | "utc";
|
|
46
|
-
filter?: UsageLimitFilter;
|
|
47
|
-
};
|
|
48
|
-
type UsageLimitFilter = {
|
|
49
|
-
properties: Record<string, string>;
|
|
50
|
-
};
|
|
51
|
-
type UsageAlert = {
|
|
52
|
-
feature_id?: string;
|
|
53
|
-
enabled?: boolean;
|
|
54
|
-
threshold: number;
|
|
55
|
-
threshold_type: "usage" | "usage_percentage" | "remaining" | "remaining_percentage";
|
|
56
|
-
basis?: "balance" | "included" | "recurring" | "usage_limit";
|
|
57
|
-
filter?: UsageLimitFilter;
|
|
58
|
-
name?: string;
|
|
59
|
-
};
|
|
60
|
-
type OverageAllowed = {
|
|
61
|
-
feature_id: string;
|
|
62
|
-
enabled?: boolean;
|
|
63
|
-
};
|
|
64
|
-
export type BillingControls = {
|
|
65
|
-
auto_topups?: AutoTopup[];
|
|
66
|
-
spend_limits?: SpendLimit[];
|
|
67
|
-
usage_limits?: UsageLimit[];
|
|
68
|
-
usage_alerts?: UsageAlert[];
|
|
69
|
-
overage_allowed?: OverageAllowed[];
|
|
70
|
-
};
|
|
71
|
-
export declare const PlanItemSchema: z.ZodObject<{
|
|
72
|
-
featureId: z.ZodString;
|
|
73
|
-
included: z.ZodOptional<z.ZodNumber>;
|
|
74
|
-
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
-
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
-
reset: z.ZodOptional<z.ZodObject<{
|
|
77
|
-
interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"minute">, z.ZodLiteral<"hour">, z.ZodLiteral<"day">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
|
|
78
|
-
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
79
|
-
}, z.core.$strip>>;
|
|
80
|
-
price: z.ZodOptional<z.ZodObject<{
|
|
81
|
-
amount: z.ZodOptional<z.ZodNumber>;
|
|
82
|
-
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
83
|
-
to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
84
|
-
amount: z.ZodNumber;
|
|
85
|
-
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
-
currency: z.ZodString;
|
|
87
|
-
amount: z.ZodOptional<z.ZodNumber>;
|
|
88
|
-
flatAmount: z.ZodOptional<z.ZodNumber>;
|
|
89
|
-
}, z.core.$strip>>>;
|
|
90
|
-
}, z.core.$strip>>>;
|
|
91
|
-
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
92
|
-
currency: z.ZodString;
|
|
93
|
-
amount: z.ZodNumber;
|
|
94
|
-
}, z.core.$strip>>>;
|
|
95
|
-
tier_behavior: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"graduated">, z.ZodLiteral<"volume">]>>;
|
|
96
|
-
interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
|
|
97
|
-
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
98
|
-
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
99
|
-
billing_method: z.ZodUnion<readonly [z.ZodLiteral<"prepaid">, z.ZodLiteral<"usage_based">]>;
|
|
100
|
-
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
101
|
-
}, z.core.$strip>>;
|
|
102
|
-
proration: z.ZodOptional<z.ZodObject<{
|
|
103
|
-
on_increase: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"charge_immediately">]>;
|
|
104
|
-
on_decrease: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"refund_immediately">, z.ZodLiteral<"no_action">]>;
|
|
105
|
-
}, z.core.$strip>>;
|
|
106
|
-
rollover: z.ZodOptional<z.ZodObject<{
|
|
107
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
108
|
-
max_percentage: z.ZodOptional<z.ZodNumber>;
|
|
109
|
-
expiry_duration_type: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"forever">]>;
|
|
110
|
-
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
111
|
-
}, z.core.$strip>>;
|
|
112
|
-
entityFeatureId: z.ZodOptional<z.ZodString>;
|
|
113
|
-
entitlementId: z.ZodOptional<z.ZodString>;
|
|
114
|
-
priceId: z.ZodOptional<z.ZodString>;
|
|
115
|
-
}, z.core.$strip>;
|
|
116
|
-
export declare const FreeTrialSchema: z.ZodObject<{
|
|
117
|
-
durationLength: z.ZodNumber;
|
|
118
|
-
durationType: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"day">, z.ZodLiteral<"month">, z.ZodLiteral<"year">]>>;
|
|
119
|
-
cardRequired: z.ZodDefault<z.ZodBoolean>;
|
|
120
|
-
}, z.core.$strip>;
|
|
121
|
-
export declare const BillingControlsSchema: z.ZodCustom<BillingControls, BillingControls>;
|
|
122
|
-
export declare const PlanLicenseSchema: z.ZodObject<{
|
|
123
|
-
licensePlanId: z.ZodString;
|
|
124
|
-
version: z.ZodOptional<z.ZodNumber>;
|
|
125
|
-
included: z.ZodOptional<z.ZodNumber>;
|
|
126
|
-
}, z.core.$strip>;
|
|
127
|
-
export declare const PlanSchema: z.ZodObject<{
|
|
128
|
-
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
129
|
-
addOn: z.ZodDefault<z.ZodBoolean>;
|
|
130
|
-
autoEnable: z.ZodDefault<z.ZodBoolean>;
|
|
131
|
-
price: z.ZodOptional<z.ZodObject<{
|
|
132
|
-
amount: z.ZodNumber;
|
|
133
|
-
interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
|
|
134
|
-
intervalCount: z.ZodOptional<z.ZodNumber>;
|
|
135
|
-
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
136
|
-
currency: z.ZodString;
|
|
137
|
-
amount: z.ZodNumber;
|
|
138
|
-
}, z.core.$strip>>>;
|
|
139
|
-
}, z.core.$strip>>;
|
|
140
|
-
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
141
|
-
featureId: z.ZodString;
|
|
142
|
-
included: z.ZodOptional<z.ZodNumber>;
|
|
143
|
-
unlimited: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
-
pooled: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
-
reset: z.ZodOptional<z.ZodObject<{
|
|
146
|
-
interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"minute">, z.ZodLiteral<"hour">, z.ZodLiteral<"day">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
|
|
147
|
-
interval_count: z.ZodOptional<z.ZodNumber>;
|
|
148
|
-
}, z.core.$strip>>;
|
|
149
|
-
price: z.ZodOptional<z.ZodObject<{
|
|
150
|
-
amount: z.ZodOptional<z.ZodNumber>;
|
|
151
|
-
tiers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
152
|
-
to: z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"inf">]>;
|
|
153
|
-
amount: z.ZodNumber;
|
|
154
|
-
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
155
|
-
currency: z.ZodString;
|
|
156
|
-
amount: z.ZodOptional<z.ZodNumber>;
|
|
157
|
-
flatAmount: z.ZodOptional<z.ZodNumber>;
|
|
158
|
-
}, z.core.$strip>>>;
|
|
159
|
-
}, z.core.$strip>>>;
|
|
160
|
-
additionalCurrencies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
161
|
-
currency: z.ZodString;
|
|
162
|
-
amount: z.ZodNumber;
|
|
163
|
-
}, z.core.$strip>>>;
|
|
164
|
-
tier_behavior: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"graduated">, z.ZodLiteral<"volume">]>>;
|
|
165
|
-
interval: z.ZodUnion<readonly [z.ZodLiteral<"one_off">, z.ZodLiteral<"week">, z.ZodLiteral<"month">, z.ZodLiteral<"quarter">, z.ZodLiteral<"semi_annual">, z.ZodLiteral<"year">]>;
|
|
166
|
-
interval_count: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
167
|
-
billing_units: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
168
|
-
billing_method: z.ZodUnion<readonly [z.ZodLiteral<"prepaid">, z.ZodLiteral<"usage_based">]>;
|
|
169
|
-
max_purchase: z.ZodOptional<z.ZodNumber>;
|
|
170
|
-
}, z.core.$strip>>;
|
|
171
|
-
proration: z.ZodOptional<z.ZodObject<{
|
|
172
|
-
on_increase: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"charge_immediately">]>;
|
|
173
|
-
on_decrease: z.ZodUnion<readonly [z.ZodLiteral<"prorate">, z.ZodLiteral<"refund_immediately">, z.ZodLiteral<"no_action">]>;
|
|
174
|
-
}, z.core.$strip>>;
|
|
175
|
-
rollover: z.ZodOptional<z.ZodObject<{
|
|
176
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
177
|
-
max_percentage: z.ZodOptional<z.ZodNumber>;
|
|
178
|
-
expiry_duration_type: z.ZodUnion<readonly [z.ZodLiteral<"month">, z.ZodLiteral<"forever">]>;
|
|
179
|
-
expiry_duration_length: z.ZodOptional<z.ZodNumber>;
|
|
180
|
-
}, z.core.$strip>>;
|
|
181
|
-
entityFeatureId: z.ZodOptional<z.ZodString>;
|
|
182
|
-
entitlementId: z.ZodOptional<z.ZodString>;
|
|
183
|
-
priceId: z.ZodOptional<z.ZodString>;
|
|
184
|
-
}, z.core.$strip>>>;
|
|
185
|
-
freeTrial: z.ZodOptional<z.ZodObject<{
|
|
186
|
-
durationLength: z.ZodNumber;
|
|
187
|
-
durationType: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"day">, z.ZodLiteral<"month">, z.ZodLiteral<"year">]>>;
|
|
188
|
-
cardRequired: z.ZodDefault<z.ZodBoolean>;
|
|
189
|
-
}, z.core.$strip>>;
|
|
190
|
-
billingControls: z.ZodOptional<z.ZodCustom<BillingControls, BillingControls>>;
|
|
191
|
-
licenses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
192
|
-
licensePlanId: z.ZodString;
|
|
193
|
-
version: z.ZodOptional<z.ZodNumber>;
|
|
194
|
-
included: z.ZodOptional<z.ZodNumber>;
|
|
195
|
-
}, z.core.$strip>>>;
|
|
196
|
-
id: z.ZodString;
|
|
197
|
-
name: z.ZodString;
|
|
198
|
-
group: z.ZodDefault<z.ZodString>;
|
|
199
|
-
archived: z.ZodOptional<z.ZodBoolean>;
|
|
200
|
-
}, z.core.$strip>;
|
|
201
|
-
export type ResetInterval = "one_off" | "minute" | "hour" | "day" | "week" | "month" | "quarter" | "semi_annual" | "year";
|
|
202
|
-
export type RolloverExpiryDurationType = "month" | "forever";
|
|
203
|
-
export type BillingInterval = "one_off" | "week" | "month" | "quarter" | "semi_annual" | "year";
|
|
204
|
-
export type PlanPriceInterval = "one_off" | "week" | "month" | "quarter" | "semi_annual" | "year";
|
|
205
|
-
export type BillingMethod = "prepaid" | "usage_based";
|
|
206
|
-
export type OnIncrease = "prorate" | "charge_immediately";
|
|
207
|
-
export type OnDecrease = "prorate" | "refund_immediately" | "no_action";
|
|
208
|
-
export type AdditionalCurrency = {
|
|
209
|
-
/** Three-letter ISO currency code (e.g. 'eur', 'gbp') */
|
|
210
|
-
currency: string;
|
|
211
|
-
/** Amount in this currency */
|
|
212
|
-
amount: number;
|
|
213
|
-
};
|
|
214
|
-
export type AdditionalCurrencyTier = {
|
|
215
|
-
/** Three-letter ISO currency code (e.g. 'eur', 'gbp') */
|
|
216
|
-
currency: string;
|
|
217
|
-
/** Per-unit amount for this tier in this currency */
|
|
218
|
-
amount?: number;
|
|
219
|
-
/** Flat amount for this tier in this currency */
|
|
220
|
-
flatAmount?: number;
|
|
221
|
-
};
|
|
222
|
-
type ResetConfig = {
|
|
223
|
-
/** How often usage resets (e.g., 'month', 'day') */
|
|
224
|
-
interval: ResetInterval;
|
|
225
|
-
/** Number of intervals between resets (default: 1) */
|
|
226
|
-
intervalCount?: number;
|
|
227
|
-
};
|
|
228
|
-
type ProrationConfig = {
|
|
229
|
-
/** Behavior when quantity increases */
|
|
230
|
-
onIncrease: OnIncrease;
|
|
231
|
-
/** Behavior when quantity decreases */
|
|
232
|
-
onDecrease: OnDecrease;
|
|
233
|
-
};
|
|
234
|
-
type RolloverConfig = {
|
|
235
|
-
/** Maximum amount that can roll over (null for unlimited). Mutually exclusive with maxPercentage. */
|
|
236
|
-
max?: number | null;
|
|
237
|
-
/** Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max. */
|
|
238
|
-
maxPercentage?: number | null;
|
|
239
|
-
/** How long rollover lasts before expiring */
|
|
240
|
-
expiryDurationType: RolloverExpiryDurationType;
|
|
241
|
-
/** Duration length for rollover expiry */
|
|
242
|
-
expiryDurationLength?: number;
|
|
243
|
-
};
|
|
244
|
-
type PlanItemBaseFields = {
|
|
245
|
-
/** Reference to the feature being configured */
|
|
246
|
-
featureId: string;
|
|
247
|
-
/** The entity feature ID of the product item if applicable */
|
|
248
|
-
entityFeatureId?: string | null;
|
|
249
|
-
/** Amount of usage included in this plan */
|
|
250
|
-
included?: number;
|
|
251
|
-
/** Whether usage is unlimited */
|
|
252
|
-
unlimited?: boolean;
|
|
253
|
-
/** Whether entity-level grants contribute to a shared customer balance */
|
|
254
|
-
pooled?: boolean;
|
|
255
|
-
/** Proration rules for quantity changes */
|
|
256
|
-
proration?: ProrationConfig;
|
|
257
|
-
/** Rollover policy for unused usage */
|
|
258
|
-
rollover?: RolloverConfig;
|
|
259
|
-
};
|
|
260
|
-
type PriceBaseFields = {
|
|
261
|
-
/** Billing method: 'prepaid' or 'usage_based' */
|
|
262
|
-
billingMethod: BillingMethod;
|
|
263
|
-
/** Number of units per billing cycle */
|
|
264
|
-
billingUnits?: number;
|
|
265
|
-
/** Maximum purchasable quantity */
|
|
266
|
-
maxPurchase?: number;
|
|
267
|
-
};
|
|
268
|
-
type PriceWithAmount = PriceBaseFields & {
|
|
269
|
-
/** Price amount */
|
|
270
|
-
amount: number;
|
|
271
|
-
/** Cannot have tiers when using flat amount */
|
|
272
|
-
tiers?: never;
|
|
273
|
-
/** Flat price amounts in additional currencies */
|
|
274
|
-
additionalCurrencies?: AdditionalCurrency[];
|
|
275
|
-
};
|
|
276
|
-
type PriceWithTiers = PriceBaseFields & {
|
|
277
|
-
/** Cannot have flat amount when using tiers */
|
|
278
|
-
amount?: never;
|
|
279
|
-
/** Tiered pricing structure based on usage ranges */
|
|
280
|
-
tiers: Array<{
|
|
281
|
-
to: number | "inf";
|
|
282
|
-
amount: number;
|
|
283
|
-
flatAmount?: number;
|
|
284
|
-
/** Per-tier amounts in additional currencies */
|
|
285
|
-
additionalCurrencies?: AdditionalCurrencyTier[];
|
|
286
|
-
}>;
|
|
287
|
-
/** Required when tiers is defined: how tiers are applied */
|
|
288
|
-
tierBehavior: "graduated" | "volume";
|
|
289
|
-
/** Tiered prices carry additional currencies per tier, not at price level */
|
|
290
|
-
additionalCurrencies?: never;
|
|
291
|
-
};
|
|
292
|
-
type PriceAmountOrTiers = PriceWithAmount | PriceWithTiers;
|
|
293
|
-
type Price = PriceAmountOrTiers & {
|
|
294
|
-
/** Billing interval - omit for one-off pricing */
|
|
295
|
-
interval?: BillingInterval;
|
|
296
|
-
/** Number of intervals between billing cycles (default: 1) */
|
|
297
|
-
intervalCount?: number;
|
|
298
|
-
};
|
|
299
|
-
/** Plan item with a free reset cycle (e.g. 100 messages per month). */
|
|
300
|
-
export type PlanItemWithReset = PlanItemBaseFields & {
|
|
301
|
-
/** Reset configuration for the included allowance */
|
|
302
|
-
reset: ResetConfig;
|
|
303
|
-
price?: never;
|
|
304
|
-
};
|
|
305
|
-
/**
|
|
306
|
-
* Plan item with prepaid or usage-based pricing.
|
|
307
|
-
* Prepaid items may reset on a different cycle from billing.
|
|
308
|
-
*/
|
|
309
|
-
export type PlanItemWithPrice = PlanItemBaseFields & {
|
|
310
|
-
/** Reset configuration when it differs from the billing cycle */
|
|
311
|
-
reset?: ResetConfig;
|
|
312
|
-
/** Pricing configuration */
|
|
313
|
-
price: Price;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Plan item with no reset and no price.
|
|
317
|
-
* Use for continuous-use or boolean features (e.g. seats, feature flags).
|
|
318
|
-
*/
|
|
319
|
-
export type PlanItemNoReset = PlanItemBaseFields & {
|
|
320
|
-
/** No reset for continuous-use features */
|
|
321
|
-
reset?: never;
|
|
322
|
-
/** No price for free/boolean features */
|
|
323
|
-
price?: never;
|
|
324
|
-
};
|
|
325
|
-
/**
|
|
326
|
-
* Plan item configuration:
|
|
327
|
-
* - PlanItemWithReset: included allowance that resets on an interval (e.g. 100/month free)
|
|
328
|
-
* - PlanItemWithPrice: prepaid or usage-based pricing with a billing cycle
|
|
329
|
-
* - PlanItemNoReset: no reset, no price (continuous-use or boolean features)
|
|
330
|
-
*/
|
|
331
|
-
export type PlanItem = PlanItemWithReset | PlanItemWithPrice | PlanItemNoReset;
|
|
332
|
-
export type FreeTrial = z.infer<typeof FreeTrialSchema>;
|
|
333
|
-
export type PlanLicense = z.infer<typeof PlanLicenseSchema>;
|
|
334
|
-
export type Plan = {
|
|
335
|
-
/** Unique identifier for the plan. */
|
|
336
|
-
id: string;
|
|
337
|
-
/** Display name of the plan. */
|
|
338
|
-
name: string;
|
|
339
|
-
/** Optional description of the plan. */
|
|
340
|
-
description?: string | null;
|
|
341
|
-
/** Group identifier for organizing related plans. Plans in the same group are mutually exclusive. */
|
|
342
|
-
group?: string;
|
|
343
|
-
/** If true, this plan can be attached alongside other plans. Otherwise, attaching replaces existing plans in the same group. */
|
|
344
|
-
addOn?: boolean;
|
|
345
|
-
/** If true, plan is automatically attached when a customer is created. Use for free tiers. */
|
|
346
|
-
autoEnable?: boolean;
|
|
347
|
-
/** Base price for the plan */
|
|
348
|
-
price?: {
|
|
349
|
-
/** Price in your currency (e.g., 50 for $50.00) */
|
|
350
|
-
amount: number;
|
|
351
|
-
/** Billing frequency */
|
|
352
|
-
interval: PlanPriceInterval;
|
|
353
|
-
/** Base price amounts in additional currencies */
|
|
354
|
-
additionalCurrencies?: AdditionalCurrency[];
|
|
355
|
-
};
|
|
356
|
-
/** Feature configurations for this plan. Each item defines included units, pricing, and reset behavior. */
|
|
357
|
-
items?: PlanItem[];
|
|
358
|
-
/** Free trial period before billing begins */
|
|
359
|
-
freeTrial?: FreeTrial | null;
|
|
360
|
-
/** Plan-level billing controls used as customer defaults */
|
|
361
|
-
billingControls?: BillingControls;
|
|
362
|
-
/** Plans offered as assignable licenses under this plan. */
|
|
363
|
-
licenses?: PlanLicense[];
|
|
364
|
-
/** Whether the plan is archived */
|
|
365
|
-
archived?: boolean;
|
|
366
|
-
};
|
|
367
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export type RewardDuration = {
|
|
2
|
-
type: "months";
|
|
3
|
-
length: number;
|
|
4
|
-
} | {
|
|
5
|
-
type: "one_off" | "forever";
|
|
6
|
-
length?: never;
|
|
7
|
-
};
|
|
8
|
-
type NonEmptyArray<T> = [T, ...T[]];
|
|
9
|
-
export type CouponReward = {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
type: "percentage_discount" | "fixed_discount";
|
|
13
|
-
value: number;
|
|
14
|
-
duration: RewardDuration;
|
|
15
|
-
planIds?: string[];
|
|
16
|
-
promoCodes?: Array<{
|
|
17
|
-
code: string;
|
|
18
|
-
maxRedemptions?: number;
|
|
19
|
-
firstTimeTransaction?: boolean;
|
|
20
|
-
}>;
|
|
21
|
-
readonly __atmnType?: "reward";
|
|
22
|
-
};
|
|
23
|
-
export type FeatureGrantReward = {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
type: "feature_grant";
|
|
27
|
-
grants: NonEmptyArray<{
|
|
28
|
-
featureId: string;
|
|
29
|
-
included?: number;
|
|
30
|
-
expiry?: {
|
|
31
|
-
type: "day" | "week" | "month" | "year";
|
|
32
|
-
length: number;
|
|
33
|
-
};
|
|
34
|
-
}>;
|
|
35
|
-
promoCodes: NonEmptyArray<{
|
|
36
|
-
code: string;
|
|
37
|
-
maxUses?: number;
|
|
38
|
-
}>;
|
|
39
|
-
readonly __atmnType?: "reward";
|
|
40
|
-
};
|
|
41
|
-
export type Reward = CouponReward | FeatureGrantReward;
|
|
42
|
-
export type ReferralProgram = {
|
|
43
|
-
id: string;
|
|
44
|
-
rewardId: string;
|
|
45
|
-
redeemOn: "customer_creation" | "checkout";
|
|
46
|
-
receivedBy: "referrer" | "all";
|
|
47
|
-
maxRedemptions?: number;
|
|
48
|
-
planIds?: string[];
|
|
49
|
-
excludeTrial?: boolean;
|
|
50
|
-
readonly __atmnType?: "referral_program";
|
|
51
|
-
};
|
|
52
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { BillingInterval, BillingMethod, FreeTrial, Plan as BasePlan, PlanItem, PlanPriceInterval, ResetInterval } from "./planModels.js";
|
|
2
|
-
type ApiBasePrice = {
|
|
3
|
-
amount: number;
|
|
4
|
-
interval: PlanPriceInterval;
|
|
5
|
-
interval_count?: number;
|
|
6
|
-
};
|
|
7
|
-
export type PlanItemFilter = {
|
|
8
|
-
featureId?: string;
|
|
9
|
-
billingMethod?: BillingMethod;
|
|
10
|
-
interval?: BillingInterval | ResetInterval;
|
|
11
|
-
intervalCount?: number;
|
|
12
|
-
};
|
|
13
|
-
export type CustomizePlan = {
|
|
14
|
-
price?: (Pick<ApiBasePrice, "amount" | "interval"> & {
|
|
15
|
-
intervalCount?: ApiBasePrice["interval_count"];
|
|
16
|
-
}) | null;
|
|
17
|
-
items?: PlanItem[];
|
|
18
|
-
addItems?: PlanItem[];
|
|
19
|
-
removeItems?: PlanItemFilter[];
|
|
20
|
-
freeTrial?: FreeTrial | null;
|
|
21
|
-
};
|
|
22
|
-
export type Variant = {
|
|
23
|
-
id: string;
|
|
24
|
-
name: string;
|
|
25
|
-
version?: number;
|
|
26
|
-
customize?: CustomizePlan;
|
|
27
|
-
readonly __atmnType?: "variant";
|
|
28
|
-
};
|
|
29
|
-
export type Plan = BasePlan & {
|
|
30
|
-
version?: number;
|
|
31
|
-
variants?: Variant[];
|
|
32
|
-
variant?: (params: Omit<Variant, "__atmnType">) => Variant;
|
|
33
|
-
};
|
|
34
|
-
export {};
|
package/readme.md
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
# atmn
|
|
2
|
-
|
|
3
|
-
The CLI for [Autumn](https://useautumn.com) — define your pricing in code, sync it to Autumn, and keep everything in version control.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g atmn
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Or run directly:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npx atmn <command>
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Quick Start
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
atmn login # Authenticate via OAuth
|
|
21
|
-
atmn init # Scaffold a project from a template
|
|
22
|
-
atmn push # Deploy your config to Autumn
|
|
23
|
-
atmn pull # Pull changes & generate SDK types
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Templates
|
|
27
|
-
|
|
28
|
-
`atmn init` offers starter templates for common pricing models:
|
|
29
|
-
|
|
30
|
-
- **OpenAI** — Credit system with model tiers
|
|
31
|
-
- **T3 Chat** — Seats + message limits
|
|
32
|
-
- **Railway** — Resource-based usage pricing
|
|
33
|
-
- **Linear** — Feature flags + usage controls
|
|
34
|
-
|
|
35
|
-
## What It Does
|
|
36
|
-
|
|
37
|
-
You define features and plans in an `autumn.config.ts` file. The CLI syncs that config with your Autumn account — push to deploy, pull to fetch updates. It also generates TypeScript definitions so your SDK calls are type-safe.
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
import { feature, plan, planFeature } from 'atmn';
|
|
41
|
-
|
|
42
|
-
export const messages = feature({
|
|
43
|
-
id: 'messages',
|
|
44
|
-
name: 'AI Messages',
|
|
45
|
-
type: 'metered',
|
|
46
|
-
consumable: true,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
export const pro = plan({
|
|
50
|
-
id: 'pro',
|
|
51
|
-
name: 'Pro',
|
|
52
|
-
price: { amount: 2000, interval: 'month' },
|
|
53
|
-
items: [
|
|
54
|
-
planFeature({
|
|
55
|
-
feature_id: messages.id,
|
|
56
|
-
included: 1000,
|
|
57
|
-
reset: { interval: 'month' },
|
|
58
|
-
}),
|
|
59
|
-
],
|
|
60
|
-
});
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Commands
|
|
64
|
-
|
|
65
|
-
### Authentication
|
|
66
|
-
|
|
67
|
-
| Command | Description |
|
|
68
|
-
|---------|-------------|
|
|
69
|
-
| `atmn login` | Authenticate with Autumn (OAuth 2.0) |
|
|
70
|
-
| `atmn logout` | Remove API keys from `.env` |
|
|
71
|
-
| `atmn env` | Show current org and environment |
|
|
72
|
-
|
|
73
|
-
### Configuration
|
|
74
|
-
|
|
75
|
-
| Command | Description |
|
|
76
|
-
|---------|-------------|
|
|
77
|
-
| `atmn init` | Initialize a project with a starter template |
|
|
78
|
-
| `atmn push` | Push local config to Autumn |
|
|
79
|
-
| `atmn pull` | Pull config from Autumn and generate SDK types |
|
|
80
|
-
| `atmn preview` | Preview plans locally (no API calls) |
|
|
81
|
-
| `atmn config` | View and set global CLI configuration |
|
|
82
|
-
|
|
83
|
-
### Data
|
|
84
|
-
|
|
85
|
-
| Command | Description |
|
|
86
|
-
|---------|-------------|
|
|
87
|
-
| `atmn customers` | Browse and inspect customers |
|
|
88
|
-
| `atmn plans` | Browse and inspect plans (alias: `products`) |
|
|
89
|
-
| `atmn features` | Browse and inspect features |
|
|
90
|
-
| `atmn events` | Browse and analyze usage events |
|
|
91
|
-
|
|
92
|
-
### Utility
|
|
93
|
-
|
|
94
|
-
| Command | Description |
|
|
95
|
-
|---------|-------------|
|
|
96
|
-
| `atmn nuke` | Permanently delete all sandbox data |
|
|
97
|
-
| `atmn version` | Show CLI version |
|
|
98
|
-
|
|
99
|
-
## Global Flags
|
|
100
|
-
|
|
101
|
-
| Flag | Description |
|
|
102
|
-
|------|-------------|
|
|
103
|
-
| `-p, --prod` | Use production environment (default: sandbox) |
|
|
104
|
-
| `-c, --config <path>` | Path to config file (default: `autumn.config.ts`) |
|
|
105
|
-
| `--headless` | Force non-interactive mode (for CI/agents) |
|
|
106
|
-
|
|
107
|
-
Flags combine: `atmn push -p` pushes to production.
|
|
108
|
-
|
|
109
|
-
## Push & Pull
|
|
110
|
-
|
|
111
|
-
**Push** analyzes your local config against remote state, shows you exactly what will change, and syncs it:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
atmn push # Deploy to sandbox
|
|
115
|
-
atmn push --prod # Deploy to production (extra confirmation)
|
|
116
|
-
atmn push --yes # Auto-confirm (for CI/CD)
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**Pull** fetches your config and generates typed SDK definitions:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
atmn pull # Smart in-place update
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Declaration File
|
|
127
|
-
|
|
128
|
-
Pull generates `@useautumn-sdk.d.ts` by default. To skip it:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
atmn pull --no-declaration-file
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Or set it globally:
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
atmn config --global noDeclarationFile true
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Data Commands
|
|
141
|
-
|
|
142
|
-
All data commands have an interactive mode (default) and a headless mode for scripting:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
atmn customers # Interactive browser
|
|
146
|
-
atmn customers --headless --format json # JSON output
|
|
147
|
-
atmn customers --headless --format csv # CSV export
|
|
148
|
-
atmn customers --headless --id "cus_123" # Specific customer
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Events support aggregation:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
atmn events --mode aggregate --bin day --time 30d
|
|
155
|
-
atmn events --customer "cus_123" --feature "messages" --time 7d
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Global Config
|
|
159
|
-
|
|
160
|
-
Manage persistent CLI settings:
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
atmn config # Show config file location and keys
|
|
164
|
-
atmn config --global # Same as above
|
|
165
|
-
atmn config --global noDeclarationFile # Read a key
|
|
166
|
-
atmn config --global noDeclarationFile true # Set a key
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## CI/CD
|
|
170
|
-
|
|
171
|
-
The CLI auto-detects non-TTY environments and switches to headless mode. Set your API keys as environment variables:
|
|
172
|
-
|
|
173
|
-
```yaml
|
|
174
|
-
# GitHub Actions
|
|
175
|
-
- name: Deploy to Autumn
|
|
176
|
-
run: atmn push --prod --yes
|
|
177
|
-
env:
|
|
178
|
-
AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Links
|
|
182
|
-
|
|
183
|
-
- [Documentation](https://docs.useautumn.com)
|
|
184
|
-
- [Dashboard](https://app.useautumn.com)
|
|
185
|
-
- [Main GitHub](https://github.com/useautumn/autumn)
|
|
186
|
-
- [CLI & SDKs GitHub](https://github.com/useautumn/typescript)
|