@pulse-compute/cli 0.0.0 → 1.0.0-beta.1

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 (190) hide show
  1. package/API.md +539 -0
  2. package/CHANGELOG.md +47 -0
  3. package/README.md +70 -1
  4. package/bin/pulse.js +15 -0
  5. package/bin/pulsewasm-extract.js +22 -0
  6. package/cli-spec.json +575 -0
  7. package/completions/_pulse +106 -0
  8. package/completions/pulse.bash +31 -0
  9. package/completions/pulse.fish +76 -0
  10. package/docs/README.md +77 -0
  11. package/docs/architecture/current-contracts.md +381 -0
  12. package/docs/architecture/overview.md +93 -0
  13. package/docs/architecture/vision.md +515 -0
  14. package/docs/concepts/bodies.md +186 -0
  15. package/docs/concepts/compilation-and-lowering.md +496 -0
  16. package/docs/concepts/contracts-and-providers.md +158 -0
  17. package/docs/concepts/effects-and-continuations.md +243 -0
  18. package/docs/concepts/entities-and-adapters.md +71 -0
  19. package/docs/concepts/package-owned-lowering.md +175 -0
  20. package/docs/concepts/targets-and-hosts.md +62 -0
  21. package/docs/contributing/README.md +38 -0
  22. package/docs/contributing/adding-core-provider.md +315 -0
  23. package/docs/contributing/adding-first-party-lowerer.md +327 -0
  24. package/docs/contributing/entities-lowering.md +91 -0
  25. package/docs/contributing/package-lowerer-contract.md +383 -0
  26. package/docs/contributing/pulse-aware-packages.md +149 -0
  27. package/docs/examples.md +112 -0
  28. package/docs/fixtures/inspect-fetch-composition.selected.json +181 -0
  29. package/docs/getting-started.md +128 -0
  30. package/docs/guides/compatibility-imports.md +60 -0
  31. package/docs/guides/deploying-fastly.md +188 -0
  32. package/docs/guides/deploying-node.md +143 -0
  33. package/docs/guides/events.md +233 -0
  34. package/docs/guides/fastly-capabilities.md +153 -0
  35. package/docs/guides/fetching-and-composition.md +101 -0
  36. package/docs/guides/grip.md +94 -0
  37. package/docs/guides/json-schemas.md +233 -0
  38. package/docs/guides/migrating-from-express.md +192 -0
  39. package/docs/guides/project-lifecycle.md +143 -0
  40. package/docs/guides/routing.md +184 -0
  41. package/docs/guides/troubleshooting.md +47 -0
  42. package/docs/maintainers/README.md +60 -0
  43. package/docs/maintainers/codex-maintainer.md +71 -0
  44. package/docs/maintainers/documentation-deployment.md +147 -0
  45. package/docs/maintainers/documentation-system.md +58 -0
  46. package/docs/maintainers/documentation-versioning.md +65 -0
  47. package/docs/maintainers/maintainer-charter.md +84 -0
  48. package/docs/maintainers/maintenance-policy.json +778 -0
  49. package/docs/maintainers/maintenance-policy.md +124 -0
  50. package/docs/maintainers/npm-publishing.md +154 -0
  51. package/docs/maintainers/plugin-readiness.json +19 -0
  52. package/docs/maintainers/plugin-readiness.md +31 -0
  53. package/docs/maintainers/public-site.md +158 -0
  54. package/docs/maintainers/release-acceptance.md +250 -0
  55. package/docs/maintainers/release-manifest.md +88 -0
  56. package/docs/maintainers/repository-setup.md +145 -0
  57. package/docs/maintainers/scope-policy.md +93 -0
  58. package/docs/maintainers/support-and-triage.md +74 -0
  59. package/docs/maintainers/testing.md +288 -0
  60. package/docs/packages/README.md +59 -0
  61. package/docs/packages/assets.md +85 -0
  62. package/docs/packages/cli.md +190 -0
  63. package/docs/packages/crypto.md +71 -0
  64. package/docs/packages/entities.md +129 -0
  65. package/docs/packages/grip.md +82 -0
  66. package/docs/packages/implementation-packages.md +113 -0
  67. package/docs/packages/jwt.md +55 -0
  68. package/docs/packages/provider-fastly.md +217 -0
  69. package/docs/packages/pulse.md +159 -0
  70. package/docs/packages/runtime.md +256 -0
  71. package/docs/preview-scope.md +142 -0
  72. package/docs/reference/README.md +33 -0
  73. package/docs/reference/cli-spec.json +575 -0
  74. package/docs/reference/cli.md +457 -0
  75. package/docs/reference/compatibility-matrix.md +169 -0
  76. package/docs/reference/diagnostics.md +1872 -0
  77. package/docs/reference/documentation-versions.json +14 -0
  78. package/docs/reference/environment.md +347 -0
  79. package/docs/reference/handler-authoring.md +264 -0
  80. package/docs/reference/project-config.md +554 -0
  81. package/docs/reference/project-config.schema.json +918 -0
  82. package/docs/reference/release-manifest.json +427 -0
  83. package/docs/reference/shell-completion.md +23 -0
  84. package/documentation-site.json +661 -0
  85. package/documentation-versions.json +14 -0
  86. package/examples/01-hello-json/.pulse/.gitignore +3 -0
  87. package/examples/01-hello-json/.pulse/config.ts +16 -0
  88. package/examples/01-hello-json/README.md +119 -0
  89. package/examples/01-hello-json/package.json +20 -0
  90. package/examples/01-hello-json/src/index.ts +9 -0
  91. package/examples/01-hello-json/tests/pulse.harness.ts +22 -0
  92. package/examples/01-hello-json/tsconfig.json +14 -0
  93. package/examples/02-request-schema/.pulse/.gitignore +3 -0
  94. package/examples/02-request-schema/.pulse/config.ts +17 -0
  95. package/examples/02-request-schema/README.md +145 -0
  96. package/examples/02-request-schema/package.json +20 -0
  97. package/examples/02-request-schema/src/index.ts +18 -0
  98. package/examples/02-request-schema/src/schemas.ts +20 -0
  99. package/examples/02-request-schema/tests/pulse.harness.ts +37 -0
  100. package/examples/02-request-schema/tsconfig.json +14 -0
  101. package/examples/03-fetch-composition/.pulse/.gitignore +3 -0
  102. package/examples/03-fetch-composition/.pulse/config.ts +31 -0
  103. package/examples/03-fetch-composition/README.md +210 -0
  104. package/examples/03-fetch-composition/package.json +20 -0
  105. package/examples/03-fetch-composition/src/index.ts +60 -0
  106. package/examples/03-fetch-composition/tests/pulse.harness.ts +47 -0
  107. package/examples/03-fetch-composition/tsconfig.json +14 -0
  108. package/examples/05-fastly-capabilities/.pulse/.gitignore +3 -0
  109. package/examples/05-fastly-capabilities/.pulse/config.ts +57 -0
  110. package/examples/05-fastly-capabilities/README.md +257 -0
  111. package/examples/05-fastly-capabilities/package.json +22 -0
  112. package/examples/05-fastly-capabilities/src/index.ts +55 -0
  113. package/examples/05-fastly-capabilities/tests/pulse.harness.ts +66 -0
  114. package/examples/05-fastly-capabilities/tsconfig.json +14 -0
  115. package/examples/07-opaque-proxy/.pulse/.gitignore +3 -0
  116. package/examples/07-opaque-proxy/.pulse/config.ts +38 -0
  117. package/examples/07-opaque-proxy/README.md +150 -0
  118. package/examples/07-opaque-proxy/package.json +21 -0
  119. package/examples/07-opaque-proxy/src/index.ts +9 -0
  120. package/examples/07-opaque-proxy/tests/pulse.harness.ts +25 -0
  121. package/examples/07-opaque-proxy/tsconfig.json +14 -0
  122. package/examples/09-router-lowering/.pulse/.gitignore +3 -0
  123. package/examples/09-router-lowering/.pulse/config.ts +22 -0
  124. package/examples/09-router-lowering/README.md +287 -0
  125. package/examples/09-router-lowering/package.json +22 -0
  126. package/examples/09-router-lowering/src/index.ts +65 -0
  127. package/examples/09-router-lowering/tests/pulse.harness.ts +91 -0
  128. package/examples/09-router-lowering/tsconfig.json +14 -0
  129. package/examples/10-entities-tools/.pulse/.gitignore +4 -0
  130. package/examples/10-entities-tools/.pulse/config.ts +23 -0
  131. package/examples/10-entities-tools/README.md +165 -0
  132. package/examples/10-entities-tools/package.json +21 -0
  133. package/examples/10-entities-tools/src/handlers.ts +15 -0
  134. package/examples/10-entities-tools/src/index.ts +31 -0
  135. package/examples/10-entities-tools/src/schemas.ts +18 -0
  136. package/examples/10-entities-tools/tests/pulse.harness.ts +40 -0
  137. package/examples/10-entities-tools/tools-facade.cjs +158 -0
  138. package/examples/10-entities-tools/tsconfig.json +14 -0
  139. package/examples/11-events/.pulse/.gitignore +4 -0
  140. package/examples/11-events/.pulse/config.ts +24 -0
  141. package/examples/11-events/README.md +194 -0
  142. package/examples/11-events/package.json +20 -0
  143. package/examples/11-events/src/index.ts +27 -0
  144. package/examples/11-events/src/schemas.ts +19 -0
  145. package/examples/11-events/tests/pulse.harness.ts +34 -0
  146. package/examples/11-events/tsconfig.json +15 -0
  147. package/examples/12-mcp-proxy/.pulse/.gitignore +3 -0
  148. package/examples/12-mcp-proxy/.pulse/config.ts +25 -0
  149. package/examples/12-mcp-proxy/README.md +149 -0
  150. package/examples/12-mcp-proxy/package.json +20 -0
  151. package/examples/12-mcp-proxy/src/index.ts +17 -0
  152. package/examples/12-mcp-proxy/tests/pulse.harness.ts +29 -0
  153. package/examples/12-mcp-proxy/tsconfig.json +14 -0
  154. package/examples/13-jwt-es256/.pulse/config.ts +19 -0
  155. package/examples/13-jwt-es256/README.md +195 -0
  156. package/examples/13-jwt-es256/package.json +21 -0
  157. package/examples/13-jwt-es256/src/index.ts +21 -0
  158. package/examples/13-jwt-es256/tests/pulse.harness.ts +54 -0
  159. package/examples/13-jwt-es256/tsconfig.json +14 -0
  160. package/examples/README.md +36 -0
  161. package/package.json +66 -6
  162. package/project-config.schema.json +918 -0
  163. package/release-manifest.json +427 -0
  164. package/src/command-spec.js +279 -0
  165. package/src/completion.js +113 -0
  166. package/src/diagnostics.js +350 -0
  167. package/src/documentation.js +45 -0
  168. package/src/index.d.ts +133 -0
  169. package/src/index.js +15 -0
  170. package/src/internal/command-executor.d.ts +29 -0
  171. package/src/internal/command-executor.js +143 -0
  172. package/src/internal/command-plan.d.ts +9 -0
  173. package/src/internal/command-plan.js +73 -0
  174. package/src/internal/command-reporter.d.ts +15 -0
  175. package/src/internal/command-reporter.js +133 -0
  176. package/src/internal/command-request.d.ts +35 -0
  177. package/src/internal/command-request.js +154 -0
  178. package/src/internal/node-http.js +54 -0
  179. package/src/internal/project-context.d.ts +66 -0
  180. package/src/internal/project-context.js +175 -0
  181. package/src/project-config-reference.js +4 -0
  182. package/src/project-config-schema.d.ts +23 -0
  183. package/src/project-config-schema.js +271 -0
  184. package/src/project-config.js +724 -0
  185. package/src/project-execution.js +2930 -0
  186. package/src/provider-drivers.js +3 -0
  187. package/src/target-support.js +3 -0
  188. package/src/typescript-module-loader.js +269 -0
  189. package/src/workflow.js +78 -0
  190. package/src/workspace.js +82 -0
