@t4h.framework/dev 0.0.0-experimental-5535fb8-124ed92bbb5f8ca2e9fd

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 (165) hide show
  1. package/.ai/skills/framework-dev/SKILL.md +346 -0
  2. package/README.md +172 -0
  3. package/dist/DevServer.d.ts +24 -0
  4. package/dist/DevServer.js +87 -0
  5. package/dist/DevServer.js.map +1 -0
  6. package/dist/__tests__/fixtures.d.ts +57 -0
  7. package/dist/__tests__/fixtures.js +31 -0
  8. package/dist/__tests__/fixtures.js.map +1 -0
  9. package/dist/claims.d.ts +2 -0
  10. package/dist/claims.js +54 -0
  11. package/dist/claims.js.map +1 -0
  12. package/dist/index.d.ts +15 -0
  13. package/dist/index.js +16 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/models/DevFileBinary.d.ts +15 -0
  16. package/dist/models/DevFileBinary.js +27 -0
  17. package/dist/models/DevFileBinary.js.map +1 -0
  18. package/dist/models/InMemoryDatabase.d.ts +20 -0
  19. package/dist/models/InMemoryDatabase.js +86 -0
  20. package/dist/models/InMemoryDatabase.js.map +1 -0
  21. package/dist/models/JSONCodec.d.ts +30 -0
  22. package/dist/models/JSONCodec.js +110 -0
  23. package/dist/models/JSONCodec.js.map +1 -0
  24. package/dist/models/JSONCodecKindFrameworkSerializableClass.d.ts +8 -0
  25. package/dist/models/JSONCodecKindFrameworkSerializableClass.js +7 -0
  26. package/dist/models/JSONCodecKindFrameworkSerializableClass.js.map +1 -0
  27. package/dist/models/JSONRPCClient.d.ts +11 -0
  28. package/dist/models/JSONRPCClient.js +50 -0
  29. package/dist/models/JSONRPCClient.js.map +1 -0
  30. package/dist/models/JSONRPCServer.d.ts +63 -0
  31. package/dist/models/JSONRPCServer.js +61 -0
  32. package/dist/models/JSONRPCServer.js.map +1 -0
  33. package/dist/models/WorkflowRun.d.ts +18 -0
  34. package/dist/models/WorkflowRun.js +20 -0
  35. package/dist/models/WorkflowRun.js.map +1 -0
  36. package/dist/models/WorkflowRunActivity.d.ts +40 -0
  37. package/dist/models/WorkflowRunActivity.js +52 -0
  38. package/dist/models/WorkflowRunActivity.js.map +1 -0
  39. package/dist/models/claims/DevCacheClaim.d.ts +6 -0
  40. package/dist/models/claims/DevCacheClaim.js +12 -0
  41. package/dist/models/claims/DevCacheClaim.js.map +1 -0
  42. package/dist/models/claims/DevFileSystemClaim.d.ts +7 -0
  43. package/dist/models/claims/DevFileSystemClaim.js +30 -0
  44. package/dist/models/claims/DevFileSystemClaim.js.map +1 -0
  45. package/dist/models/claims/DevGetActivityUniqueIdentifierClaim.d.ts +7 -0
  46. package/dist/models/claims/DevGetActivityUniqueIdentifierClaim.js +31 -0
  47. package/dist/models/claims/DevGetActivityUniqueIdentifierClaim.js.map +1 -0
  48. package/dist/models/claims/DevGetProjectUniqueIdentifierClaim.d.ts +6 -0
  49. package/dist/models/claims/DevGetProjectUniqueIdentifierClaim.js +13 -0
  50. package/dist/models/claims/DevGetProjectUniqueIdentifierClaim.js.map +1 -0
  51. package/dist/models/claims/DevGetProjectVersionUniqueIdentifierClaim.d.ts +6 -0
  52. package/dist/models/claims/DevGetProjectVersionUniqueIdentifierClaim.js +13 -0
  53. package/dist/models/claims/DevGetProjectVersionUniqueIdentifierClaim.js.map +1 -0
  54. package/dist/models/claims/DevGetProjectVersionWorkflowUniqueIdentifierClaim.d.ts +7 -0
  55. package/dist/models/claims/DevGetProjectVersionWorkflowUniqueIdentifierClaim.js +31 -0
  56. package/dist/models/claims/DevGetProjectVersionWorkflowUniqueIdentifierClaim.js.map +1 -0
  57. package/dist/models/claims/DevGetWorkflowUniqueIdentifierClaim.d.ts +7 -0
  58. package/dist/models/claims/DevGetWorkflowUniqueIdentifierClaim.js +31 -0
  59. package/dist/models/claims/DevGetWorkflowUniqueIdentifierClaim.js.map +1 -0
  60. package/dist/models/claims/DevHttpClientRequestClaim.d.ts +5 -0
  61. package/dist/models/claims/DevHttpClientRequestClaim.js +39 -0
  62. package/dist/models/claims/DevHttpClientRequestClaim.js.map +1 -0
  63. package/dist/models/claims/DevORMClaim.d.ts +8 -0
  64. package/dist/models/claims/DevORMClaim.js +39 -0
  65. package/dist/models/claims/DevORMClaim.js.map +1 -0
  66. package/dist/models/claims/DevSftpClaim.d.ts +20 -0
  67. package/dist/models/claims/DevSftpClaim.js +148 -0
  68. package/dist/models/claims/DevSftpClaim.js.map +1 -0
  69. package/dist/models/claims/DevSmtpSendEmailClaim.d.ts +6 -0
  70. package/dist/models/claims/DevSmtpSendEmailClaim.js +32 -0
  71. package/dist/models/claims/DevSmtpSendEmailClaim.js.map +1 -0
  72. package/dist/models/claims/DevWorkflowClaim.d.ts +7 -0
  73. package/dist/models/claims/DevWorkflowClaim.js +38 -0
  74. package/dist/models/claims/DevWorkflowClaim.js.map +1 -0
  75. package/dist/repositories/WorkflowRun.repository.d.ts +8 -0
  76. package/dist/repositories/WorkflowRun.repository.js +27 -0
  77. package/dist/repositories/WorkflowRun.repository.js.map +1 -0
  78. package/dist/repositories/WorkflowRunActivity.repository.d.ts +8 -0
  79. package/dist/repositories/WorkflowRunActivity.repository.js +36 -0
  80. package/dist/repositories/WorkflowRunActivity.repository.js.map +1 -0
  81. package/dist/services/BuildWorkflowRunResult.service.d.ts +8 -0
  82. package/dist/services/BuildWorkflowRunResult.service.js +49 -0
  83. package/dist/services/BuildWorkflowRunResult.service.js.map +1 -0
  84. package/dist/services/RuntimeContext.service.d.ts +10 -0
  85. package/dist/services/RuntimeContext.service.js +22 -0
  86. package/dist/services/RuntimeContext.service.js.map +1 -0
  87. package/dist/services/TimeoutScheduler.service.d.ts +5 -0
  88. package/dist/services/TimeoutScheduler.service.js +33 -0
  89. package/dist/services/TimeoutScheduler.service.js.map +1 -0
  90. package/dist/services/WorkflowRunAsyncActivityFacade.service.d.ts +20 -0
  91. package/dist/services/WorkflowRunAsyncActivityFacade.service.js +54 -0
  92. package/dist/services/WorkflowRunAsyncActivityFacade.service.js.map +1 -0
  93. package/dist/services/WorkflowRunFacade.service.d.ts +13 -0
  94. package/dist/services/WorkflowRunFacade.service.js +40 -0
  95. package/dist/services/WorkflowRunFacade.service.js.map +1 -0
  96. package/dist/services/WorkflowRunSyncActivityFacade.service.d.ts +7 -0
  97. package/dist/services/WorkflowRunSyncActivityFacade.service.js +26 -0
  98. package/dist/services/WorkflowRunSyncActivityFacade.service.js.map +1 -0
  99. package/dist/tools/build-tools.d.ts +6 -0
  100. package/dist/tools/build-tools.js +7 -0
  101. package/dist/tools/build-tools.js.map +1 -0
  102. package/dist/tools/find-claim-by-constructor.d.ts +1 -0
  103. package/dist/tools/find-claim-by-constructor.js +8 -0
  104. package/dist/tools/find-claim-by-constructor.js.map +1 -0
  105. package/dist/tools/is-workflow-waiting.d.ts +4 -0
  106. package/dist/tools/is-workflow-waiting.js +12 -0
  107. package/dist/tools/is-workflow-waiting.js.map +1 -0
  108. package/dist/tools/json-codec.d.ts +8 -0
  109. package/dist/tools/json-codec.js +14 -0
  110. package/dist/tools/json-codec.js.map +1 -0
  111. package/dist/tools/json-schema-to-inquirer-question.d.ts +11 -0
  112. package/dist/tools/json-schema-to-inquirer-question.js +34 -0
  113. package/dist/tools/json-schema-to-inquirer-question.js.map +1 -0
  114. package/dist/tools/mkdir-out-dir-project-from-ts-config-path-and-json-package-path.d.ts +1 -0
  115. package/dist/tools/mkdir-out-dir-project-from-ts-config-path-and-json-package-path.js +11 -0
  116. package/dist/tools/mkdir-out-dir-project-from-ts-config-path-and-json-package-path.js.map +1 -0
  117. package/dist/tools/resolve-package-json-path.d.ts +1 -0
  118. package/dist/tools/resolve-package-json-path.js +21 -0
  119. package/dist/tools/resolve-package-json-path.js.map +1 -0
  120. package/dist/tools/resolve-tsconfig-path-from-package-json-path.d.ts +1 -0
  121. package/dist/tools/resolve-tsconfig-path-from-package-json-path.js +14 -0
  122. package/dist/tools/resolve-tsconfig-path-from-package-json-path.js.map +1 -0
  123. package/dist/tools/ts-build-watch.d.ts +12 -0
  124. package/dist/tools/ts-build-watch.js +46 -0
  125. package/dist/tools/ts-build-watch.js.map +1 -0
  126. package/dist/tools/ts-build.d.ts +6 -0
  127. package/dist/tools/ts-build.js +37 -0
  128. package/dist/tools/ts-build.js.map +1 -0
  129. package/dist/tools/up-app.d.ts +2 -0
  130. package/dist/tools/up-app.js +10 -0
  131. package/dist/tools/up-app.js.map +1 -0
  132. package/dist/transport/DevServerJsonRpc.d.ts +2 -0
  133. package/dist/transport/DevServerJsonRpc.js +42 -0
  134. package/dist/transport/DevServerJsonRpc.js.map +1 -0
  135. package/dist/use-cases/CallbackWorkflowRunAsyncActivity.usecase.d.ts +14 -0
  136. package/dist/use-cases/CallbackWorkflowRunAsyncActivity.usecase.js +64 -0
  137. package/dist/use-cases/CallbackWorkflowRunAsyncActivity.usecase.js.map +1 -0
  138. package/dist/use-cases/CreateWorkflowRun.usecase.d.ts +14 -0
  139. package/dist/use-cases/CreateWorkflowRun.usecase.js +43 -0
  140. package/dist/use-cases/CreateWorkflowRun.usecase.js.map +1 -0
  141. package/dist/use-cases/CreateWorkflowRunAsyncActivity.usecase.d.ts +9 -0
  142. package/dist/use-cases/CreateWorkflowRunAsyncActivity.usecase.js +68 -0
  143. package/dist/use-cases/CreateWorkflowRunAsyncActivity.usecase.js.map +1 -0
  144. package/dist/use-cases/NextTickWorkflowRun.usecase.d.ts +20 -0
  145. package/dist/use-cases/NextTickWorkflowRun.usecase.js +151 -0
  146. package/dist/use-cases/NextTickWorkflowRun.usecase.js.map +1 -0
  147. package/dist/use-cases/TimeoutWorkflowRunAsyncActivity.usecase.d.ts +8 -0
  148. package/dist/use-cases/TimeoutWorkflowRunAsyncActivity.usecase.js +38 -0
  149. package/dist/use-cases/TimeoutWorkflowRunAsyncActivity.usecase.js.map +1 -0
  150. package/dist/use-cases/WorkflowRunAsyncActivity.usecase.d.ts +7 -0
  151. package/dist/use-cases/WorkflowRunAsyncActivity.usecase.js +44 -0
  152. package/dist/use-cases/WorkflowRunAsyncActivity.usecase.js.map +1 -0
  153. package/dist/use-cases/WorkflowRunAsyncActivityAdvance.usecase.d.ts +10 -0
  154. package/dist/use-cases/WorkflowRunAsyncActivityAdvance.usecase.js +57 -0
  155. package/dist/use-cases/WorkflowRunAsyncActivityAdvance.usecase.js.map +1 -0
  156. package/dist/use-cases/WorkflowRunBuildHistory.usecase.d.ts +8 -0
  157. package/dist/use-cases/WorkflowRunBuildHistory.usecase.js +41 -0
  158. package/dist/use-cases/WorkflowRunBuildHistory.usecase.js.map +1 -0
  159. package/dist/use-cases/WorkflowRunSyncActivity.usecase.d.ts +4 -0
  160. package/dist/use-cases/WorkflowRunSyncActivity.usecase.js +26 -0
  161. package/dist/use-cases/WorkflowRunSyncActivity.usecase.js.map +1 -0
  162. package/dist/workers/app-process.d.ts +3 -0
  163. package/dist/workers/app-process.js +42 -0
  164. package/dist/workers/app-process.js.map +1 -0
  165. package/package.json +78 -0
