@akterjs/cli 0.0.0-stage → 0.1.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 (108) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +47 -2
  3. package/dist/Argument-D81dqizB.mjs +57 -0
  4. package/dist/Array-B4kuTQeW.mjs +2323 -0
  5. package/dist/Boolean-kILIvmhE.mjs +26 -0
  6. package/dist/ChildProcess-BCIwxPGc.mjs +577 -0
  7. package/dist/CliError-Cf5xqkkj.mjs +633 -0
  8. package/dist/Command-Dzq9KM-h.mjs +5135 -0
  9. package/dist/Config-B6OND9WR.mjs +854 -0
  10. package/dist/Console-BKHUkH6a.mjs +141 -0
  11. package/dist/Data-CeCULr0-.mjs +251 -0
  12. package/dist/Digest-CBd3uv5B.mjs +348 -0
  13. package/dist/Duration-EH9Vy4U6.mjs +791 -0
  14. package/dist/Effect-CKFpqbmw.mjs +12911 -0
  15. package/dist/FileSystem-4pPcEb_i.mjs +1366 -0
  16. package/dist/HttpClientError-BUeMWx70.mjs +303 -0
  17. package/dist/HttpClientResponse-D5ZKICVV.mjs +855 -0
  18. package/dist/Match-CGPLZYrV.mjs +434 -0
  19. package/dist/MutableHashMap-f8nW8AJR.mjs +376 -0
  20. package/dist/MutableHashSet-_HI572Ya.mjs +155 -0
  21. package/dist/MutableRef-D4Qv592C.mjs +107 -0
  22. package/dist/Number-BvkRkfc-.mjs +137 -0
  23. package/dist/Option-DkxSnBhp.mjs +3967 -0
  24. package/dist/Order-C1JC991I.mjs +481 -0
  25. package/dist/Path-Djdv_eF5.mjs +130 -0
  26. package/dist/Queue-CO5UQ6os.mjs +1394 -0
  27. package/dist/Redacted-RkJrG5Me.mjs +160 -0
  28. package/dist/Ref-BIPOxJNH.mjs +267 -0
  29. package/dist/Runtime-BInIAwK3.mjs +297 -0
  30. package/dist/Schema-MiKt5K1v.mjs +10999 -0
  31. package/dist/SecureRandom-B_U4ysO3.mjs +279 -0
  32. package/dist/Semaphore-DOVJ4ZGS.mjs +177 -0
  33. package/dist/Stdio-KylmOBX_.mjs +74 -0
  34. package/dist/Stream-bK9QIETN.mjs +4012 -0
  35. package/dist/String-q5dcsVe4.mjs +351 -0
  36. package/dist/TerminalCapabilities-w_44MAca.mjs +1769 -0
  37. package/dist/WebCrypto-ZI_GNVlw.mjs +33 -0
  38. package/dist/actor-call.service-CGM_vD9u.mjs +1269 -0
  39. package/dist/actor-client.adapter-Coem7gF1.mjs +3691 -0
  40. package/dist/akter-program.config-C4cXx4Fr.mjs +7034 -0
  41. package/dist/akter.cli.mjs +5 -0
  42. package/dist/app-cli.config.mjs +49 -0
  43. package/dist/app-entry.pure.mjs +31 -0
  44. package/dist/archive/akter-archive.schema.mjs +65 -0
  45. package/dist/archive/akter-archive.service.mjs +309 -0
  46. package/dist/archive/archive-cli.config.mjs +45 -0
  47. package/dist/archive/archive-invalid.errors.mjs +5 -0
  48. package/dist/archive/archived-lineage.pure.mjs +13 -0
  49. package/dist/archive/tar.pure.mjs +291 -0
  50. package/dist/archive/zstd.adapter.mjs +46 -0
  51. package/dist/bench/bench-report.pure.mjs +120 -0
  52. package/dist/bench/bench-runner.pure.mjs +89 -0
  53. package/dist/bench/bench.service.mjs +301 -0
  54. package/dist/cli-runtime.layer-BqK2mmVL.mjs +1191 -0
  55. package/dist/cli-runtime.layer.mjs +1 -0
  56. package/dist/cloud-client.adapter-Cy1BjDbG.mjs +3186 -0
  57. package/dist/cloud-client.adapter-DOVMoYAj.mjs +304 -0
  58. package/dist/command/akter-commands.config.mjs +32 -0
  59. package/dist/command/akter-program.config.mjs +1 -0
  60. package/dist/credentials/credentials.service.mjs +226 -0
  61. package/dist/credentials/keychain.adapter.mjs +92 -0
  62. package/dist/credentials/login.config.mjs +251 -0
  63. package/dist/deploy/auth/api-attempt.service.mjs +30 -0
  64. package/dist/deploy/auth/token-refresh.errors.mjs +4 -0
  65. package/dist/deploy/build-bundle.adapter.mjs +133 -0
  66. package/dist/deploy/build-manifest.pure.mjs +44 -0
  67. package/dist/deploy/cloud-client.adapter.mjs +1 -0
  68. package/dist/deploy/cloud-url.pure.mjs +17 -0
  69. package/dist/deploy/deploy-failed.errors.mjs +17 -0
  70. package/dist/deploy/deploy.service.mjs +156 -0
  71. package/dist/deploy/request-failure.pure.mjs +87 -0
  72. package/dist/dev-runner.pure.mjs +30 -0
  73. package/dist/docs/doc-topics.pure.mjs +21 -0
  74. package/dist/docs/docs.config.mjs +1 -0
  75. package/dist/docs.config-_21Xi6HU.mjs +190 -0
  76. package/dist/export/actor-export.service.mjs +267 -0
  77. package/dist/export/export-failed.errors.mjs +4 -0
  78. package/dist/export/export-failure.pure.mjs +18 -0
  79. package/dist/export/ordered-lines.pure.mjs +43 -0
  80. package/dist/export/ranged-download.pure.mjs +66 -0
  81. package/dist/export/snapshot-download.pure.mjs +86 -0
  82. package/dist/history-runner.pure.mjs +186 -0
  83. package/dist/history-since.pure.mjs +17 -0
  84. package/dist/hosted-runtime.layer-Cx3IPsEd.mjs +16358 -0
  85. package/dist/local/environment-cli.config.mjs +90 -0
  86. package/dist/local/environment-runner.pure.mjs +75 -0
  87. package/dist/local/local-cli.config.mjs +159 -0
  88. package/dist/logs/log-follow.config.mjs +21 -0
  89. package/dist/logs/log-follow.service.mjs +87 -0
  90. package/dist/logs/log-lines.pure.mjs +44 -0
  91. package/dist/migrate-runner.pure.mjs +28 -0
  92. package/dist/operation-input.pure-CS9iUhqK.mjs +1383 -0
  93. package/dist/operation-registry.pure-DVC8EDgj.mjs +283 -0
  94. package/dist/registry/actor-call.service.mjs +1 -0
  95. package/dist/registry/actor-commands.config.mjs +127 -0
  96. package/dist/registry/actor-refusal.pure.mjs +34 -0
  97. package/dist/registry/approval.service.mjs +80 -0
  98. package/dist/registry/cloud-commands.config.mjs +151 -0
  99. package/dist/registry/cloud-served.pure.mjs +31 -0
  100. package/dist/registry/operation-call.service.mjs +262 -0
  101. package/dist/registry/operation-input.pure.mjs +1 -0
  102. package/dist/registry/operation-output.pure.mjs +91 -0
  103. package/dist/registry/served-command.config.mjs +57 -0
  104. package/dist/runner-exited.errors.mjs +10 -0
  105. package/dist/terminal/cli-exit.errors.mjs +38 -0
  106. package/dist/terminal/cli-failure.pure.mjs +31 -0
  107. package/dist/terminal/confirm.adapter.mjs +27 -0
  108. package/package.json +61 -3
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,48 @@
1
- # Temporary Holding Version
1
+ # @akterjs/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Akter CLI, also published as [`akter`](https://www.npmjs.com/package/akter) so `npx akter` runs it.
4
+
5
+ ## Start
6
+
7
+ ```sh
8
+ npx akter signup --email you@example.com # emails a code; creates your account
9
+ npx akter organizations create --name acme
10
+ npx akter apps create --organization acme --name notes
11
+ npx akter deploy --organization acme --app notes # bundles src/app.layer.ts and deploys it
12
+ ```
13
+
14
+ The CLI talks to Akter Cloud at `https://api.akter.dev` unless `--url` or `AKTER_CLOUD_URL` names another. `npx akter dev` runs your app on a local folder with no account, and `npx akter docs` prints these docs in the terminal. Agent apps can do the same through the MCP server at `https://mcp.akter.dev/mcp`.
15
+
16
+ Docs: https://docs.akter.dev. Pricing: https://docs.akter.dev/pricing.
17
+
18
+ ## This package
19
+
20
+ The `akter` command, built on `effect/cli`:
21
+
22
+ - `akter dev`: the local engine on a folder (`.akter`), with the production layout and no cloud account. It serves the app's actors at `/rpc` and prints the URL. The app module (`--entry`, `<app>/src/app.layer.ts` by default) exports `app = { actors, layer }`: the actors to serve and their handler layers. A named export keeps the module within the house rules (`import/no-default-export`, `<name>.<role>.ts` file names), and an entry without an `app` export makes `akter dev` print what to export instead of starting. `akter dev` provides `Akter.local`, with those handlers, under `Akter.serve({ actors })`, which is the seam where Akter Cloud provides its own engine. It writes a small runner to `node_modules/.akter/dev.mjs` and runs it with `--watch` on whichever runtime started it, Bun or Node, so a source change restarts the server and keeps the data. On Node, the runner registers a resolve hook, so a relative import that ends in `.js` in a `.ts` file loads the `.ts` file it names, as TypeScript and Bun resolve it. `--reset` asks before it empties the folder; `--dir` moves the folder, and `--port` the port: without it, `akter dev` serves on `PORT` when that is set, which is how portless hands it one, and on 4000 otherwise.
23
+ - `/rpc` and the inspector answer only a loopback `Host` (`localhost`, 127.0.0.0/8, `[::1]`). `--allowed-host <name>`, repeatable, adds a name, for when you reach `akter dev` through a dev proxy or a tunnel that keeps its own hostname.
24
+ - `akter dev snapshots create|list|get|delete` and `akter dev environments list|get|branch|promote|delete`: snapshot, branch and promote the folder's environments, as Akter Cloud's `akter snapshots` and `akter environments` do for an app (`Akter.environments`, `serve/environment/` in `@akterjs/effect`). The folder starts with one environment, `dev`, whose store is the folder itself. `snapshots create --name <n>` records a Pending snapshot (`snapshot-<n>`, numbered from 0 and never reused) of the serving environment, or `--environment`'s, and the `akter dev` serving it takes it within a second: each actor's database copied with `VACUUM INTO` under that actor's command lock, and the files with it, into `<dir>/snapshots/<id>`. Until an `akter dev` serves that environment it stays Pending, as on Cloud. `delete` retires the record and removes the copy. `environments branch --name <b> --snapshot <n>` copies a Ready snapshot into `<dir>/environments/<b>`, quiet: `akter dev --environment <b>` serves its calls, but no timer fires, no outbox message is delivered and no job resumes until it is promoted; they are held, not dropped. `environments promote --name <b>` switches which environment the running `akter dev` serves, lifts the quiet, and prints what that leaves out: the writes made after the snapshot, or on a promote back, the writes the newer environment took. The environment it replaced is kept quiet and untouched until `environments delete`, which refuses the serving one and `dev` and keeps the name taken. A repeated promote changes nothing and prints the same result. Each command takes `--dir`, and `--json` prints Cloud's shapes. They run through a runner at `node_modules/.akter/environments.mjs`, like `history` and `migrate`, and aren't MCP tools: the registry and its MCP server cover Akter Cloud and an app's actor RPC, and this folder has neither.
25
+ - Beside `/rpc`, `akter dev` serves a read-only actor inspector on `127.0.0.1` at `--inspector-port` (`--port` + 1 when missing, any free port when `--port` is 0) and prints its URL. It lists the folder's actors by type, and for the one you open shows its state, its own tables (the first 100 rows of each), its command journal, pending timers, outbox, failed deliveries, jobs and files, updating every half second over server-sent events. It reads each actor's `actor.db` through `SqliteDriver.openQueryOnly` (`PRAGMA query_only = ON`), so it can't write, and it never creates an actor that doesn't exist yet (`Akter.inspector`, `serve/inspect/`). Like `/rpc`, it answers 421 to a `Host` that isn't a loopback name.
26
+ - `akter deploy --organization <organization> --app <app> --url <control-url>`: bundle the same app entry as `akter dev`, upload it, confirm the build is Ready and start a deploy. It prints the Deploy actor's persisted notices once each, in order, until `Live` (exit 0), `NotServing` (exit 1, printing why the published build isn't serving) or `RolledBack` (exit 1). `--environment` defaults to `prod`; `--entry` selects the app module. `--organization` and `--url` fall back to `AKTER_ORGANIZATION` and `AKTER_CLOUD_URL`, then to the login `akter login` saved, and the key comes from `Credentials` (below) and needs deploy scope for that organization. The app must already exist. The CLI exchanges the key for a short-lived bearer token and refreshes it as needed; signed uploads use a separate client without that token. A timed-out or interrupted follow does not cancel the remote deploy. `--domain <hostname>` claims a custom hostname for the environment and prints the CNAME to add. Region selection is not a field in the current API.
27
+ - Every other command of the release (accounts, keys, apps, files, computers, fork, branch, snapshot, restore, usage, billing, `docs`) is listed with its state in `../akter-cloud/docs/release-matrix.md`. Of those, every Cloud API endpoint is built as a registry command (below), and `docs`, `login` and `logout` are built; the rest wait for their endpoints.
28
+ - `akter export --organization <organization> --app <app> --url <control-url> --out <folder>`: download every actor's database and history from Akter Cloud into `<folder>/shards/<shard>/<Actor>/<key>/actor.db`, the layout `akter dev` serves. Each `actor.db` is a decrypted, consistent SQLite backup holding the actor's state, tables, command journal, timers, outbox and jobs, and nothing else: no Cloud keys, export records or file grants. Each distinct file the actor's database names goes to `files/<sha256>` beside it, downloaded and checked before the database. It lists the app's 300 shards, 32 at a time, then exports their actors 4 at a time, printing each actor's lines whole and in shard order: it takes one snapshot per actor, downloads it in reads of at most 64 KiB with a progress line every MiB, and checks the SHA-256 and blanks the file grants before it renames the download to `actor.db`. Running it again with the same `--out` keeps finished actors and resumes a partial one from the same snapshot. An erased actor is skipped with a line saying so. A replaced, unauthenticated or mismatched snapshot deletes its partial download and exits nonzero. The server verifies a MAC over every page of the snapshot before it reports it, so a page rolled back within the snapshot stops the export; a rollback inside the live `actor.db` is outside that check. The key comes from `Credentials` and needs export scope.
29
+ - `akter migrate --all`: apply pending migrations to every actor in the folder now, instead of on each actor's next open. It loads the same entry as `akter dev` and reads its `app` export, saying what to export when there is none, writes a runner to `node_modules/.akter/migrate.mjs` that calls `Akter.migrate`, and prints one line per actor with its old and new version (`Room "lobby": version 1 -> 2`). It stops at the first actor that fails, prints its type and key and why it failed (for a migration, its number and SQLite's message and code) and exits 1; the actors after it are left as they were. `--dry-run` prints the same lines without writing, and `--dir` and `--entry` work as they do for `akter dev`. Without `--all` it exits 2, since migrating a single actor isn't built yet. Against Akter Cloud it will run through the Cloud API once that exists.
30
+ - `akter history <Actor>/<key>`: print an actor's command journal, oldest first, one line per command with its time, command, principal, payload and outcome (`-> ok` with the value, or `-> failed` with the command's typed error, such as `NotMemberError`). It loads the same entry as `akter dev`, writes a runner to `node_modules/.akter/history.mjs` and reads the folder through `Akter.local` and the actor's `historyStream`, which reads the journal 500 commands at a time, so a long history prints as it is read instead of being held in memory. `--json` prints one JSON object per command (`seq`, `at`, `command`, `commandId`, `principal`, `payload`, `outcome` and `value` or `error`), `--since 1h` keeps only the commands from that long ago until now (a whole number with `ms`, `s`, `m`, `h` or `d`), and `--dir` and `--entry` work as they do for `akter dev`. When `--since` or a history retention cuts the journal, the first line says from when it is complete (`complete since <time>`, or `{"coveredSince":"<time>"}` with `--json`), and the line repeats if a prune moves that time while the history prints. An actor name the app doesn't serve, a key its schema refuses or a malformed `--since` exits 2 and says why. `--verify` reruns the actor's kept history against the entry's current handlers through `Verify.replay`. It prints the window it replayed, then either `no difference` or the first command whose outcome differs, with its seq, command, command id and time and the expected and actual outcomes, and exits 1 when it finds one. `--json` prints the report as one JSON object, and `--verify` with `--since` exits 2, because replay starts from the actor's first command. When a history retention has pruned the start of the journal, `--verify` exits 1 and says from when the history is complete. Akter Cloud already serves an actor's history (`GET /v1/organizations/{organization}/apps/{app}/actors/{actor}/{key}/history`); this command doesn't call it yet.
31
+ - `akter bench <workload>`: run a workload module (`export const workload = ({ id, kind, url }) => ({ name, open, step })`, where `kind` is `"local"`, `"cloud"` or `"comparison"`, so a workload sends a development identity such as `akter-principal` only to `akter dev`) against `akter dev` or an Akter Cloud app and print one row per outcome, failed steps included as `failed: <tag>`, each with steps, steps per second and p50, p90, p99 and max latency, plus the hardware, runtime, package versions, git commit and lockfile SHA-256. Without `--url` it starts `akter dev` on an empty temporary folder through a runner at `node_modules/.akter/bench.mjs`, and stops it after the run; `--url` takes a loopback `akter dev` someone else started, or any other URL as an Akter Cloud app: the CLI signs in with its credential (`AKTER_API_KEY`, else the key `akter login` saved) and passes the runner the session's bearer header on stdin, then the current one every 10 seconds, so a run longer than the 15-minute token keeps signing its steps. `--system <name> --url <url>` runs a workload against another system for comparison, such as `--system "Rivet actor"`: akter bench signs in to nothing, gives the workload no Akter client, and labels the report `COMPARISON RUN`. `--duration` (30s) and `--concurrency` (8) set the run, `--step-timeout` (30s) bounds the workload's `open` and each step, which counts as `failed: no answer within <ms> ms` when it runs out, and `--json` prints one JSON object. A local report starts with a `LOCAL RUN` notice and `"local": true`; a Cloud report starts with `AKTER CLOUD RUN`, says its latencies include the generator's network path and count only when the generator ran off the machine under load, and has `"local": false`. Cost per row is always `unmeasured`: the bench doesn't read the app's usage yet. The flash-sale and collab-doc examples run theirs with `pnpm bench`.
32
+
33
+ - `akter <group> <operation>`: one command per Cloud API endpoint, derived at startup from the OpenAPI spec of `@akterjs/cloud-api` embedded by `generate` (`src/registry/`). The registry itself is `@akterjs/cloud-api/operations`, shared with Phase 12's MCP server: `operationsOf` turns each endpoint into an `Operation`: its command (`[kebab(group), kebab(name)]`, such as `apps delete`), its MCP tool name (`apps_delete`), its description, its fields (path, query and body properties, or one `payload` for a non-object body), a self-contained JSON Schema of its input and of its success body (component references rewritten to `$defs`), and its annotations: `readOnly`, `destructive`, `idempotent` and `openWorld`, defaulted from the HTTP method and overridden by the spec's `x-akter` extension, plus `confirm`, which defaults to `destructive`. Phase 12's MCP server builds its tools from the same list. `cloudCommands` gives each operation its flags plus `--input` (the whole input as JSON, `@file` or `-` for stdin), `--json` and `--url`; mutations add `--dry-run`, and operations that need a confirmation add `--approval`, sent as the `akter-approval` header. `OperationCall` validates the input against the operation's schema, asks `Approval` to confirm, signs in through `Credentials`, sends the request and checks the answer against the success schema before printing it. `tests/registry/cloud-commands.config.test.ts` fails when the embedded spec differs from the installed one, when an endpoint has no description or not exactly one command, or when a field's flag collides with another flag, and cloud-api's own tests check tool names, annotations and schemas; the streaming commands (`deploy`, `export`, `history`, `logs follow`) stay hand-written beside them. `akter logs follow` (`src/logs/`) is joined to the registry's `logs` group: it pages `logsRead` from the last cursor through the shared `Credentials` and `CloudClient`, retries what a retry may fix, and never prompts.
34
+ - `akter actors <kind>` and `akter files <kind>`: the registry's other half, the operations on an app's actors, which go over the app's actor RPC (akter ADR 0016) rather than the Cloud API (`@akterjs/client/operations`, which also builds each request with `actorRequestOf`, so the CLI and the MCP server send the same one). `call` and `query` run a command or query (`--member`), `state` prints the actor's state once, `watch` prints a query's reply and each new one as JSON lines (`--count` stops it), `create` and `ensure` create an actor from `--payload`, and `fork` copies the actor into `--into` (a key, written like `--key`): over the actor RPC at a loopback `--url` (akter dev), and on any other target as the Cloud API's `actorForks.create`, which the Cloud registry serves as `actors fork`, with `--organization`, `--app`, `--environment` and `--approval`, confirmed and approved like every dangerous Cloud command (`src/registry/served-command.config.ts`); each has an MCP tool name (`actors_call` and so on) and annotations like the Cloud operations. They take `--actor`, `--key` (JSON, or a bare word as a string key), `--payload` (JSON) and `--url` (else `AKTER_APP_URL`), and mutations take `--dry-run` and `--command-id` (made when missing, so a retry runs once). `ActorCall` sends the request through `@akterjs/client`'s protocol with schema-free JSON payloads: a loopback URL (`akter dev`) needs no sign-in, and any other host gets the bearer token `Credentials` and `CloudClient` sign in for at the Cloud API, whose URL comes from `AKTER_CLOUD_URL` or `akter login`, since `--url` here is the app's. The actor's own errors print as the JSON it encoded (exit 1); the host's map to the exit codes below. `akter files <kind>` covers the file RPCs every actor's group carries, under a group of their own because the Cloud API has none: `list` and `usage` print a page of the actor's files (`--prefix`, `--cursor`, `--limit`), `download` writes a file's bytes to stdout (`--path`, and `--offset` with `--length` for a range; `--json` prints the RPC's base64 chunks instead), and a refusal prints and exits like any other, and `upload` sends `--content` (`@<file>`, `-` for stdin, or base64, as the `files_upload` tool takes it) through the open, append and close session in appends of at most 1 MiB and prints the receipt, which a command attaches at a path. `packages/client/tests/actor-operations.pure.test.ts` builds the RPC groups of real actors and fails when an RPC tag has no kind, and `tests/registry/actor-commands.config.test.ts` fails when an exposed kind lacks exactly one command or a tool distinct from every Cloud one; `warm` is deliberately not exposed, and the `computer` tags reserved for Phase 6 fail it until they are.
35
+ - `akter login`, `akter signup`, `akter logout`: `Credentials` (`src/credentials/`) is the one place every Cloud command, hand-written or not, gets its key, URL and organization. The key is `AKTER_API_KEY` (an API key or agent key) when it is set and not empty, else the saved login: its secret in the OS keychain (`security` on macOS, `secret-tool` on Linux) or, when none is reachable, in `$XDG_CONFIG_HOME/akter/login.json` (`~/.config/akter/login.json`), written atomically with mode 0600 in a 0700 folder. A saved secret is bound to the origin it was saved for: `credentialFor(url)` refuses another origin with `LoginForOtherUrl` (exit 3), so a `--url` or `AKTER_CLOUD_URL` typed by mistake or planted in an agent's prompt can't receive it. `AKTER_API_KEY` goes only to `AKTER_CLOUD_URL`'s origin when that is set, and a `--url` naming another exits 2 with `ApiKeyForOtherUrl`; with no `AKTER_CLOUD_URL` it goes to whatever URL the command uses. `akter login --with-api-key` reads the key from stdin or a hidden prompt, checks it by exchanging it for a token, and saves it. `akter login --email <address>` (and `akter signup`, the same flow, since the first sign-in creates the account) wraps the sign-in endpoints through `CloudClient.anonymous`: it emails a code and prompts for it on a terminal, or, with no terminal, prints that the code was sent and exits 0, and `--code` finishes; the session's secret is saved as a key is and never printed. `tests/credentials/login.config.test.ts` runs both against scripted API replies.
36
+ - `akter docs [topic]`: prints the pages of `apps/docs/content`, which `generate` embeds, as Markdown; `--json` prints one line of JSON.
37
+ - Prompts: `Confirmation` (`src/terminal/`) asks only when stdin and stdout are terminals (`TerminalCapabilities.canPrompt`); otherwise it exits 4 at once, so a script or an agent never hangs on a question. `Approval` (`src/registry/approval.service.ts`) uses it for a registry command's confirmation, and turns the API's 428 `ConfirmationRequiredError` into an approval: at a terminal it requests the emailed code, asks for it, confirms it into a token and retries the command once with it; without one it exits 4 with reason `ApprovalRequired` and the `akter approvals` steps. The token is never printed.
38
+ - Exit codes (`CliExitError.codes`): 0 done, 1 failed, 2 usage (and HTTP 400 or 422), 3 authentication (not signed in, HTTP 401 or 403), 4 confirmation or approval needed or declined (and HTTP 428), 5 unavailable (unreachable, timeout, HTTP 408, 429 or 5xx), 130 interrupted. With `--json`, a failure the CLI detects prints `CliExitError`'s JSON (`code`, `reason`, `message`) on stdout.
39
+ - One program, two bins: `src/command/akter-program.config.ts` exports `runAkter`, which runs the command on the process's arguments, and `@akterjs/cli/program` exports it. This package's `akter` bin and the unscoped `akter` package's both call it, so `npx akter` is this CLI (ADR 0009). `akter --version` prints the package's version, which `generate` writes into `.generated`, so it follows the lockstep release version.
40
+ - Startup: `pnpm build && pnpm measure:startup` times spawn to first output for local commands on Node and Bun (`scripts/measure-startup.cli.ts`); the target is p95 ≤ 300 ms.
41
+
42
+ An operation behind a feature flag (its `x-akter` hint names one, akter-cloud ADR 0030) still runs when named, but is left out of help and unknown-command suggestions, as is a group whose every command is flagged. The baked-in spec cannot tell which flags an organization has; the Cloud API refuses an organization without the flag. This also applies to the joined `actors fork` command: Cloud forks are behind `cloudFork`, default off. A named fork at a loopback URL still works on `akter dev`, which has no flags. The MCP server hides `actors_fork` from everyone until it can read organization flags; it never falls back to the Cloud-forbidden actor RPC.
43
+
44
+ Status: `akter dev`, `akter migrate --all`, `akter history` and `akter bench` on a local folder, `akter deploy`, `akter export` and the Cloud API commands against Akter Cloud, and `akter login`, `signup`, `logout` and `docs` are implemented. The other commands are not built yet.
45
+
46
+ - Depends on: `effect` (peer) and `@effect/platform-node`. The app's project provides `@akterjs/effect`, which the runner imports, so the app and the engine share one copy.
47
+ - Build-time input: the OpenAPI spec published by `@akterjs/cloud-api`, the Markdown in `apps/docs/content` and the package's version. `generate` invokes `@effect/openapi-generator`, writes the spec and the docs pages as modules beside the client, then compiles the generated source to the ignored `.generated/compiled` directory. Handwritten source and tests keep their strict Effect checks; the generated code is checked by TypeScript. The app manifest uses the SDK's shared contract description and migration hashing, rather than a second serialization.
48
+ - Must not depend on: any private package.
@@ -0,0 +1,57 @@
1
+ import { bn as dual } from "./Option-DkxSnBhp.mjs";
2
+ import { _ as String$1, b as withDescription$1, v as argumentKind, y as optional$1 } from "./Command-Dzq9KM-h.mjs";
3
+ // ../../node_modules/.pnpm/effect@4.1.2_patch_hash=0e61176203bb1256381ce1c5b488d7951983ce38ff698647d3f4617383abbf07/node_modules/effect/dist/cli/Argument.js
4
+ /**
5
+ * Creates a positional string argument.
6
+ *
7
+ * **Example** (Creating a string argument)
8
+ *
9
+ * ```ts import.meta.vitest
10
+ * import { Argument } from "effect/cli"
11
+ *
12
+ * const filename = Argument.String("filename")
13
+ * filename.kind // => "argument"
14
+ * ```
15
+ *
16
+ * @stability unstable
17
+ * @category constructors
18
+ * @since 4.0.0
19
+ */
20
+ const String = (name) => String$1(argumentKind, name);
21
+ /**
22
+ * Makes a positional argument optional.
23
+ *
24
+ * **Example** (Making an argument optional)
25
+ *
26
+ * ```ts import.meta.vitest
27
+ * import { Argument } from "effect/cli"
28
+ *
29
+ * const optionalVersion = Argument.String("version").pipe(Argument.optional)
30
+ * optionalVersion.kind // => "argument"
31
+ * ```
32
+ *
33
+ * @stability unstable
34
+ * @category combinators
35
+ * @since 4.0.0
36
+ */
37
+ const optional = (arg) => optional$1(arg);
38
+ /**
39
+ * Adds a description to a positional argument.
40
+ *
41
+ * **Example** (Adding an argument description)
42
+ *
43
+ * ```ts import.meta.vitest
44
+ * import { Argument } from "effect/cli"
45
+ *
46
+ * const filename = Argument.String("filename").pipe(
47
+ * Argument.withDescription("The input file to process")
48
+ * )
49
+ * filename.kind // => "argument"
50
+ * ```
51
+ *
52
+ * @stability unstable
53
+ * @category combinators
54
+ * @since 4.0.0
55
+ */
56
+ const withDescription = /*#__PURE__*/ dual(2, (self, description) => withDescription$1(self, description));
57
+ export { optional as n, withDescription as r, String as t };