@@ -0,0 +1,457 @@
1
+ # CLI reference
2
+
3
+ <!-- Generated by wasm/scripts/sync-reference-docs.cjs. Edit the source catalog, not this file. -->
4
+
5
+ The `pulse` CLI in `@pulse-compute/cli@1.0.0-beta.1` is the supported project workflow. One command specification generates this page, installed help, and the shipped Bash, Zsh, and Fish completion scripts, so a public command or option cannot drift between those surfaces.
6
+
7
+ ## Meta invocations
8
+
9
+ - `pulse --help | pulse -h | pulse help` — Print public help.
10
+ - `pulse --version | pulse -v | pulse version` — Print the installed CLI package version.
11
+ - `pulse completion <bash|zsh|fish>` — Print a shell completion script generated from the public command specification.
12
+
13
+ ## Global options
14
+
15
+ | Option | Behavior |
16
+ |---|---|
17
+ | `--help, -h` | Print public CLI help and exit. |
18
+ | `--json` | Emit machine-readable JSON. pulse dev emits one JSON event per line. |
19
+ | `--dry-run, --plan` | Resolve and report the command plan without executing it. |
20
+
21
+ ## Shell completion
22
+
23
+ Completion output is generated from the same public command and option specification as help and this reference. Tooling can consume the generated [machine-readable command specification](./cli-spec.json).
24
+
25
+ ### `bash`
26
+
27
+ ```bash
28
+ source <(pulse completion bash)
29
+ ```
30
+
31
+ The package also ships `completions/pulse.bash`.
32
+
33
+ ### `zsh`
34
+
35
+ ```bash
36
+ source <(pulse completion zsh)
37
+ ```
38
+
39
+ The package also ships `completions/_pulse`.
40
+
41
+ ### `fish`
42
+
43
+ ```bash
44
+ pulse completion fish | source
45
+ ```
46
+
47
+ The package also ships `completions/pulse.fish`.
48
+
49
+ ## `pulse init`
50
+
51
+ Create a conventional .pulse workspace with an async Pulse application and dedicated test harness.
52
+
53
+ Syntax:
54
+
55
+ ```text
56
+ pulse init [directory] [--name <package-name>] [--force]
57
+ ```
58
+
59
+ ### Positionals
60
+
61
+ - `directory` — Target directory. Defaults to the current directory.
62
+
63
+ ### Options
64
+
65
+ | Option | Behavior |
66
+ |---|---|
67
+ | `--force` | Allow generated files to replace entries in a non-empty target directory. |
68
+ | `--name <package-name>` | Set the generated npm package name. |
69
+
70
+ ### Examples
71
+
72
+ ```bash
73
+ pulse init ./my-pulse-app
74
+ pulse init ./edge-app --name @example/edge-app
75
+ ```
76
+
77
+
78
+ ### Related diagnostics
79
+
80
+ - [`PULSE_INIT_NOT_EMPTY`](diagnostics.md#pulse-init-not-empty) — Project initialization would write into a non-empty directory without explicit force.
81
+ - [`PULSE_INIT_FILE_EXISTS`](diagnostics.md#pulse-init-file-exists) — Project initialization would replace an existing file that is not safe to overwrite.
82
+ - [`PULSE_PROVIDER_UNSUPPORTED`](diagnostics.md#pulse-provider-unsupported) — The selected provider value is not a supported shorthand or package selection.
83
+
84
+
85
+ ### Output
86
+
87
+ - Human output lists generated files and next steps.
88
+ - With --json, emits one initialization result object.
89
+
90
+ ### Side effects
91
+
92
+ - Creates .pulse/config.ts, an async Pulse application, a dedicated test harness, package scripts, and documentation.
93
+ - Does not install dependencies or run npm, pnpm, or any network operation.
94
+
95
+ ### Exit behavior
96
+
97
+ 0 on success; 2 for invalid usage, provider selection, or unsafe overwrite conditions.
98
+
99
+ ## `pulse doctor`
100
+
101
+ Audit project shape, compilation, schemas, provider bindings, output safety, and required tools.
102
+
103
+ Syntax:
104
+
105
+ ```text
106
+ pulse doctor [directory] [--profile <name>] [--strict]
107
+ ```
108
+
109
+ ### Positionals
110
+
111
+ - `directory` — Project discovery start. Defaults to the current directory.
112
+
113
+ ### Options
114
+
115
+ | Option | Behavior |
116
+ |---|---|
117
+ | `--strict` | Treat doctor warnings as failed checks. |
118
+ | `--profile <profile>` | Select a project profile. Precedence: --profile, PULSE_PROFILE, pulse.defaultProfile. |
119
+
120
+ ### Examples
121
+
122
+ ```bash
123
+ pulse doctor ./my-pulse-app
124
+ pulse doctor ./edge-app --strict --json
125
+ ```
126
+
127
+
128
+ ### Related diagnostics
129
+
130
+ - [`PULSE_CONFIG_NOT_FOUND`](diagnostics.md#pulse-config-not-found) — Project discovery did not find an explicit Pulse configuration file.
131
+ - [`PULSE_PROJECT_COMPILE_FAILED`](diagnostics.md#pulse-project-compile-failed) — Whole-project compilation failed and contains one or more nested diagnostics.
132
+ - [`PULSE_NODE_VERSION_UNSUPPORTED`](diagnostics.md#pulse-node-version-unsupported) — The active Node.js version is outside the supported release range.
133
+ - [`PULSE_CANONICAL_NATIVE_COMPILE_FAILED`](diagnostics.md#pulse-canonical-native-compile-failed) — The provider-neutral native plan could not be compiled into Pulse-owned WebAssembly.
134
+
135
+
136
+ ### Output
137
+
138
+ - Human output prints every check.
139
+ - With --json, emits one completed audit object including failed and warning checks.
140
+
141
+ ### Side effects
142
+
143
+ - Reads and compiles the project.
144
+ - Does not write the build output.
145
+
146
+ ### Exit behavior
147
+
148
+ 0 when the audit passes; 1 when a completed audit contains failed checks; 2–5 only when the audit command itself cannot be completed.
149
+
150
+ ## `pulse inspect`
151
+
152
+ Report canonical compiler, schema, effect, continuation, capability, provider, and build-mode details.
153
+
154
+ Supported signatures:
155
+
156
+ ```text
157
+ pulse inspect [directory] [--profile <name>]
158
+ pulse inspect --artifact <file.json>
159
+ ```
160
+
161
+ ### Positionals
162
+
163
+ - `directory` — Project discovery start. Defaults to the current directory.
164
+
165
+ ### Options
166
+
167
+ | Option | Behavior |
168
+ |---|---|
169
+ | `--profile <profile>` | Select a project profile. Precedence: --profile, PULSE_PROFILE, pulse.defaultProfile. |
170
+ | `--artifact <file.json>` | Inspect an existing JSON build or compiler artifact instead of a project. |
171
+
172
+ ### Examples
173
+
174
+ ```bash
175
+ pulse inspect ./my-pulse-app --json
176
+ pulse inspect --artifact ./dist/pulse-build.json
177
+ ```
178
+
179
+
180
+ ### Related diagnostics
181
+
182
+ - [`PULSE_CONFIG_NOT_FOUND`](diagnostics.md#pulse-config-not-found) — Project discovery did not find an explicit Pulse configuration file.
183
+ - [`PULSE_PROJECT_COMPILE_FAILED`](diagnostics.md#pulse-project-compile-failed) — Whole-project compilation failed and contains one or more nested diagnostics.
184
+ - [`PULSE_CANONICAL_COMPILE_FAILED`](diagnostics.md#pulse-canonical-compile-failed) — The handler uses a source form outside the canonical Beta authoring subset.
185
+
186
+
187
+ ### Output
188
+
189
+ - Human output prints a compact project/compiler summary.
190
+ - With --json, emits one inspection or artifact object.
191
+
192
+ ### Side effects
193
+
194
+ - Compiles and validates the project in memory.
195
+ - Does not write the build output.
196
+
197
+ ### Exit behavior
198
+
199
+ 0 on success; 2–5 according to the emitted stable diagnostic.
200
+
201
+ ## `pulse test`
202
+
203
+ Run configured cases through the selected provider local-conformance runtime.
204
+
205
+ Syntax:
206
+
207
+ ```text
208
+ pulse test [directory] [--profile <name>] [--case <name>]
209
+ ```
210
+
211
+ ### Positionals
212
+
213
+ - `directory` — Project discovery start. Defaults to the current directory.
214
+
215
+ ### Options
216
+
217
+ | Option | Behavior |
218
+ |---|---|
219
+ | `--profile <profile>` | Select a project profile. Precedence: --profile, PULSE_PROFILE, pulse.defaultProfile. |
220
+ | `--case <name>` | Run one named project test case. |
221
+
222
+ ### Examples
223
+
224
+ ```bash
225
+ pulse test ./my-pulse-app
226
+ pulse test ./my-pulse-app --case smoke --json
227
+ ```
228
+
229
+
230
+ ### Related diagnostics
231
+
232
+ - [`PULSE_TEST_PROVIDER_REQUIRED`](diagnostics.md#pulse-test-provider-required) — Project tests require an executable provider.
233
+ - [`PULSE_PROVIDER_CAPABILITY_MISSING`](diagnostics.md#pulse-provider-capability-missing) — The selected provider lacks a binding required by the compiled application.
234
+ - [`PULSE_SCHEMA_DECODE`](diagnostics.md#pulse-schema-decode) — JSON input did not satisfy the explicitly declared schema and content-type policy.
235
+
236
+
237
+ ### Output
238
+
239
+ - Human output uses TAP-like case lines and a summary.
240
+ - With --json, emits one test-run object; expected stable errors remain inside their case results.
241
+
242
+ ### Side effects
243
+
244
+ - Compiles the project and executes configured deterministic or live fixtures.
245
+ - Does not write the build output.
246
+
247
+ ### Exit behavior
248
+
249
+ 0 when all selected cases pass; 1 when the completed test run has failed cases; 2–5 when setup, compilation, runtime, or toolchain execution fails before a normal result.
250
+
251
+ ## `pulse dev`
252
+
253
+ Start the foreground local server with the selected provider conformance runtime.
254
+
255
+ Syntax:
256
+
257
+ ```text
258
+ pulse dev [directory] [--profile <name>] [--host <host>] [--port <port>] [--watch|--no-watch] [--once]
259
+ ```
260
+
261
+ ### Positionals
262
+
263
+ - `directory` — Project discovery start. Defaults to the current directory.
264
+
265
+ ### Options
266
+
267
+ | Option | Behavior |
268
+ |---|---|
269
+ | `--once` | Close the development server after the first completed request. |
270
+ | `--watch, --no-watch` | Enable or disable entry and schema dependency watching. Watching is enabled by default. |
271
+ | `--profile <profile>` | Select a project profile. Precedence: --profile, PULSE_PROFILE, pulse.defaultProfile. |
272
+ | `--host <host>` | Override the development listen host. |
273
+ | `--port <port>` | Override the development listen port. Use 0 to request an ephemeral port. |
274
+
275
+ ### Examples
276
+
277
+ ```bash
278
+ pulse dev ./my-pulse-app
279
+ pulse dev ./my-pulse-app --port 0 --once --json
280
+ ```
281
+
282
+
283
+ ### Related diagnostics
284
+
285
+ - [`PULSE_DEV_PROVIDER_UNSUPPORTED`](diagnostics.md#pulse-dev-provider-unsupported) — The development server requires an executable provider.
286
+ - [`PULSE_REQUEST_BODY_TOO_LARGE`](diagnostics.md#pulse-request-body-too-large) — An incoming development request exceeded dev.maxBodyBytes.
287
+ - [`PULSE_FETCH_NETWORK`](diagnostics.md#pulse-fetch-network) — An outbound fetch failed because the origin or network was unavailable.
288
+
289
+
290
+ ### Output
291
+
292
+ - Human output reports the ready URL and reload or error messages.
293
+ - With --json, stdout is newline-delimited JSON events: compiled, ready, reloaded, request, compile-error, and request-error. It is not one enclosing JSON document.
294
+
295
+ ### Side effects
296
+
297
+ - Binds a foreground HTTP listener.
298
+ - Watches the entry and schema dependency graph by default.
299
+ - Configuration-file changes require restarting the command.
300
+
301
+ ### Exit behavior
302
+
303
+ 0 after a normal server close; 2–5 when setup, compilation, provider, runtime, or toolchain initialization fails.
304
+
305
+ ## `pulse compile`
306
+
307
+ Compile the canonical project into provider-neutral Pulse-owned WebAssembly.
308
+
309
+ Syntax:
310
+
311
+ ```text
312
+ pulse compile [directory] [--profile <name>] [--out <dir>] [--clean|--no-clean] [--experimental-native-size]
313
+ ```
314
+
315
+ ### Positionals
316
+
317
+ - `directory` — Project discovery start. Defaults to the current directory.
318
+
319
+ ### Options
320
+
321
+ | Option | Behavior |
322
+ |---|---|
323
+ | `--clean, --no-clean` | Remove or preserve the selected output directory before writing artifacts. Cleaning is enabled by default. |
324
+ | `--experimental-native-size` | Experimentally optimize Native Wasm for size. JavaScript build targets reject this flag. |
325
+ | `--profile <profile>` | Select a project profile. Precedence: --profile, PULSE_PROFILE, pulse.defaultProfile. |
326
+ | `--out <dir>` | Override the project-relative artifact output directory. |
327
+
328
+ ### Examples
329
+
330
+ ```bash
331
+ pulse compile ./my-pulse-app
332
+ pulse compile ./edge-app --out ./dist --json
333
+ pulse compile ./edge-app --experimental-native-size
334
+ ```
335
+
336
+
337
+ ### Related diagnostics
338
+
339
+ - [`PULSE_BUILD_OUT_UNSAFE`](diagnostics.md#pulse-build-out-unsafe) — The resolved build output can escape or alias outside the project root.
340
+ - [`PULSE_CANONICAL_NATIVE_PLAN_FAILED`](diagnostics.md#pulse-canonical-native-plan-failed) — The canonical handler could not be represented by the provider-neutral native execution-plan contract.
341
+ - [`PULSE_CANONICAL_NATIVE_COMPILE_FAILED`](diagnostics.md#pulse-canonical-native-compile-failed) — The provider-neutral native plan could not be compiled into Pulse-owned WebAssembly.
342
+
343
+
344
+ ### Output
345
+
346
+ - Writes pulse-compile.json, the canonical program, native plan, generated AssemblyScript, compact Wasm, WAT, and native manifest.
347
+ - The output is provider-neutral and does not package a deployment provider runtime.
348
+ - Experimental size builds record the exact non-default Native compiler optimization settings.
349
+ - With --json, emits one compile result object containing exact artifact paths and native metadata.
350
+
351
+ ### Side effects
352
+
353
+ - Cleans the output directory by default.
354
+ - Invokes the lockfile-pinned AssemblyScript compiler.
355
+ - Refuses absolute, parent-traversal, and symbolic-link traversal outside the project root.
356
+
357
+ ### Exit behavior
358
+
359
+ 0 on success; 2–5 according to the emitted stable diagnostic.
360
+
361
+ ## `pulse build`
362
+
363
+ Compile the canonical project and realize the deployment provider selected by the active project profile.
364
+
365
+ Syntax:
366
+
367
+ ```text
368
+ pulse build [directory] [--profile <name>] [--out <dir>] [--clean|--no-clean] [--experimental-native-size]
369
+ ```
370
+
371
+ ### Positionals
372
+
373
+ - `directory` — Project discovery start. Defaults to the current directory.
374
+
375
+ ### Options
376
+
377
+ | Option | Behavior |
378
+ |---|---|
379
+ | `--clean, --no-clean` | Remove or preserve the selected output directory before writing artifacts. Cleaning is enabled by default. |
380
+ | `--experimental-native-size` | Experimentally optimize Native Wasm for size. JavaScript build targets reject this flag. |
381
+ | `--profile <profile>` | Select a project profile. Precedence: --profile, PULSE_PROFILE, pulse.defaultProfile. |
382
+ | `--out <dir>` | Override the project-relative artifact output directory. |
383
+
384
+ ### Examples
385
+
386
+ ```bash
387
+ pulse build ./my-pulse-app
388
+ pulse build ./edge-app --out ./dist --json
389
+ pulse build ./edge-app --experimental-native-size
390
+ ```
391
+
392
+
393
+ ### Related diagnostics
394
+
395
+ - [`PULSE_BUILD_OUT_UNSAFE`](diagnostics.md#pulse-build-out-unsafe) — The resolved build output can escape or alias outside the project root.
396
+ - [`PULSE_BUILD_PROVIDER_REQUIRED`](diagnostics.md#pulse-build-provider-required) — pulse build requires a configured deployment provider; provider-neutral output belongs to pulse compile.
397
+ - [`PULSE_EXPERIMENTAL_NATIVE_SIZE_UNSUPPORTED`](diagnostics.md#pulse-experimental-native-size-unsupported) — The experimental Native size optimizer cannot be used for a JavaScript build target.
398
+ - [`PULSE_CANONICAL_NATIVE_COMPILE_FAILED`](diagnostics.md#pulse-canonical-native-compile-failed) — The provider-neutral native plan could not be compiled into Pulse-owned WebAssembly.
399
+
400
+
401
+ ### Output
402
+
403
+ - Writes pulse-build.json, the provider-neutral native module, and the configured provider realization.
404
+ - Fastly builds write generated AssemblyScript and direct-host-ABI native Wasm at bin/main.wasm; no JavaScript runtime image is packaged.
405
+ - Experimental size builds record the exact non-default Native compiler optimization settings in portable, provider, and build metadata.
406
+ - With --json, emits one build result object containing exact portable and provider artifact paths.
407
+
408
+ ### Side effects
409
+
410
+ - Cleans the output directory by default.
411
+ - Invokes the native compiler and configured provider realization.
412
+ - Refuses absolute, parent-traversal, and symbolic-link traversal outside the project root.
413
+
414
+ ### Exit behavior
415
+
416
+ 0 on success; 2–5 according to the emitted stable diagnostic.
417
+
418
+ ## Configuration discovery and command precedence
419
+
420
+ Project commands start discovery from their optional positional `[directory]` or the current directory, then search upward for the single configuration entrypoint:
421
+
422
+ ```text
423
+ .pulse/config.ts
424
+ ```
425
+
426
+ Profile selection follows `--profile`, `PULSE_PROFILE`, then `pulse.defaultProfile`. Command-line `--out`, `--host`, `--port`, and watch flags are invocation-local controls. Entry, provider, and target selection belong to `.pulse/config.ts`: `pulse compile` remains provider-neutral and `pulse build` realizes the selected provider. See [Project configuration](project-config.md).
427
+
428
+ ## JSON and stream contracts
429
+
430
+ For completed commands, `--json` emits one JSON object followed by a newline. `pulse dev --json` is deliberately different: stdout is newline-delimited JSON, with one event object per line. Event names are `compiled`, `ready`, `reloaded`, `request`, `compile-error`, and `request-error`; consumers must not wait for one enclosing JSON document.
431
+
432
+ Raw configured secret values are not included in project JSON, diagnostics, or runtime error detail fields.
433
+
434
+ ## Provider restrictions and build products
435
+
436
+ | Provider | inspect/build | test/dev | Build result |
437
+ |---|---:|---:|---|
438
+ | `node` | Yes | Yes | Portable Pulse Wasm plus the configured Node-native realization and `pulse-build.json`. |
439
+ | `fastly` | Yes | Yes, through local conformance | Portable Pulse Wasm plus generated AssemblyScript and compact direct-host-ABI `bin/main.wasm`. |
440
+ | `none` | Compile only | No | `pulse compile` emits portable Pulse Wasm; `pulse build` rejects the missing deployment provider. |
441
+
442
+ Build output is cleaned by default. `--no-clean` preserves the directory, but output safety still rejects absolute, parent-traversal, and symbolic-link traversal outside the project root.
443
+
444
+ ## Exit classes
445
+
446
+ | Exit | Meaning |
447
+ |---:|---|
448
+ | `0` | Command completed successfully. |
449
+ | `1` | Completed audit/test failure where documented, or an unexpected uncatalogued internal failure. |
450
+ | `2` | Usage, project configuration, provider selection, or output-safety error. |
451
+ | `3` | Canonical/schema/package-lowering/provider-binding failure. |
452
+ | `4` | Request, test, runtime, fetch, or continuation failure. |
453
+ | `5` | External toolchain or Fastly local-execution failure. |
454
+
455
+ `pulse doctor` completes with exit `1` when its audit contains failed checks. `pulse test` completes with exit `1` when a normal test run has failed cases. Setup failures use their diagnostic exit class.
456
+
457
+ Failed commands emit stable codes, categories, summaries, remediation, exit classes, and a versioned documentation URL. See [Diagnostics and remediation](diagnostics.md).
@@ -0,0 +1,169 @@
1
+ # Provider and target compatibility
2
+
3
+ This page is the single compatibility matrix for the Pulse Beta.
4
+ It records the tested source forms, provider bindings, target realizations, and
5
+ deployment boundary for the four explicit execution modes. The same managed
6
+ handler and Router contract applies in every column; target selection changes
7
+ the realization, not the application model.
8
+
9
+ For the exact TypeScript and JavaScript source subset behind these rows, see
10
+ [Managed handler TypeScript and JavaScript](./handler-authoring.md).
11
+
12
+ ## Reading the matrix
13
+
14
+ - `Yes` means the form is part of the current contract and has focused
15
+ cross-target evidence.
16
+ - `JS only` means the form may remain in an explicitly selected JavaScript
17
+ application but makes Native lowering ineligible.
18
+ - `No` means the form is outside the managed Pulse contract even when the
19
+ underlying JavaScript engine or provider offers it.
20
+ - A provider resource name, such as `Config Store`, names the realization
21
+ selected by that provider/target cell. It does not expose the provider SDK to
22
+ application code.
23
+
24
+ Pulse never changes columns automatically. A Native eligibility failure stops
25
+ the Native build; it does not authorize automatic JavaScript fallback.
26
+
27
+ ## Source-form compatibility
28
+
29
+ | Source form | Node JS | Fastly JS | Node Native | Fastly Native | Notes |
30
+ |---|---:|---:|---:|---:|---|
31
+ | Async-shaped managed handler | Yes | Yes | Yes | Yes | Native erases the authoring wrapper; it does not link Promise, JSPI, or Asyncify semantics. |
32
+ | Static `Router` topology and terminal `next()` | Yes | Yes | Yes | Yes | Covers static `get`, `head`, `post`, middleware, mounts, parameters, trailing wildcard, fallthrough, and the error lane. |
33
+ | Root-only `Pulse.on` and non-HTTP event context | Yes | No | Yes | No | Node owns the bounded reference ingress. Fastly source remains inspectable but execution/build eligibility fails closed. |
34
+ | Awaited one-way `ctx.emit` acceptance | Yes | No | Yes | No | Static schema-bound frames only; no delivery, loopback, public bus, call surface, or target fallback. |
35
+ | Sequential awaits of trusted Pulse effects | Yes | Yes | Yes | Yes | JavaScript preserves source order. Native lowers effects and continuations and may group adjacent independent effects without changing results. |
36
+ | `await ctx.parallel({ fixed: effect })` | Yes | Yes | Yes | Yes | Requires a nonempty inline object with fixed non-index keys and fresh request-owned Pulse effects. |
37
+ | Request metadata, route parameters, request state, logging, and response construction | Yes | Yes | Yes | Yes | These are synchronous managed surfaces; awaiting a proven synchronous value is redundant and may warn. |
38
+ | Schema-bound request, fetch, and response JSON | Yes | Yes | Yes | Yes | Schema and response-case IDs are literal project declarations. |
39
+ | Generic bounded JSON with `pulse.strict: false` | Yes | Yes | Yes | Yes | The plan records the generic host parser. Strict mode requires a declared schema. |
40
+ | Direct opaque response pass-through | Yes | Yes | Yes | Yes | Returnable, but not inspectable, iterable, buffered, transformed, or retained in userland. |
41
+ | Supported package-root Assets and GRIP calls | Yes | Yes | Yes | Yes | JavaScript runs the package implementation. Native accepts the package's synchronized, bounded lowerable subset. |
42
+ | Ordinary target-compatible JavaScript package API | Yes | Yes | No | No | JavaScript packaging must include a provider-compatible dependency. Native requires a trusted package-owned lowerer. |
43
+ | Arbitrary Promise construction or library await | JS only | JS only | No | No | Never valid inside `ctx.parallel`; Native reports the first eligibility boundary and never falls back. |
44
+ | Ambient `fetch`, timers, environment/process access, filesystem, sockets, or provider SDK | No | No | No | No | Use `ctx` effects and configured provider bindings. |
45
+ | Userland body streams, chunk transforms, or background work | No | No | No | No | Structured reads are bounded, opaque bodies stay host-owned, and work ends with the request. |
46
+
47
+ ## Provider and target realization
48
+
49
+ The application-facing source form stays the same across these cells. Text in a
50
+ cell names the provider-owned binding or artifact that realizes it.
51
+
52
+ | Capability | Node JS | Fastly JS | Node Native | Fastly Native | Notes |
53
+ |---|---:|---:|---:|---:|---|
54
+ | Canonical handler and Router execution | Yes | Yes | Yes | Yes | Shared handler, Router, context, effect, and result contracts. |
55
+ | Request and structured responses | Yes | Yes | Yes | Yes | Provider adapters preserve the canonical request/response model. |
56
+ | Single, sequential, and keyed-parallel fetch | Yes | Yes | Yes | Yes | Fetch is a `ctx` effect; no ambient fetch authority is implied. |
57
+ | Explicit JSON schemas and bounded generic JSON | Yes | Yes | Yes | Yes | Schema policy is project-owned and target-neutral. |
58
+ | Config reads | Test/dev binding | Config Store | Test/dev binding | Config Store | Exact names are resolved from the selected profile; no ambient fallback. |
59
+ | Secret reads | Test/dev binding | Secret Store | Test/dev binding | Secret Store | Secret values remain provider-owned and are redacted from diagnostics and logs. |
60
+ | KV `get` and `put` | In-memory binding | KV Store | In-memory binding | KV Store | Namespaces are explicit profile bindings. |
61
+ | Opaque pass-through | Yes | Yes | Yes | Yes | Bodies remain host-owned in all four modes. |
62
+ | GRIP framing and configured broadcast | Yes | Yes | Yes | Yes | The package-root contract owns the portable operation shape. |
63
+ | `ctx.log` and redaction | Yes | Yes | Yes | Yes | Provider output format may differ; the level and redaction contract does not. |
64
+ | Reference event ingress and `ctx.emit` acceptance | Bounded Node adapter | No | Bounded Node adapter | No | Direct parity evidence only: FIFO ingress, exact-frame acceptance, no loopback, delivery promise, public bus, call surface, or automatic fallback. |
65
+ | Local execution evidence | Node lifecycle | Provider emulation | Canonical host | Controlled ABI host | Local proof is not production provider activation. |
66
+ | Deployment candidate | Source package | Source package plus downstream runtime Wasm | Node build | `bin/main.wasm` | A candidate records the selected target and does not contain an automatic fallback artifact. |
67
+ | Production deployment and activation | Not applicable | Human-operated | Not applicable | Human-operated | Fastly reality, deployment, and activation remain explicit external gates. |
68
+
69
+ ## Entities Beta package
70
+
71
+ This table records measured behavior for the implemented
72
+ `@pulse-compute/entities` package. Release membership does not erase the
73
+ separate ordinary-lifecycle and Fastly Native integration boundaries.
74
+
75
+ | Entities capability | Node JS | Fastly JS | Node Native | Fastly Native | Notes |
76
+ |---|---:|---:|---:|---:|---|
77
+ | Static `EntityRouter` declarations | Yes | Yes | Yes | Yes | One literal router, first-party adapter, static registrations, named handlers, and one terminal binding. |
78
+ | Bounded JSON-RPC request execution | Measured | Measured | Measured | Measured | Fastly cells execute generated artifacts with Viceroy 0.20.1. |
79
+ | Declared input/output schema codecs | Measured | Measured | Measured | Measured | Selection precedes decode; only the selected schemas are available. |
80
+ | Managed handler effects | Measured | Measured | Measured | Measured | The shared corpus includes schema work, fetch, and stable negative cases. |
81
+ | Deterministic catalog and inspection | Yes | Yes | Yes | Yes | Catalog and redacted inspection are package-owned build artifacts. |
82
+ | Ordinary project build integration | Yes | Yes | No | No | JavaScript source packaging emits the catalog; Native evidence uses package source outside the ordinary build adoption path. |
83
+ | Ordinary project `test`/`dev` loading | Blocked | Blocked | Not applicable | Not applicable | The shared JavaScript loader requests an unexported physical entry instead of the public package root. |
84
+ | Automatic target fallback | No | No | No | No | Eligibility, measured execution, and release assignment remain separate claims. |
85
+
86
+ ## JWT and crypto Beta packages
87
+
88
+ This table records the sealed Phase D and E behavior of the synchronized
89
+ `1.0.0-beta.1` JWT/crypto packages. Validation does not itself authorize npm
90
+ publication.
91
+
92
+ | Candidate capability | Node JS | Fastly JS | Node Native | Fastly Native | Notes |
93
+ |---|---:|---:|---:|---:|---|
94
+ | HS256 MAC verification | `runtime-builtin` | `runtime-builtin` | `guest-source:pulse-hmac-as` | `guest-source:pulse-hmac-as` | All cells consume one bounded corpus and return the same closed result categories. |
95
+ | ES256 signature verification | `runtime-builtin` | `runtime-builtin` | `guest-linked:pulse-es256-rustcrypto-p256` | `guest-linked:pulse-es256-rustcrypto-p256` | The 38-case matrix runs both JavaScript cells and both Native optimization artifacts per provider with exact failure parity. |
96
+ | Exact realization selection | Yes | Yes | Yes | Yes | Profile replacement is whole-value replacement; there is no array or object merging. |
97
+ | Disabled fallback | Yes | Yes | Yes | Yes | Missing capability, unavailable pins, and realization failures stop without choosing another backend or target. |
98
+ | Secret-safe realization reporting | Yes | Yes | Yes | Yes | Reports identify algorithms and realizations but never key, message, or authenticator bytes. |
99
+ | Prebuilt `guest-linked` unit required | No | No | ES256 only | ES256 only | Native HS256 remains first-party AssemblyScript in the primary module; Native ES256 uses the exact audited RustCrypto guest. |
100
+ | JWT verification | HS256, ES256 | HS256, ES256 | HS256, ES256 | HS256, ES256 | RS256 and EdDSA remain unavailable; no failure changes algorithms, realizations, targets, or providers. |
101
+ | JWT authenticity before claims | Yes | Yes | Yes | Yes | Invalid authenticity exposes no claims and stops before clock, registered-claim, or schema authority. |
102
+ | Exact final-artifact execution | Package runtime | Compute artifact | Primary Native module | `bin/main.wasm` | Native cells execute the package-owned guest sources; JavaScript cells execute the exact selected runtime builtin. |
103
+
104
+ ## Evidence and authority
105
+
106
+ Each row above is grounded in one or more of these current contracts or focused
107
+ proofs:
108
+
109
+ - **Managed surface and target support:** `HANDLER_SURFACE_DEFINITIONS`,
110
+ `HANDLER_AUTHORING_MODES`, and `HANDLER_AUTHORING_POLICY_VERSION` in
111
+ `wasm/packages/contracts/src/handler/surface-contract.js`.
112
+ - **Public TypeScript shape:** `packages/runtime/src/index.d.ts` owns the
113
+ Promise-shaped handler, terminal `RouterNext`, context, effect, body, and
114
+ result types.
115
+ - **Async, trusted await, ambient authority, and `ctx.parallel` boundaries:**
116
+ `wasm/test/lowering/assert-canonical-api-lowering.cjs`.
117
+ - **Native source realization without Promise or Asyncify:**
118
+ `wasm/test/compiled/assert-canonical-native-wasm.cjs`.
119
+ - **Four-mode behavior and target integrity:**
120
+ `wasm/test/contracts/assert-four-mode-conformance.cjs` and
121
+ `wasm/test/support/four-mode-conformance.cjs`.
122
+ - **JavaScript effect order and explicit parallel behavior:**
123
+ `wasm/test/contracts/assert-javascript-effect-adapter.cjs`.
124
+ - **Router and context parity:**
125
+ `wasm/test/contracts/assert-node-router-context-parity.cjs`.
126
+ - **Schemas, generic JSON, and body ownership:**
127
+ `wasm/test/contracts/assert-schema-codecs.cjs`,
128
+ `wasm/test/contracts/assert-fetch-projections-request-bodies.cjs`, and
129
+ `wasm/test/runtime/assert-canonical-opaque-passthrough.cjs`.
130
+ - **Config, secrets, KV, exact bindings, and redaction:**
131
+ `wasm/test/contracts/assert-config-secrets-kv-redaction.cjs`.
132
+ - **Assets and GRIP package-root support:**
133
+ `wasm/test/compiled/assert-package-root-native.cjs`,
134
+ `wasm/test/contracts/assert-grip-cross-target-conformance.cjs`, and the
135
+ package runtime tasks registered in `wasm/test/suite/registry.cjs`.
136
+ - **Provider candidates and external reality boundary:** the Node/Fastly
137
+ provider tasks in `wasm/test/suite/registry.cjs` and the mandatory Fastly
138
+ reality gate declared by `release/pulse-release-manifest.json`.
139
+ - **Entities package:** static catalog and inspection proofs in
140
+ `wasm/test/entities/assert-entities-catalog.cjs` and
141
+ `wasm/test/entities/assert-entities-inspection.cjs`; orchestration boundaries
142
+ in `wasm/test/entities/assert-entities-orchestration-demo.cjs`; and the shared
143
+ four-mode Viceroy corpus in
144
+ `wasm/test/entities/assert-entities-cross-target.cjs`.
145
+ - **JWT/crypto packages:** the crypto corpus in
146
+ `packages/crypto/conformance/hs256.json`,
147
+ `wasm/test/crypto/assert-crypto-cross-target-conformance.cjs`, and
148
+ `wasm/.test-results/crypto-c4/phase-c-seal.json`; the JWT composition seal in
149
+ `wasm/.test-results/jwt-d4/jwt-phase-d-seal.json`; and the four-cell,
150
+ 210-execution cross-target seal in
151
+ `wasm/.test-results/jwt-e4/jwt-phase-e-seal.json`. The Fastly reality tasks
152
+ execute generated JavaScript and Native provider artifacts locally through
153
+ `fastly compute serve`; they do not deploy or activate a service.
154
+ ES256 target alignment is recorded by the six-cell, 228-evaluation matrix in
155
+ `wasm/.test-results/boundary-h4/es256-six-cell-matrix.json`, including the
156
+ Fastly JavaScript runtime Wasm under Viceroy.
157
+
158
+ The focused documentation assertion
159
+ `wasm/test/docs/assert-compatibility-matrix.cjs` keeps the matrix header unique,
160
+ checks the public target order, verifies its evidence paths, and compares the
161
+ documented managed-surface rule with the canonical handler-surface registry.
162
+
163
+ ## Related reference
164
+
165
+ - [Managed handler TypeScript and JavaScript](./handler-authoring.md)
166
+ - [Beta scope](../preview-scope.md)
167
+ - [Node build and execution](../guides/deploying-node.md)
168
+ - [Fastly deployment candidates](../guides/deploying-fastly.md)
169
+ - [Diagnostics and remediation](./diagnostics.md)