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.
Files changed (117) hide show
  1. package/README.md +120 -0
  2. package/dist/bin.js +23102 -0
  3. package/dist/index.js +2906 -0
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +27 -74
  6. package/src/actions/api/callApi.ts +280 -0
  7. package/src/actions/api/registerApiCommands.ts +121 -0
  8. package/src/actions/env/fetchOrgInfo.ts +32 -0
  9. package/src/actions/env/types/orgInfo.ts +18 -0
  10. package/src/actions/env.ts +94 -0
  11. package/src/actions/init/runInit.ts +401 -0
  12. package/src/actions/login/keyless.ts +135 -0
  13. package/src/actions/login.ts +144 -0
  14. package/src/actions/pull/appendPlanVersionFixture.ts +373 -0
  15. package/src/actions/pull/applyPreview.ts +553 -0
  16. package/src/actions/pull/applySettingsPreview.ts +114 -0
  17. package/src/actions/pull/changedFixtureKeys.ts +88 -0
  18. package/src/actions/pull/listSourceFiles.ts +29 -0
  19. package/src/actions/pull/locateFixture.ts +78 -0
  20. package/src/actions/pull/resolveCollectionTarget.ts +198 -0
  21. package/src/actions/pull/rewriteConfig.ts +57 -0
  22. package/src/actions/pull/scaffoldConfig.ts +118 -0
  23. package/src/actions/pull.ts +399 -0
  24. package/src/actions/push/backfillInternalIds.ts +394 -0
  25. package/src/actions/push/deprecatedFields.ts +55 -0
  26. package/src/actions/push.ts +294 -0
  27. package/src/actions/reset/runReset.ts +58 -0
  28. package/src/actions/sandbox/createSandbox.ts +83 -0
  29. package/src/actions/sandbox/deleteSandbox.ts +91 -0
  30. package/src/actions/sandbox/listSandboxes.ts +28 -0
  31. package/src/actions/sandbox/types/sandboxClient.ts +16 -0
  32. package/src/actions/sandbox/useSandbox.ts +157 -0
  33. package/src/actions/sandbox/withSandboxScopeHint.ts +27 -0
  34. package/src/actions/skills/skills.ts +246 -0
  35. package/src/auth/announceAuthorizationUrl.ts +26 -0
  36. package/src/auth/browser/openSystemBrowser.ts +7 -0
  37. package/src/auth/browser/tryOpenBrowser.ts +17 -0
  38. package/src/auth/browser/watchLauncher.ts +46 -0
  39. package/src/auth/buildAuthorizationUrl.ts +36 -0
  40. package/src/auth/callbackPages.ts +126 -0
  41. package/src/auth/createOrgApiKeys.ts +46 -0
  42. package/src/auth/keyless.ts +119 -0
  43. package/src/auth/oauthConfig.ts +63 -0
  44. package/src/auth/runOAuthFlow.ts +230 -0
  45. package/src/auth/types/browserOpener.ts +5 -0
  46. package/src/auth/types/impersonationTokens.ts +23 -0
  47. package/src/auth/types/oauthTokens.ts +13 -0
  48. package/src/auth/types/orgApiKeys.ts +6 -0
  49. package/src/bin.ts +9 -0
  50. package/src/cli.ts +648 -0
  51. package/src/config/configPackageName.ts +9 -0
  52. package/src/config/legacyConfig.ts +25 -0
  53. package/src/config/loadConfig.ts +231 -0
  54. package/src/env/assertSandboxTarget.ts +20 -0
  55. package/src/env/loadEnv.ts +184 -0
  56. package/src/env/resolveTarget.ts +134 -0
  57. package/src/env/sandboxKeyName.ts +18 -0
  58. package/src/generated/apiRoutes.ts +3787 -0
  59. package/src/generated/client.ts +51564 -0
  60. package/src/generated/emit.ts +1163 -0
  61. package/src/generated/emitRuntime.ts +522 -0
  62. package/src/generated/features.ts +146 -0
  63. package/src/generated/labels.ts +29 -0
  64. package/src/generated/licenses.ts +287 -0
  65. package/src/generated/lintRules.ts +2207 -0
  66. package/src/generated/lintRuntime.ts +865 -0
  67. package/src/generated/plans.ts +1628 -0
  68. package/src/generated/referralPrograms.ts +22 -0
  69. package/src/generated/rewards.ts +58 -0
  70. package/src/generated/settings.ts +21 -0
  71. package/src/generated/skills.ts +305 -0
  72. package/src/generated/variants.ts +934 -0
  73. package/src/generated/wire.ts +334 -0
  74. package/src/http/autumnFetch.ts +30 -0
  75. package/src/index.ts +20 -0
  76. package/src/project/chooseConfigDir.ts +41 -0
  77. package/src/project/resolveProject.ts +115 -0
  78. package/src/project/rootMarker.ts +40 -0
  79. package/src/prompt/prompt.ts +186 -0
  80. package/src/prompt/select.ts +162 -0
  81. package/src/render/renderEnv.ts +77 -0
  82. package/src/render/renderPreview.ts +945 -0
  83. package/src/render/renderSandboxes.ts +92 -0
  84. package/src/render/stripTerminalControls.ts +19 -0
  85. package/src/repo/findRepoRoot.ts +79 -0
  86. package/src/surgery/appendPropertyEdit.ts +67 -0
  87. package/src/surgery/appendToArray.ts +87 -0
  88. package/src/surgery/appendToBinding.ts +19 -0
  89. package/src/surgery/appendToCollection.ts +40 -0
  90. package/src/surgery/appendToFixtureArray.ts +71 -0
  91. package/src/surgery/arrayBinding.ts +30 -0
  92. package/src/surgery/deleteFixtureLiteral.ts +81 -0
  93. package/src/surgery/deleteReference.ts +48 -0
  94. package/src/surgery/ensureBuilderImport.ts +65 -0
  95. package/src/surgery/findFixture.ts +238 -0
  96. package/src/surgery/fixtureEdit.ts +156 -0
  97. package/src/surgery/fixtureLocation.ts +32 -0
  98. package/src/surgery/insertCollection.ts +86 -0
  99. package/src/surgery/insertFirstProperty.ts +73 -0
  100. package/src/surgery/patchFixtureProperty.ts +152 -0
  101. package/src/surgery/patchSingletonProperty.ts +221 -0
  102. package/src/surgery/replaceFixture.ts +28 -0
  103. package/src/surgery/setFixtureProperty.ts +55 -0
  104. package/src/surgery/staticFixtureRule.ts +48 -0
  105. package/src/version.ts +5 -0
  106. package/dist/cli.js +0 -142410
  107. package/dist/compose/index.js +0 -122
  108. package/dist/src/compose/builders/builderFunctions.d.ts +0 -84
  109. package/dist/src/compose/builders/rewardFunctions.d.ts +0 -5
  110. package/dist/src/compose/builders/variantFunctions.d.ts +0 -2
  111. package/dist/src/compose/index.d.ts +0 -19
  112. package/dist/src/compose/models/featureModels.d.ts +0 -262
  113. package/dist/src/compose/models/index.d.ts +0 -3
  114. package/dist/src/compose/models/planModels.d.ts +0 -367
  115. package/dist/src/compose/models/rewardModels.d.ts +0 -52
  116. package/dist/src/compose/models/variantModels.d.ts +0 -34
  117. package/readme.md +0 -186
