@codemation/cli 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -26
- package/dist/{CliBin-C3ar49fj.js → CliBin-Bx1lFBi5.js} +1041 -365
- package/dist/bin.js +1 -1
- package/dist/index.d.ts +644 -207
- package/dist/index.js +1 -1
- package/package.json +9 -6
- package/src/CliProgramFactory.ts +23 -8
- package/src/Program.ts +7 -3
- package/src/bootstrap/CodemationCliApplicationSession.ts +17 -19
- package/src/commands/DevCommand.ts +202 -171
- package/src/commands/ServeWebCommand.ts +26 -1
- package/src/commands/ServeWorkerCommand.ts +46 -30
- package/src/commands/devCommandLifecycle.types.ts +7 -11
- package/src/database/ConsumerDatabaseConnectionResolver.ts +55 -9
- package/src/database/DatabaseMigrationsApplyService.ts +2 -2
- package/src/dev/Builder.ts +1 -14
- package/src/dev/CliDevProxyServer.ts +447 -0
- package/src/dev/CliDevProxyServerFactory.ts +7 -0
- package/src/dev/DevApiRuntimeFactory.ts +44 -0
- package/src/dev/DevApiRuntimeHost.ts +130 -0
- package/src/dev/DevApiRuntimeServer.ts +107 -0
- package/src/dev/DevApiRuntimeTypes.ts +24 -0
- package/src/dev/DevAuthSettingsLoader.ts +9 -3
- package/src/dev/DevBootstrapSummaryFetcher.ts +1 -1
- package/src/dev/DevHttpProbe.ts +2 -2
- package/src/dev/DevNextHostEnvironmentBuilder.ts +35 -5
- package/src/dev/DevRebuildQueue.ts +54 -0
- package/src/dev/DevRebuildQueueFactory.ts +7 -0
- package/src/dev/DevSessionPortsResolver.ts +2 -2
- package/src/dev/DevSessionServices.ts +0 -4
- package/src/dev/DevSourceChangeClassifier.ts +33 -13
- package/src/dev/WatchRootsResolver.ts +6 -4
- package/src/runtime/NextHostConsumerServerCommandFactory.ts +11 -2
- package/src/runtime/TypeScriptRuntimeConfigurator.ts +7 -0
- package/src/user/CliDatabaseUrlDescriptor.ts +2 -2
- package/src/user/UserAdminCliBootstrap.ts +9 -21
- package/codemation-cli-0.0.3.tgz +0 -0
- package/src/dev/DevSourceRestartCoordinator.ts +0 -48
- package/src/dev/DevelopmentGatewayNotifier.ts +0 -35
- package/src/dev/RuntimeToolEntrypointResolver.ts +0 -47
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ It is intentionally **thin**: no DI container. [`CliProgramFactory`](./src/CliPr
|
|
|
8
8
|
|
|
9
9
|
## How it fits in the monorepo
|
|
10
10
|
|
|
11
|
-
The CLI **orchestrates** other packages. It does not embed the full Next UI or engine
|
|
11
|
+
The CLI **orchestrates** other packages. It does not embed the full Next UI or engine, but it now owns the dev runtime control plane directly instead of delegating dev hot-swap to separate workspace packages.
|
|
12
12
|
|
|
13
13
|
```text
|
|
14
14
|
Consumer project (your repo)
|
|
@@ -43,35 +43,28 @@ The CLI **orchestrates** other packages. It does not embed the full Next UI or e
|
|
|
43
43
|
│ uses / spawns
|
|
44
44
|
▼
|
|
45
45
|
┌────────────────────┬─────────────────────┬────────────────────────────┐
|
|
46
|
-
│ @codemation/host │ @codemation/next-host│
|
|
47
|
-
│ (plugin discovery, │ (production: │ (
|
|
48
|
-
│ logging, workflow │ `pnpm exec next │
|
|
46
|
+
│ @codemation/host │ @codemation/next-host│ CLI-owned dev runtime │
|
|
47
|
+
│ (plugin discovery, │ (production: │ (stable proxy + │
|
|
48
|
+
│ logging, workflow │ `pnpm exec next │ disposable API runtime) │
|
|
49
49
|
│ path helpers) │ start` cwd) │ │
|
|
50
50
|
└─────────┬──────────┴──────────┬──────────┴─────────────┬────────────────┘
|
|
51
51
|
│ │ │
|
|
52
52
|
│ │ │
|
|
53
53
|
▼ │ ▼
|
|
54
54
|
┌───────────────────┐ │ ┌─────────────────────┐
|
|
55
|
-
│ Engine & types │ │ │
|
|
56
|
-
│ via host (not a │ │ │
|
|
57
|
-
│ direct cli dep) │ │ │ (
|
|
55
|
+
│ Engine & types │ │ │ Worker runtime │
|
|
56
|
+
│ via host (not a │ │ │ via CLI + host │
|
|
57
|
+
│ direct cli dep) │ │ │ (`serve worker`) │
|
|
58
58
|
└───────────────────┘ │ └─────────────────────┘
|
|
59
|
-
│
|
|
60
|
-
▼
|
|
61
|
-
┌───────────────────┐
|
|
62
|
-
│ @codemation/ │
|
|
63
|
-
│ worker-cli │
|
|
64
|
-
│ (`serve worker`) │
|
|
65
|
-
└───────────────────┘
|
|
66
59
|
```
|
|
67
60
|
|
|
68
61
|
**Reading the diagram**
|
|
69
62
|
|
|
70
63
|
- **Vertical flow**: the binary loads `CliProgramFactory`, builds `CliProgram`, then Commander dispatches to a **command class** (`commands/*`).
|
|
71
|
-
- **Horizontal row**: shared **libraries** the CLI imports for discovery, logging, and path logic; **next-host** is where `serve web` runs the production Next server;
|
|
64
|
+
- **Horizontal row**: shared **libraries** the CLI imports for discovery, logging, and path logic; **next-host** is where `serve web` runs the production Next server; the CLI now also owns the stable dev proxy and disposable in-process API runtime used by `codemation dev`. `serve worker` stays inside the CLI/host container flow instead of delegating to a separate worker package.
|
|
72
65
|
- **Consumer tree**: `ConsumerOutputBuilder` transpiles sources into `.codemation/output/build` and writes the entry `index.js`; `ConsumerBuildArtifactsPublisher` writes plugins and updates the manifest consumed by the host at runtime.
|
|
73
66
|
|
|
74
|
-
For **
|
|
67
|
+
For **default consumer dev** vs **framework UI watch mode** (`codemation dev` vs `codemation dev --watch-framework`), see [`docs/development-modes.md`](../../docs/development-modes.md) at the repo root.
|
|
75
68
|
|
|
76
69
|
---
|
|
77
70
|
|
|
@@ -87,16 +80,17 @@ For **framework author vs consumer** dev modes (`CODEMATION_DEV_MODE`), see [`do
|
|
|
87
80
|
|
|
88
81
|
## Commands (overview)
|
|
89
82
|
|
|
90
|
-
| Command
|
|
91
|
-
|
|
|
92
|
-
| `codemation dev` (default)
|
|
93
|
-
| `codemation
|
|
94
|
-
| `codemation
|
|
95
|
-
| `codemation serve
|
|
96
|
-
| `codemation
|
|
97
|
-
| `codemation user
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
| Command | Purpose |
|
|
84
|
+
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
85
|
+
| `codemation dev` (default) | Dev session: ports, lock, packaged UI proxy, stable CLI-owned dev endpoint, watch consumer sources, and hot-swap a disposable in-process API runtime on change. |
|
|
86
|
+
| `codemation dev --watch-framework` | Framework-author dev session: same runtime/proxy flow, but runs **`next dev`** for `@codemation/next-host` UI HMR. |
|
|
87
|
+
| `codemation build` | Emit consumer output under `.codemation/output/build`, discover plugins, write manifest. |
|
|
88
|
+
| `codemation serve web` | Run consumer build if needed, then **`next start`** from `@codemation/next-host` with env pointing at the manifest. |
|
|
89
|
+
| `codemation serve worker` | Load `AppConfig`, build the app container in-process, and start the configured queue-backed worker runtime. |
|
|
90
|
+
| `codemation user create` | Create/update a DB user when auth is local (uses consumer config / `DATABASE_URL`). Dispatches `UpsertLocalBootstrapUserCommand` via the host `CommandBus` (password minimum 8 characters, same as invite acceptance). |
|
|
91
|
+
| `codemation user list` | List users via `ListUserAccountsQuery` and the host `QueryBus` (same auth/DB requirements as `user create`). |
|
|
92
|
+
|
|
93
|
+
Programmatic bootstrap: [`CodemationCliApplicationSession`](./src/bootstrap/CodemationCliApplicationSession.ts) builds an app container for command/query access (no HTTP/WebSocket servers); migrations and startup side effects remain explicit after container creation.
|
|
100
94
|
|
|
101
95
|
Use `codemation --help` and `codemation <command> --help` for flags (`--consumer-root`, build targets, etc.).
|
|
102
96
|
|