@@ -0,0 +1,346 @@
1
+ ---
2
+ name: framework-dev
3
+ description: >-
4
+ Local development runtime for T4H Framework apps via @t4h.framework/dev:
5
+ DevServer (TypeScript watch, forked app process, JSON-RPC IPC), dev claim
6
+ providers (ORM, HTTP, FS, cache, SMTP, workflow engine), workflow runs, env
7
+ vars, and async activity advancement. Use when implementing or debugging
8
+ framework dev, embedding DevServer, importing @t4h.framework/dev/build for
9
+ tsBuild/tsBuildWatch/upApp, wiring dev claims in tests, isWorkflowWaiting,
10
+ findClaimByConstructor, db.json ORM persistence, or understanding how
11
+ framework dev / framework build work under @t4h.framework/cli.
12
+ ---
13
+
14
+ # @t4h.framework/dev
15
+
16
+ Local development runtime for [T4H Framework](https://github.com/tech4humans-brasil/framework) apps. Watches TypeScript, compiles the project, forks a child process that loads the user's `App`, and runs workflows with in-memory or local claim implementations — no external runtime infrastructure.
17
+
18
+ | Import | Purpose |
19
+ |--------|---------|
20
+ | `@t4h.framework/dev` | `DevServer`, `claims`, dev claim classes, `findClaimByConstructor`, `isWorkflowWaiting` |
21
+ | `@t4h.framework/dev/build` | `tsBuild`, `tsBuildWatch`, `upApp`, path resolvers, `mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath` |
22
+
23
+ Node `>=22`. ESM (`"type": "module"`). Authoritative docs: `packages/dev/README.md` and source under `packages/dev/src/`.
24
+
25
+ Interactive CLI (`framework dev`, `framework build`) lives in **`@t4h.framework/cli`** — see `packages/cli/.ai/skills/framework-cli/SKILL.md` for flags and menus. This skill covers the **dev package API and behavior**.
26
+
27
+ ---
28
+
29
+ ## Architecture
30
+
31
+ ```mermaid
32
+ flowchart TB
33
+ subgraph parent ["Parent (DevServer)"]
34
+ Watch["tsBuildWatch"]
35
+ RPCClient["JSON-RPC client"]
36
+ Watch -->|"onSuccess"| Fork
37
+ Fork["fork(app-process)"]
38
+ Fork --> RPCClient
39
+ end
40
+
41
+ subgraph child ["Child (app-process worker)"]
42
+ App["User App via upApp"]
43
+ RPCServer["JSON-RPC server"]
44
+ Claims["claims registry"]
45
+ App --> RPCServer
46
+ Claims --> App
47
+ end
48
+
49
+ RPCClient <-->|"IPC messages"| RPCServer
50
+ ```
51
+
52
+ 1. **Parent** — `DevServer.start()` resolves paths, creates a temp out dir, starts `tsBuildWatch`.
53
+ 2. **On successful compile** — kills prior child, forks `src/workers/app-process.js` with compiled entry URL and `NAME=value` env args.
54
+ 3. **Child** — `upApp(entrypoint)` loads `App`, registers RPC handlers from `DevServerJsonRpc`, notifies parent with `manifest`.
55
+ 4. **Parent drives** — workflows, env, async advancement via `JSONRPCClient.call(...)`.
56
+
57
+ Rebuild on file change restarts the child (CLI aborts in-flight prompts on manifest reload).
58
+
59
+ ---
60
+
61
+ ## App project requirements
62
+
63
+ | Requirement | Detail |
64
+ |-------------|--------|
65
+ | `package.json` `main` | Non-empty string (compiled JS path relative to `dist/`) |
66
+ | `tsconfig.json` | Beside `package.json` (`resolveTsconfigFromPackageJsonPath`) |
67
+ | App export | `default` instance of `App` **or** named `app` (`upApp` throws `App not found` otherwise) |
68
+ | Peer deps | Match app imports: `@t4h.framework/core`, `cache`, `fs`, `http`, `orm`, `smtp`, `runtime-claims` |
69
+
70
+ Typical app script (via CLI):
71
+
72
+ ```json
73
+ {
74
+ "main": "main.js",
75
+ "scripts": {
76
+ "dev": "framework dev --env-file-if-exists=.env"
77
+ },
78
+ "devDependencies": {
79
+ "@t4h.framework/cli": "workspace:^"
80
+ }
81
+ }
82
+ ```
83
+
84
+ Install dev package directly only for **programmatic** embedding:
85
+
86
+ ```bash
87
+ yarn add -D @t4h.framework/dev
88
+ ```
89
+
90
+ ---
91
+
92
+ ## DevServer (programmatic)
93
+
94
+ ```typescript
95
+ import { DevServer } from '@t4h.framework/dev'
96
+
97
+ const devServer = new DevServer(
98
+ {
99
+ entrypoint: './package.json',
100
+ env: { API_KEY: 'secret' },
101
+ },
102
+ manifest => {
103
+ console.log(
104
+ 'App loaded:',
105
+ manifest.workflows.map(w => w.id),
106
+ )
107
+ },
108
+ )
109
+
110
+ await devServer.start()
111
+
112
+ const result = await devServer.runWorkflow('my-workflow/v1', {
113
+ userId: '123',
114
+ })
115
+
116
+ await devServer.setEnv('API_KEY', 'new-value')
117
+ const env = await devServer.listEnv()
118
+
119
+ const pending = await devServer.listWaitingAsyncActivities()
120
+ await devServer.advanceAsyncActivity(pending[0].id, { approved: true })
121
+ ```
122
+
123
+ ### `DevServerConfig`
124
+
125
+ | Field | Type | Role |
126
+ |-------|------|------|
127
+ | `entrypoint` | `string` | Path to `package.json` or directory containing it |
128
+ | `env` | `Record<string, string>` | Initial env passed to child as `NAME=value` argv |
129
+
130
+ ### Methods
131
+
132
+ | Method | RPC / behavior |
133
+ |--------|----------------|
134
+ | `start()` | Resolve paths, temp out dir, `tsBuildWatch`; fork child on first successful build |
135
+ | `runWorkflow(workflowId, input)` | `workflow.run` |
136
+ | `setEnv(name, value)` | `env.set` |
137
+ | `listEnv()` | `env.list` → `Record<string, string>` |
138
+ | `listWaitingAsyncActivities()` | `workflow.async-activities.waiting.list` |
139
+ | `advanceAsyncActivity(id, payload)` | `workflow.async-activities.advance` |
140
+
141
+ Compile overrides in `DevServer` (same as `framework build`): `outDir: <temp>/dist`, `sourceMap: true`, `declaration: false`.
142
+
143
+ ---
144
+
145
+ ## Workflow run results
146
+
147
+ `BuildWorkflowRunResultService.build(run)` shapes RPC results:
148
+
149
+ | Run state | Returned value |
150
+ |-----------|----------------|
151
+ | `fulfilled` | `run.output` |
152
+ | `rejected` | `{ error: run.rejectedReason }` |
153
+ | pending async activity | `{ isWaiting: true, id: string }` (activity id) |
154
+ | otherwise | `{ isWaiting: false }` |
155
+
156
+ Detect waiting results in tooling:
157
+
158
+ ```typescript
159
+ import { isWorkflowWaiting } from '@t4h.framework/dev'
160
+
161
+ if (isWorkflowWaiting(result)) {
162
+ console.log(`Paused; advance activity id: ${result.id}`)
163
+ }
164
+ ```
165
+
166
+ The CLI uses this for the same guidance after **Run workflow**.
167
+
168
+ ---
169
+
170
+ ## JSON-RPC surface (child handlers)
171
+
172
+ Defined in `src/transport/DevServerJsonRpc.ts`:
173
+
174
+ | Method | Params | Behavior |
175
+ |--------|--------|----------|
176
+ | `workflow.run` | `workflowId`, `input` | Create run, `nextTick`, return built result |
177
+ | `workflow.async-activities.advance` | `id`, `payload` | Advance pending async activity |
178
+ | `workflow.async-activities.waiting.list` | — | Pending activities with `id`, `workflowId`, optional `schema` |
179
+ | `env.set` | `name`, `value` | Update child env `Map` (scoped via `Env.run`) |
180
+ | `env.list` | — | `Object.fromEntries(env)` |
181
+
182
+ Parent receives `manifest` notification from child (`app.toManifest()`, workflow ids default to `:index` when missing).
183
+
184
+ ---
185
+
186
+ ## Build pipeline (`@t4h.framework/dev/build`)
187
+
188
+ Used by `framework build` and internally by `DevServer`. Mirror imports from `packages/cli/src/commands/build/build.ts`:
189
+
190
+ ```typescript
191
+ import path from 'node:path'
192
+ import {
193
+ mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath,
194
+ resolvePackageJsonPath,
195
+ resolveTsconfigFromPackageJsonPath,
196
+ tsBuild,
197
+ upApp,
198
+ } from '@t4h.framework/dev/build'
199
+ ```
200
+
201
+ ### Steps (`framework build`)
202
+
203
+ 1. `resolvePackageJsonPath(entrypoint)` — file or directory; throws if missing.
204
+ 2. `resolveTsconfigFromPackageJsonPath` — `<packageDir>/tsconfig.json` must exist.
205
+ 3. `mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath` — creates `<tsconfigDir>/.temp/<random>/`, copies `package.json`; may `process.send({ type: 'outDir', data })` when IPC parent exists.
206
+ 4. `tsBuild(tsconfigPath, { outDir: join(outDir, 'dist'), sourceMap: true, declaration: false, declarationMap: false })` — returns `{ ok, diagnostics, parsed }`; throw on `!ok`.
207
+ 5. `Env.run(env, () => upApp(join(outDir, 'dist', packageJson.main)))` then `app.toManifest()` → `manifest.json` in out dir.
208
+
209
+ ### `tsBuild` vs `tsBuildWatch`
210
+
211
+ | Function | Use |
212
+ |----------|-----|
213
+ | `tsBuild` | One-shot compile (`framework build`) |
214
+ | `tsBuildWatch` | Watch mode with `onSuccess`, `onFail`, `onStatus`; returns `{ close() }` watcher |
215
+
216
+ ### `upApp(appPath)`
217
+
218
+ ```typescript
219
+ const module = await import(appPath)
220
+ if (module.default instanceof App) return module.default
221
+ if (module.app instanceof App) return module.app
222
+ throw new Error('App not found')
223
+ ```
224
+
225
+ Tests: `src/tools/__tests__/up-app.spec.ts`.
226
+
227
+ ---
228
+
229
+ ## Dev claims
230
+
231
+ Registry: `export const claims` in `src/claims.ts` (`ClaimProvider[]` for `App` / `WorkflowTesting`).
232
+
233
+ ```typescript
234
+ import { claims, findClaimByConstructor } from '@t4h.framework/dev'
235
+ import { DevHttpClientRequestClaim } from '@t4h.framework/dev'
236
+
237
+ const httpClaim = findClaimByConstructor(DevHttpClientRequestClaim)
238
+ ```
239
+
240
+ | Claim constructor | Dev class | Behavior (from source) |
241
+ |-------------------|-----------|------------------------|
242
+ | `ORMClaim` | `DevORMClaim` | In-memory DB persisted to **`db.json`** in `process.cwd()` |
243
+ | `HttpClientRequestClaim` | `DevHttpClientRequestClaim` | Real HTTP via **`undici`** (`request`, redirects) |
244
+ | `FileSystemClaim` | `DevFileSystemClaim` | Local FS; writes under temp dir; `DevFileBinary` codec |
245
+ | `SmtpSendEmailClaim` | `DevSmtpSendEmailClaim` | **`nodemailer`** transport from `connectionString` URL |
246
+ | `WorkflowClaim` | `DevWorkflowClaim` | Local workflow runs via `WorkflowRunFacade` (nested `startWorkflow`) |
247
+ | `CacheClaim` | `DevCacheClaim` | In-memory `Map` (process lifetime) |
248
+ | `SftpClaim` | `DevSftpClaim` | Real SFTP via **`ssh2-sftp-client`** |
249
+ | `GetActivityUniqueIdentifierClaim` | `DevGetActivityUniqueIdentifierClaim` | Dev identifiers |
250
+ | `GetWorkflowUniqueIdentifierClaim` | `DevGetWorkflowUniqueIdentifierClaim` | Dev identifiers |
251
+ | `GetProjectUniqueIdentifierClaim` | `DevGetProjectUniqueIdentifierClaim` | Dev identifiers |
252
+ | `GetProjectVersionUniqueIdentifierClaim` | `DevGetProjectVersionUniqueIdentifierClaim` | Dev identifiers |
253
+ | `GetProjectVersionWorkflowUniqueIdentifierClaim` | `DevGetProjectVersionWorkflowUniqueIdentifierClaim` | Dev identifiers |
254
+
255
+ Exported claim classes (main entry): see `src/index.ts` — not every registry entry has a dedicated public export; use `claims` or `findClaimByConstructor` for tests.
256
+
257
+ `DevWorkflowClaim.start` requires `workflow.id`; supports parent run context via `RuntimeContextService`.
258
+
259
+ ---
260
+
261
+ ## Testing with dev claims
262
+
263
+ Prefer `@t4h.framework/core/testing` (`WorkflowTesting`) for unit tests. For integration-style tests that need real dev claim behavior:
264
+
265
+ ```typescript
266
+ import { claims, DevHttpClientRequestClaim, findClaimByConstructor } from '@t4h.framework/dev'
267
+ import { WorkflowTesting } from '@t4h.framework/core/testing'
268
+
269
+ const httpClaim = findClaimByConstructor(DevHttpClientRequestClaim)
270
+ vi.spyOn(httpClaim, 'request')
271
+
272
+ await WorkflowTesting.run(MyWorkflow, input, { claims })
273
+ ```
274
+
275
+ Pattern referenced in commented `examples/basic/src/workflows/__tests__/simple.spec.ts`.
276
+
277
+ RPC handler tests: `src/transport/__tests__/DevServerJsonRpc.spec.ts`. Result shaping: `src/services/__tests__/BuildWorkflowRunResult.service.spec.ts`. Async fixtures: `src/__tests__/fixtures.ts` (`TestAsyncActivity` with `pending` / `advance`).
278
+
279
+ ---
280
+
281
+ ## Package layout (for contributors)
282
+
283
+ ```
284
+ packages/dev/src/
285
+ ├── DevServer.ts # Parent orchestration
286
+ ├── claims.ts # ClaimProvider registry
287
+ ├── workers/app-process.ts # Child entry (fork target)
288
+ ├── transport/DevServerJsonRpc.ts
289
+ ├── tools/ # build, watch, upApp, resolvers
290
+ ├── models/claims/ # Dev*Claim implementations
291
+ ├── services/ # WorkflowRunFacade, BuildWorkflowRunResult, …
292
+ ├── use-cases/ # CreateWorkflowRun, async advance, …
293
+ └── repositories/ # In-memory workflow run stores
294
+ ```
295
+
296
+ Develop the package:
297
+
298
+ ```bash
299
+ cd packages/dev
300
+ yarn build
301
+ yarn test # vitest
302
+ yarn check-types
303
+ ```
304
+
305
+ `vitest.setup.ts` loads `reflect-metadata` (pleroma DI).
306
+
307
+ ---
308
+
309
+ ## Common mistakes (do not invent APIs)
310
+
311
+ | Mistake | Reality |
312
+ |---------|---------|
313
+ | Export plain object instead of `App` | `upApp` throws `App not found` |
314
+ | Missing `tsconfig.json` next to `package.json` | `resolveTsconfigFromPackageJsonPath` throws |
315
+ | Missing or non-string `package.json` `main` | `DevServer` / build throw |
316
+ | Expecting SMTP captured in memory | `DevSmtpSendEmailClaim` sends via nodemailer using the activity connection string |
317
+ | Expecting mock HTTP in dev | `DevHttpClientRequestClaim` performs real outbound HTTP |
318
+ | ORM data lost between runs | Data lives in **`db.json`** under cwd (deleted only if you remove the file) |
319
+ | Wrong waiting-result shape | Use `isWorkflowWaiting` — checks `isWaiting === true` and string `id` |
320
+ | Import build tools from main entry | Use `@t4h.framework/dev/build` for `tsBuild`, `upApp`, resolvers |
321
+ | Assume all JSON Schema types in CLI prompts | CLI only handles `object`, `string`, `number` (see framework-cli skill) |
322
+ | Add RPC methods without updating both sides | Parent `DevServer` client calls must match child `handlers` in `DevServerJsonRpc.ts` |
323
+
324
+ ---
325
+
326
+ ## Quick reference
327
+
328
+ ```bash
329
+ # Via CLI (requires @t4h.framework/cli)
330
+ framework dev --entrypoint ./package.json -e API_KEY=secret
331
+ framework dev --env-file-if-exists=.env
332
+ framework build --entrypoint ./package.json -e MY_VAR=value
333
+ ```
334
+
335
+ ```typescript
336
+ // Programmatic dev loop
337
+ import { DevServer, isWorkflowWaiting } from '@t4h.framework/dev'
338
+
339
+ // Build-only tooling
340
+ import { tsBuild, upApp } from '@t4h.framework/dev/build'
341
+
342
+ // Test / custom App wiring
343
+ import { claims, findClaimByConstructor, DevORMClaim } from '@t4h.framework/dev'
344
+ ```
345
+
346
+ For CLI menus, publish IPC, and binary relaunch behavior, use **`framework-cli`** skill. For workflow/activity authoring, use **`framework-core`** skill.
package/README.md ADDED
@@ -0,0 +1,172 @@
1
+ # @t4h.framework/dev
2
+
3
+ Local development runtime for [T4H Framework](https://github.com/tech4humans-brasil/framework) apps. Watches your project, compiles TypeScript, loads your `App`, and executes workflows with in-memory claim implementations — no external infrastructure required.
4
+
5
+ ## What it does
6
+
7
+ When you run `framework dev` (via `@t4h.framework/cli`), this package powers the experience behind the scenes:
8
+
9
+ 1. **TypeScript watch** — compiles your app on every change.
10
+ 2. **App process** — forks a child Node process that loads your compiled `App`.
11
+ 3. **JSON-RPC over IPC** — the parent process drives workflows, env vars, and async activity advancement through a typed RPC layer.
12
+ 4. **Dev claims** — provides local implementations for ORM, HTTP, file system, cache, SMTP, and more.
13
+
14
+ ```mermaid
15
+ flowchart TB
16
+ subgraph parent ["Parent process (DevServer)"]
17
+ Watch["TypeScript watch"]
18
+ RPCClient["JSON-RPC client"]
19
+ Watch -->|"build success"| Fork
20
+ Fork["fork()"]
21
+ Fork --> RPCClient
22
+ end
23
+
24
+ subgraph child ["Child process (app-process worker)"]
25
+ App["User App"]
26
+ RPCServer["JSON-RPC server"]
27
+ Claims["Dev claims"]
28
+ App --> RPCServer
29
+ Claims --> App
30
+ end
31
+
32
+ RPCClient <-->|"IPC / JSON-RPC"| RPCServer
33
+ ```
34
+
35
+ ## Installation
36
+
37
+ This package is typically consumed as a dependency of `@t4h.framework/cli`:
38
+
39
+ ```bash
40
+ yarn add -D @t4h.framework/cli
41
+ ```
42
+
43
+ To use it programmatically:
44
+
45
+ ```bash
46
+ yarn add -D @t4h.framework/dev
47
+ ```
48
+
49
+ ### Peer dependencies
50
+
51
+ `@t4h.framework/dev` requires the same framework packages your app uses:
52
+
53
+ - `@t4h.framework/core`
54
+ - `@t4h.framework/cache`
55
+ - `@t4h.framework/fs`
56
+ - `@t4h.framework/http`
57
+ - `@t4h.framework/orm`
58
+ - `@t4h.framework/smtp`
59
+ - `@t4h.framework/runtime-claims`
60
+
61
+ ## CLI usage
62
+
63
+ Add a dev script to your project's `package.json`:
64
+
65
+ ```json
66
+ {
67
+ "scripts": {
68
+ "dev": "framework dev"
69
+ }
70
+ }
71
+ ```
72
+
73
+ Then run:
74
+
75
+ ```bash
76
+ yarn dev
77
+ ```
78
+
79
+ ### Options
80
+
81
+ | Flag | Description | Default |
82
+ |------|-------------|---------|
83
+ | `--entrypoint <path>` | Path to the project's `package.json` | `./package.json` |
84
+ | `-e, --env <KEY=VALUE>` | Environment variable (repeatable) | — |
85
+ | `--env-file-if-exists <path>` | Load variables from a `.env` file if it exists | — |
86
+
87
+ Example with env vars:
88
+
89
+ ```bash
90
+ framework dev --entrypoint ./package.json -e API_KEY=secret -e DB_HOST=localhost
91
+ ```
92
+
93
+ ## Programmatic usage
94
+
95
+ You can embed `DevServer` in your own tooling instead of using the interactive CLI:
96
+
97
+ ```typescript
98
+ import { DevServer } from '@t4h.framework/dev'
99
+
100
+ const devServer = new DevServer(
101
+ {
102
+ entrypoint: './package.json',
103
+ env: { API_KEY: 'secret' },
104
+ },
105
+ manifest => {
106
+ console.log('App loaded:', manifest.workflows.map(w => w.id))
107
+ },
108
+ )
109
+
110
+ await devServer.start()
111
+
112
+ const result = await devServer.runWorkflow('my-workflow/v1', {
113
+ userId: '123',
114
+ amount: 100,
115
+ })
116
+
117
+ await devServer.setEnv('API_KEY', 'new-value')
118
+ const env = await devServer.listEnv()
119
+
120
+ const pending = await devServer.listWaitingAsyncActivities()
121
+ await devServer.advanceAsyncActivity(pending[0].id, { approved: true })
122
+ ```
123
+
124
+ ### DevServer API
125
+
126
+ | Method | Description |
127
+ |--------|-------------|
128
+ | `start()` | Resolves project paths, starts TypeScript watch, and boots the app process on first successful build. |
129
+ | `runWorkflow(id, input)` | Runs a workflow by id with the given input. |
130
+ | `setEnv(name, value)` | Sets an environment variable in the running app process. |
131
+ | `listEnv()` | Returns all environment variables. |
132
+ | `listWaitingAsyncActivities()` | Lists async activities waiting for manual advancement. |
133
+ | `advanceAsyncActivity(id, payload)` | Advances a pending async activity with the given payload. |
134
+
135
+ ## Dev claims
136
+
137
+ In production, claims are fulfilled by the runtime (database connections, real HTTP clients, etc.). During local development, `@t4h.framework/dev` registers in-memory substitutes:
138
+
139
+ | Claim | Dev implementation |
140
+ |-------|-------------------|
141
+ | `ORMClaim` | In-memory database |
142
+ | `HttpClientRequestClaim` | Real HTTP via `undici` |
143
+ | `FileSystemClaim` | Local file system with dev binary codec |
144
+ | `SmtpSendEmailClaim` | Captures emails in memory (no delivery) |
145
+ | `CacheClaim` | In-memory cache |
146
+ | `WorkflowClaim` | Runs workflows through the local workflow engine |
147
+
148
+ Import the full claim registry:
149
+
150
+ ```typescript
151
+ import { claims } from '@t4h.framework/dev'
152
+ ```
153
+
154
+ Or import individual claim classes:
155
+
156
+ ```typescript
157
+ import {
158
+ DevORMClaim,
159
+ DevHttpClientRequestClaim,
160
+ DevFileSystemClaim,
161
+ findClaimByConstructor,
162
+ } from '@t4h.framework/dev'
163
+ ```
164
+
165
+ ## Requirements
166
+
167
+ - Node.js >= 22
168
+ - A T4H Framework `App` exported from your project's entry point (`default` or named `app` export)
169
+
170
+ ## License
171
+
172
+ MIT
@@ -0,0 +1,24 @@
1
+ import type { App } from '@t4h.framework/core';
2
+ export interface DevServerConfig {
3
+ entrypoint: string;
4
+ env: Record<string, string>;
5
+ }
6
+ export declare class DevServer {
7
+ private readonly config;
8
+ private readonly onAppManifest;
9
+ private tsBuildWatcher;
10
+ private packageJsonPath;
11
+ private tsConfigPath;
12
+ private outDir;
13
+ private app;
14
+ private jsonRpcServer;
15
+ private jsonRpcClient;
16
+ constructor(config: DevServerConfig, onAppManifest: (manifest: ReturnType<App['toManifest']>) => void);
17
+ start(): Promise<void>;
18
+ protected onTsBuildSuccess(): Promise<void>;
19
+ runWorkflow(workflowId: string, input: any): Promise<any>;
20
+ setEnv(name: string, value: string): Promise<any>;
21
+ listEnv(): Promise<any>;
22
+ listWaitingAsyncActivities(): Promise<any>;
23
+ advanceAsyncActivity(id: string, payload: unknown): Promise<any>;
24
+ }
@@ -0,0 +1,87 @@
1
+ import { ChildProcess, fork } from 'node:child_process';
2
+ import path from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ import Type from 'typebox';
5
+ import { JSONRPCClient } from './models/JSONRPCClient.js';
6
+ import { JSONRPCServer, JSONRPCServerMethod } from './models/JSONRPCServer.js';
7
+ import { mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath } from './tools/mkdir-out-dir-project-from-ts-config-path-and-json-package-path.js';
8
+ import { resolvePackageJsonPath } from './tools/resolve-package-json-path.js';
9
+ import { resolveTsconfigFromPackageJsonPath } from './tools/resolve-tsconfig-path-from-package-json-path.js';
10
+ import { tsBuildWatch } from './tools/ts-build-watch.js';
11
+ export class DevServer {
12
+ config;
13
+ onAppManifest;
14
+ tsBuildWatcher;
15
+ packageJsonPath;
16
+ tsConfigPath;
17
+ outDir;
18
+ app;
19
+ jsonRpcServer;
20
+ jsonRpcClient;
21
+ constructor(config, onAppManifest) {
22
+ this.config = config;
23
+ this.onAppManifest = onAppManifest;
24
+ this.jsonRpcServer = new JSONRPCServer([
25
+ new JSONRPCServerMethod('manifest', { schema: [Type.Any()] }, manifest => this.onAppManifest(manifest)),
26
+ ], message => {
27
+ this.app?.send(message);
28
+ });
29
+ this.jsonRpcClient = new JSONRPCClient(message => {
30
+ this.app?.send(message);
31
+ });
32
+ }
33
+ async start() {
34
+ this.packageJsonPath = await resolvePackageJsonPath(this.config.entrypoint);
35
+ this.tsConfigPath = await resolveTsconfigFromPackageJsonPath(this.packageJsonPath);
36
+ this.outDir = await mkdirOutDirProjectFromTsConfigPathAndJsonPackagePath(this.tsConfigPath, this.packageJsonPath);
37
+ this.tsBuildWatcher = tsBuildWatch(this.tsConfigPath, {
38
+ outDir: path.join(this.outDir, 'dist'),
39
+ sourceMap: true,
40
+ declaration: false,
41
+ declarationMap: false,
42
+ }, {
43
+ onSuccess: () => this.onTsBuildSuccess(),
44
+ onFail(diagnostics) {
45
+ console.error('[DevServer] ts build failed:', diagnostics);
46
+ },
47
+ onStatus(status) {
48
+ console.log('[DevServer] ts build status:', status);
49
+ },
50
+ });
51
+ }
52
+ async onTsBuildSuccess() {
53
+ if (this.app) {
54
+ this.app.kill();
55
+ }
56
+ const { default: packageJson } = await import(this.packageJsonPath, {
57
+ with: { type: 'json' },
58
+ });
59
+ if (typeof packageJson.main !== 'string')
60
+ throw new Error('Main is not a string');
61
+ const entrypoint = pathToFileURL(path.join(this.outDir, 'dist', packageJson.main)).href;
62
+ this.app = fork(path.join(import.meta.dirname, 'workers', 'app-process.js'), [
63
+ entrypoint,
64
+ ...Object.entries(this.config.env).map(([name, value]) => `${name}=${value}`),
65
+ ], { stdio: ['ignore', 'inherit', 'inherit', 'ipc'] });
66
+ this.app.on('message', message => Promise.all([
67
+ this.jsonRpcServer.handle(message),
68
+ this.jsonRpcClient.handle(message),
69
+ ]));
70
+ }
71
+ async runWorkflow(workflowId, input) {
72
+ return await this.jsonRpcClient.call('workflow.run', workflowId, input);
73
+ }
74
+ async setEnv(name, value) {
75
+ return await this.jsonRpcClient.call('env.set', name, value);
76
+ }
77
+ async listEnv() {
78
+ return await this.jsonRpcClient.call('env.list');
79
+ }
80
+ async listWaitingAsyncActivities() {
81
+ return await this.jsonRpcClient.call('workflow.async-activities.waiting.list');
82
+ }
83
+ async advanceAsyncActivity(id, payload) {
84
+ return await this.jsonRpcClient.call('workflow.async-activities.advance', id, payload);
85
+ }
86
+ }
87
+ //# sourceMappingURL=DevServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevServer.js","sourceRoot":"","sources":["../src/DevServer.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,57 @@
1
+ import { AsyncActivity, SyncActivity } from '@t4h.framework/core';
2
+ import Type from 'typebox';
3
+ export declare class TestSyncActivity extends SyncActivity<[
4
+ ], {
5
+ value: string;
6
+ }, {
7
+ result: string;
8
+ }, {
9
+ result: string;
10
+ }> {
11
+ toInput(): {
12
+ value: string;
13
+ };
14
+ run(input: {
15
+ value: string;
16
+ }): {
17
+ result: string;
18
+ };
19
+ toOutput(output: {
20
+ result: string;
21
+ }): {
22
+ result: string;
23
+ };
24
+ }
25
+ declare const TestAsyncSchema: Type.TObject<{
26
+ approved: Type.TBoolean;
27
+ }>;
28
+ export declare class TestAsyncActivity extends AsyncActivity<[
29
+ ], {
30
+ value: string;
31
+ }, {
32
+ approved: boolean;
33
+ }, {
34
+ approved: boolean;
35
+ }, {
36
+ requestId: string;
37
+ }, typeof TestAsyncSchema> {
38
+ toInput(): {
39
+ value: string;
40
+ };
41
+ bootstrap(): import("@t4h.framework/core").AsyncActivityResultPending<{
42
+ requestId: string;
43
+ }, Type.TObject<{
44
+ approved: Type.TBoolean;
45
+ }>>;
46
+ advance(payload: {
47
+ approved: boolean;
48
+ }): import("@t4h.framework/core").AsyncActivityResultFulfilled<{
49
+ approved: boolean;
50
+ } | undefined>;
51
+ toOutput(output: {
52
+ approved: boolean;
53
+ }): {
54
+ approved: boolean;
55
+ };
56
+ }
57
+ export {};