package/README.md ADDED
@@ -0,0 +1,120 @@
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 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 with Autumn
21
+ atmn init # Set up your project
22
+ atmn push # Preview your config changes
23
+ atmn push --yes # Apply the changes to Autumn
24
+ atmn pull # Pull remote changes into your config
25
+ ```
26
+
27
+ ## What It Does
28
+
29
+ You define features and plans in an `autumn.config.ts` file. Use `atmn push` to preview changes, `atmn push --yes` to apply them, and `atmn pull` to fetch updates from your Autumn account.
30
+
31
+ ```ts
32
+ import { atmn, feature, plan } from "atmn";
33
+
34
+ export default atmn({
35
+ features: [
36
+ feature({
37
+ featureId: "messages",
38
+ name: "AI Messages",
39
+ type: "metered",
40
+ consumable: true,
41
+ }),
42
+ ],
43
+ plans: [
44
+ plan({
45
+ planId: "pro",
46
+ versionSlug: "v1",
47
+ active: true,
48
+ name: "Pro",
49
+ price: { amount: 20, interval: "month" },
50
+ items: [
51
+ {
52
+ featureId: "messages",
53
+ included: 1000,
54
+ reset: { interval: "month" },
55
+ },
56
+ ],
57
+ }),
58
+ ],
59
+ });
60
+ ```
61
+
62
+ ## Commands
63
+
64
+ Run `atmn --help` or `atmn <command> --help` for the current options.
65
+
66
+ | Command | Description |
67
+ |---------|-------------|
68
+ | `atmn login` | Authenticate with Autumn |
69
+ | `atmn env` | Show the current organization and environment |
70
+ | `atmn init` | Set up a project |
71
+ | `atmn push` | Preview local configuration changes; add `--yes` to apply them |
72
+ | `atmn pull` | Pull remote configuration into local files |
73
+ | `atmn sandbox` | Manage sandboxes |
74
+ | `atmn reset` | Reset sandbox data |
75
+ | `atmn skills` | Manage bundled agent skills |
76
+ | `atmn api` | Call Autumn's public API |
77
+
78
+ ## Global Flags
79
+
80
+ | Flag | Description |
81
+ |------|-------------|
82
+ | `-p, --prod` | Use production instead of sandbox |
83
+ | `--sandbox <sandboxId>` | Target a specific sandbox |
84
+ | `-c, --config <path>` | Config file or folder |
85
+ | `--headless` | Never prompt (the default outside a TTY) |
86
+
87
+ ## Push & Pull
88
+
89
+ Push only previews changes unless you pass `--yes`, including in an interactive terminal:
90
+
91
+ ```bash
92
+ atmn push # Preview sandbox changes
93
+ atmn push --prod # Preview production changes
94
+ atmn push --yes # Apply sandbox changes
95
+ atmn push --prod --yes # Apply production changes
96
+ ```
97
+
98
+ Pull updates configuration in place:
99
+
100
+ ```bash
101
+ atmn pull
102
+ ```
103
+
104
+ ## CI/CD
105
+
106
+ Set your API key as an environment variable:
107
+
108
+ ```yaml
109
+ - name: Deploy to Autumn
110
+ run: npx atmn push --prod --yes
111
+ env:
112
+ AUTUMN_PROD_SECRET_KEY: ${{ secrets.AUTUMN_PROD_SECRET_KEY }}
113
+ ```
114
+
115
+ ## Links
116
+
117
+ - [Documentation](https://docs.useautumn.com)
118
+ - [Dashboard](https://app.useautumn.com)
119
+ - [Main GitHub](https://github.com/useautumn/autumn)
120
+ - [CLI & SDKs GitHub](https://github.com/useautumn/typescript)