@bluelibs/runner-dev 4.4.1 → 4.4.3
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 +28 -120
- package/dist/ui/.vite/manifest.json +1 -1
- package/dist/ui/assets/{docs-Bn3gY3gX.js → docs-BaaEkHLq.js} +51 -51
- package/dist/ui/assets/{docs-Bn3gY3gX.js.map → docs-BaaEkHLq.js.map} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,9 +31,12 @@ const app = resource({
|
|
|
31
31
|
|
|
32
32
|
## What you get
|
|
33
33
|
|
|
34
|
+
- Fully-featured UI with AI assistance to explore your app, call tasks, emit events, diagnostics, logs and more.
|
|
34
35
|
- Introspector: programmatic API to inspect tasks, hooks, resources, events, middleware, and diagnostics (including file paths, contents)
|
|
35
36
|
- Live: in-memory logs and event emissions
|
|
37
|
+
- Live File Previews and Saving.
|
|
36
38
|
- GraphQL server: deep graph navigation over your app’s topology and live data
|
|
39
|
+
- CLI with scaffolding, query-ing capabilities on a live endpoint or via dry-run mode.
|
|
37
40
|
- MCP server: allow your AI to do introspection for you.
|
|
38
41
|
|
|
39
42
|
## Quickstart
|
|
@@ -57,7 +60,7 @@ export const app = resource({
|
|
|
57
60
|
});
|
|
58
61
|
```
|
|
59
62
|
|
|
60
|
-
Add it as an
|
|
63
|
+
Add it as an Model Context Protocol Server (for AIs) via normal socket:
|
|
61
64
|
|
|
62
65
|
```json
|
|
63
66
|
{
|
|
@@ -65,7 +68,7 @@ Add it as an MCP Server:
|
|
|
65
68
|
"mcp-graphql": {
|
|
66
69
|
"description": "MCP Server for Active Running Context App",
|
|
67
70
|
"command": "npx",
|
|
68
|
-
"args": ["runner-dev", "mcp"],
|
|
71
|
+
"args": ["@bluelibs/runner-dev", "mcp"],
|
|
69
72
|
"env": {
|
|
70
73
|
"ENDPOINT": "http://localhost:1337/graphql",
|
|
71
74
|
"ALLOW_MUTATIONS": "true"
|
|
@@ -113,30 +116,17 @@ Prerequisites:
|
|
|
113
116
|
Help:
|
|
114
117
|
|
|
115
118
|
```bash
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Run CLI from TypeScript (no build):
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Using ts-node ESM loader
|
|
123
|
-
node --loader ts-node/esm src/cli.ts query 'query { tasks { id } }' --entry-file ./src/main.ts
|
|
124
|
-
|
|
125
|
-
# Or with tsx (recommended DX)
|
|
126
|
-
npx tsx src/cli.ts query 'query { tasks { id } }' --entry-file ./src/main.ts
|
|
127
|
-
|
|
128
|
-
# Or classic ts-node when configured
|
|
129
|
-
npx ts-node src/cli.ts query 'query { tasks { id } }' --entry-file ./src/main.ts
|
|
119
|
+
runner-dev --help
|
|
130
120
|
```
|
|
131
121
|
|
|
132
122
|
Create new project:
|
|
133
123
|
|
|
134
124
|
```bash
|
|
135
125
|
# Create a new Runner project
|
|
136
|
-
|
|
126
|
+
runner-dev new <project-name>
|
|
137
127
|
|
|
138
128
|
# Example
|
|
139
|
-
|
|
129
|
+
runner-dev new my-awesome-app
|
|
140
130
|
```
|
|
141
131
|
|
|
142
132
|
This command creates a new Runner project with:
|
|
@@ -157,25 +147,25 @@ Examples:
|
|
|
157
147
|
|
|
158
148
|
```bash
|
|
159
149
|
# Create and auto-install dependencies, then run tests
|
|
160
|
-
|
|
150
|
+
new my-awesome-app --install --run-tests
|
|
161
151
|
|
|
162
152
|
# Create and start the dev server immediately (blocks)
|
|
163
|
-
|
|
153
|
+
new my-awesome-app --install --run
|
|
164
154
|
```
|
|
165
155
|
|
|
166
156
|
Scaffold artifacts (resource | task | event | tag | taskMiddleware | resourceMiddleware):
|
|
167
157
|
|
|
168
158
|
```bash
|
|
169
159
|
# General form
|
|
170
|
-
|
|
160
|
+
runner-dev new <kind> <name> [--ns app] [--dir src] [--export] [--dry]
|
|
171
161
|
|
|
172
162
|
# Examples
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
163
|
+
runner-dev new resource user-service --ns app --dir src --export
|
|
164
|
+
runner-dev new task create-user --ns app.users --dir src --export
|
|
165
|
+
runner-dev new event user-registered --ns app.users --dir src --export
|
|
166
|
+
runner-dev new tag http --ns app.web --dir src --export
|
|
167
|
+
runner-dev new task-middleware auth --ns app --dir src --export
|
|
168
|
+
runner-dev new resource-middleware soft-delete --ns app --dir src --export
|
|
179
169
|
```
|
|
180
170
|
|
|
181
171
|
Flags for artifact scaffolding:
|
|
@@ -188,7 +178,7 @@ Flags for artifact scaffolding:
|
|
|
188
178
|
|
|
189
179
|
Conventions:
|
|
190
180
|
|
|
191
|
-
- Generated ids follow: `<namespace>.(resources|tasks|events|tags|middleware).<kebab-name>`
|
|
181
|
+
- Generated ids follow: `<namespace>.(resources|tasks|events|tags|task-middleware|resource-middleware).<kebab-name>`
|
|
192
182
|
- Folders:
|
|
193
183
|
- resources: `src/resources`
|
|
194
184
|
- tasks: `src/tasks`
|
|
@@ -213,38 +203,38 @@ After creation, follow the next steps:
|
|
|
213
203
|
Ping endpoint:
|
|
214
204
|
|
|
215
205
|
```bash
|
|
216
|
-
ENDPOINT=http://localhost:1337/graphql
|
|
206
|
+
ENDPOINT=http://localhost:1337/graphql runner-dev ping
|
|
217
207
|
```
|
|
218
208
|
|
|
219
209
|
Run a query (two modes):
|
|
220
210
|
|
|
221
211
|
```bash
|
|
222
212
|
# Remote mode (HTTP endpoint)
|
|
223
|
-
ENDPOINT=http://localhost:1337/graphql
|
|
213
|
+
ENDPOINT=http://localhost:1337/graphql runner-dev query 'query { tasks { id } }'
|
|
224
214
|
|
|
225
215
|
# With variables and pretty output
|
|
226
216
|
ENDPOINT=http://localhost:1337/graphql \
|
|
227
|
-
|
|
217
|
+
runner-dev query \
|
|
228
218
|
'query Q($ns: ID){ tasks(idIncludes: $ns) { id } }' \
|
|
229
219
|
--variables '{"ns":"task."}' \
|
|
230
220
|
--format pretty
|
|
231
221
|
|
|
232
222
|
# Add a namespace sugar to inject idIncludes/filter automatically
|
|
233
|
-
ENDPOINT=http://localhost:1337/graphql
|
|
223
|
+
ENDPOINT=http://localhost:1337/graphql runner-dev query 'query { tasks { id } }' --namespace task.
|
|
234
224
|
|
|
235
225
|
# Dry‑run mode (no server) — uses a TS entry file
|
|
236
|
-
|
|
226
|
+
runner-dev query 'query { tasks { id } }' --entry-file ./src/main.ts
|
|
237
227
|
```
|
|
238
228
|
|
|
239
229
|
Dry‑run (no server) details:
|
|
240
230
|
|
|
241
231
|
```bash
|
|
242
232
|
# Using a TS entry file default export
|
|
243
|
-
|
|
233
|
+
runner-dev query 'query { tasks { id } }' \
|
|
244
234
|
--entry-file ./src/main.ts
|
|
245
235
|
|
|
246
236
|
# Using a named export (e.g., exported as `app`)
|
|
247
|
-
|
|
237
|
+
runner-dev query 'query { tasks { id } }' \
|
|
248
238
|
--entry-file ./src/main.ts --export app
|
|
249
239
|
|
|
250
240
|
# Notes
|
|
@@ -260,17 +250,17 @@ npx @bluelibs/runner-dev query 'query { tasks { id } }' \
|
|
|
260
250
|
Project overview (Markdown):
|
|
261
251
|
|
|
262
252
|
```bash
|
|
263
|
-
ENDPOINT=http://localhost:1337/graphql
|
|
253
|
+
ENDPOINT=http://localhost:1337/graphql runner-dev overview --details 10 --include-live
|
|
264
254
|
```
|
|
265
255
|
|
|
266
256
|
Schema tools:
|
|
267
257
|
|
|
268
258
|
```bash
|
|
269
259
|
# SDL string
|
|
270
|
-
ENDPOINT=http://localhost:1337/graphql
|
|
260
|
+
ENDPOINT=http://localhost:1337/graphql runner-dev schema sdl
|
|
271
261
|
|
|
272
262
|
# Introspection JSON
|
|
273
|
-
ENDPOINT=http://localhost:1337/graphql
|
|
263
|
+
ENDPOINT=http://localhost:1337/graphql runner-dev schema json
|
|
274
264
|
```
|
|
275
265
|
|
|
276
266
|
Environment variables used by all commands:
|
|
@@ -340,37 +330,6 @@ npm test -- src/__tests__/component/cli.query.remote.test.ts src/__tests__/compo
|
|
|
340
330
|
|
|
341
331
|
CI note: we prebuild before tests via `pretest` so the CLI binary `dist/cli.js` is available.
|
|
342
332
|
|
|
343
|
-
## Programmatic Introspection (without GraphQL)
|
|
344
|
-
|
|
345
|
-
```ts
|
|
346
|
-
import { resource } from "@bluelibs/runner";
|
|
347
|
-
import type { Introspector } from "@bluelibs/runner-dev/dist/resources/introspector.resource";
|
|
348
|
-
import { introspector } from "@bluelibs/runner-dev/dist/resources/introspector.resource";
|
|
349
|
-
|
|
350
|
-
export const probe = resource({
|
|
351
|
-
id: "probe",
|
|
352
|
-
dependencies: { introspector },
|
|
353
|
-
async init(_c, { introspector }: { introspector: Introspector }) {
|
|
354
|
-
const tasks = introspector.getTasks(); // Task[]
|
|
355
|
-
const hooks = introspector.getHooks(); // Hook[]
|
|
356
|
-
const resources = introspector.getResources(); // Resource[]
|
|
357
|
-
const events = introspector.getEvents(); // Event[]
|
|
358
|
-
const middlewares = introspector.getMiddlewares(); // Middleware[]
|
|
359
|
-
|
|
360
|
-
const deps = introspector.getDependencies(tasks[0]); // tasks/hooks/resources/emitters
|
|
361
|
-
|
|
362
|
-
// Diagnostics
|
|
363
|
-
const diagnostics = introspector.getDiagnostics();
|
|
364
|
-
// Or granular helpers
|
|
365
|
-
// introspector.getOrphanEvents();
|
|
366
|
-
// introspector.getUnemittedEvents();
|
|
367
|
-
// introspector.getUnusedMiddleware();
|
|
368
|
-
// introspector.getMissingFiles();
|
|
369
|
-
// introspector.getOverrideConflicts();
|
|
370
|
-
},
|
|
371
|
-
});
|
|
372
|
-
```
|
|
373
|
-
|
|
374
333
|
## GraphQL API Highlights
|
|
375
334
|
|
|
376
335
|
All arrays are non-null lists with non-null items, and ids are complemented by resolved fields for deep traversal.
|
|
@@ -1028,57 +987,6 @@ query RecentDebugLogs {
|
|
|
1028
987
|
}
|
|
1029
988
|
```
|
|
1030
989
|
|
|
1031
|
-
### Programmatic Usage
|
|
1032
|
-
|
|
1033
|
-
Use the swap manager directly in your code:
|
|
1034
|
-
|
|
1035
|
-
```ts
|
|
1036
|
-
import { resource } from "@bluelibs/runner";
|
|
1037
|
-
import type { SwapManager } from "@bluelibs/runner-dev/dist/resources/swap.resource";
|
|
1038
|
-
import { swapManager } from "@bluelibs/runner-dev/dist/resources/swap.resource";
|
|
1039
|
-
|
|
1040
|
-
export const debugger = resource({
|
|
1041
|
-
id: "my.debugger",
|
|
1042
|
-
dependencies: { swapManager },
|
|
1043
|
-
async init(_c, { swapManager }: { swapManager: SwapManager }) {
|
|
1044
|
-
// Swap a task programmatically
|
|
1045
|
-
const result = await swapManager.swap("user.create", `
|
|
1046
|
-
async function run(input, deps) {
|
|
1047
|
-
console.log("Debug: Enhanced user creation");
|
|
1048
|
-
return { id: "debug-user", ...input };
|
|
1049
|
-
}
|
|
1050
|
-
`);
|
|
1051
|
-
|
|
1052
|
-
if (result.success) {
|
|
1053
|
-
console.log(`Task ${result.taskId} swapped successfully`);
|
|
1054
|
-
} else {
|
|
1055
|
-
console.error(`Swap failed: ${result.error}`);
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
// Check what's currently swapped
|
|
1059
|
-
const swappedTasks = swapManager.getSwappedTasks();
|
|
1060
|
-
console.log(`Currently swapped: ${swappedTasks.map(t => t.taskId).join(', ')}`);
|
|
1061
|
-
|
|
1062
|
-
// Restore original function
|
|
1063
|
-
await swapManager.unswap("user.create");
|
|
1064
|
-
},
|
|
1065
|
-
});
|
|
1066
|
-
```
|
|
1067
|
-
|
|
1068
|
-
### Error Handling
|
|
1069
|
-
|
|
1070
|
-
The system provides comprehensive error handling:
|
|
1071
|
-
|
|
1072
|
-
```graphql
|
|
1073
|
-
mutation {
|
|
1074
|
-
swapTask(taskId: "nonexistent.task", runCode: "invalid javascript code {") {
|
|
1075
|
-
success # false
|
|
1076
|
-
error # "Task 'nonexistent.task' not found" or "Compilation failed: ..."
|
|
1077
|
-
taskId # "nonexistent.task"
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
```
|
|
1081
|
-
|
|
1082
990
|
### Safety and Best Practices
|
|
1083
991
|
|
|
1084
992
|
#### Type Safety
|