simplemdg-dev-cli 1.4.1 → 2.0.4
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 +113 -0
- package/USER_GUIDE.md +129 -0
- package/dist/commands/cf.command.js +1321 -0
- package/dist/commands/cf.command.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -281,3 +281,116 @@ Do not commit real secrets to Git.
|
|
|
281
281
|
Files like `.npmrc`, `default-env.json`, and cached passwords may contain sensitive data.
|
|
282
282
|
|
|
283
283
|
Use saved password only on your own machine.
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## Request Trace
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
smdg cf request-trace
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Watch incoming HTTP requests on deployed BTP Node.js/CAP apps without editing backend source code.
|
|
293
|
+
|
|
294
|
+
The CLI guides you to select one or more apps, choose trace depth, prepare Node Inspector, inject a temporary runtime trace, and stream request logs.
|
|
295
|
+
|
|
296
|
+
It can show method, path, headers, request body, response body, status, and duration. Authorization tokens are masked by default and should only be shown fully in dev/test environments.
|
|
297
|
+
|
|
298
|
+
Alias:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
smdg cf traffic
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Notes:
|
|
305
|
+
|
|
306
|
+
- This works best for Node.js/CAP apps.
|
|
307
|
+
- It uses CF SSH tunnel and Node Inspector.
|
|
308
|
+
- It does not change repository source code.
|
|
309
|
+
- The trace disappears after app restart.
|
|
310
|
+
- Avoid full token/body tracing in production.
|
|
311
|
+
|
|
312
|
+
## New in 2.0.2: HTTP Watch
|
|
313
|
+
|
|
314
|
+
`request-trace` deep runtime injection is experimental and may not catch every CAP runtime request body. Version 2.0.2 adds a stable log-based watcher:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
smdg cf http-watch
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
It reads existing CF/CDS/RTR logs and prints a clean realtime HTTP view: method, path, status, user, tenant, instance, request size, and request id. It does not restart apps and does not change source code.
|
|
321
|
+
|
|
322
|
+
Use this first for reliable microservice tracking. For deeper diagnostics:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
smdg cf request-trace-doctor
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
`request-trace` now asks which engine to use: stable HTTP watch, experimental deep inspector trace, or doctor.
|
|
329
|
+
|
|
330
|
+
## Network body capture
|
|
331
|
+
|
|
332
|
+
Use this when `smdg cf http-watch` can show POST/PATCH requests but not the request body.
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
smdg cf request-trace
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Choose **Deep Node Inspector trace**. The CLI injects a temporary Node runtime hook through the Node Inspector. It does not modify repository source code. It attempts to capture request headers, body, response status, and response body depending on the selected mode.
|
|
339
|
+
|
|
340
|
+
Recommended test flow:
|
|
341
|
+
|
|
342
|
+
1. Run `smdg cf request-trace`.
|
|
343
|
+
2. Select the target app.
|
|
344
|
+
3. Select **Deep Node Inspector trace**.
|
|
345
|
+
4. Select **Headers + body**.
|
|
346
|
+
5. Select **Mask token** first.
|
|
347
|
+
6. If the inspector is not reachable, choose the prepare mode that sets `NODE_OPTIONS` and restarts the app.
|
|
348
|
+
7. Send a new request after the CLI prints that the trace is installed.
|
|
349
|
+
|
|
350
|
+
Important: full body/token capture is a dev/test feature only. Do not enable full token output in production.
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
# Request Trace Runtime Tools
|
|
354
|
+
|
|
355
|
+
Use this command when you need to inspect real request headers and bodies from a BTP Node.js/CAP app without changing repository source code:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
smdg cf request-trace
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Alias:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
smdg cf network-trace
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
The CLI will ask for:
|
|
368
|
+
|
|
369
|
+
* target app or apps
|
|
370
|
+
* trace depth: path, headers, body, or response body
|
|
371
|
+
* Authorization handling: masked, full, or omitted
|
|
372
|
+
* displayed headers: minimal, common, all, or custom
|
|
373
|
+
* whether to parse body as JSON/form data
|
|
374
|
+
* whether to export trace events to a JSONL file
|
|
375
|
+
|
|
376
|
+
While the trace is running, you can type commands directly in the same terminal:
|
|
377
|
+
|
|
378
|
+
```txt
|
|
379
|
+
/method POST
|
|
380
|
+
/path getBusinessRequest
|
|
381
|
+
/body CR0000135951
|
|
382
|
+
/status 500
|
|
383
|
+
/text single.npi
|
|
384
|
+
/headers authorization,content-type,x-correlationid,x-vcap-request-id
|
|
385
|
+
/headers all
|
|
386
|
+
/clear
|
|
387
|
+
/show
|
|
388
|
+
/replay
|
|
389
|
+
/pause
|
|
390
|
+
/resume
|
|
391
|
+
/help
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Exported files use JSONL format: one request event per line. This makes it easier to search later with editor tools or scripts.
|
|
395
|
+
|
|
396
|
+
Security note: full Authorization token output should only be used in dev/test and on a trusted machine. The recommended mode is masked token.
|
package/USER_GUIDE.md
CHANGED
|
@@ -281,3 +281,132 @@ Do not commit real secrets to Git.
|
|
|
281
281
|
Files like `.npmrc`, `default-env.json`, and cached passwords may contain sensitive data.
|
|
282
282
|
|
|
283
283
|
Use saved password only on your own machine.
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## Request Trace
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
smdg cf request-trace
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Watch incoming HTTP requests on deployed BTP Node.js/CAP apps without editing backend source code.
|
|
293
|
+
|
|
294
|
+
The CLI guides you to select one or more apps, choose trace depth, prepare Node Inspector, inject a temporary runtime trace, and stream request logs.
|
|
295
|
+
|
|
296
|
+
It can show method, path, headers, request body, response body, status, and duration. Authorization tokens are masked by default and should only be shown fully in dev/test environments.
|
|
297
|
+
|
|
298
|
+
Alias:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
smdg cf traffic
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Notes:
|
|
305
|
+
|
|
306
|
+
- This works best for Node.js/CAP apps.
|
|
307
|
+
- It uses CF SSH tunnel and Node Inspector.
|
|
308
|
+
- It does not change repository source code.
|
|
309
|
+
- The trace disappears after app restart.
|
|
310
|
+
- Avoid full token/body tracing in production.
|
|
311
|
+
|
|
312
|
+
# HTTP Watch
|
|
313
|
+
|
|
314
|
+
Use this when you want to see what is calling your BTP app without adding backend logs.
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
smdg cf http-watch
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
The CLI shows a clean realtime list from existing Cloud Foundry/CDS/router logs.
|
|
321
|
+
|
|
322
|
+
It can show:
|
|
323
|
+
|
|
324
|
+
* HTTP method
|
|
325
|
+
* URL/path
|
|
326
|
+
* status code
|
|
327
|
+
* duration
|
|
328
|
+
* app instance
|
|
329
|
+
* remote user
|
|
330
|
+
* tenant
|
|
331
|
+
* request size
|
|
332
|
+
* request id / correlation id
|
|
333
|
+
|
|
334
|
+
It cannot show full body or full Authorization token because CF/CDS logs do not contain them. Use `smdg cf request-trace` only when you need experimental deep runtime inspection.
|
|
335
|
+
|
|
336
|
+
# Request Trace Doctor
|
|
337
|
+
|
|
338
|
+
Use this before trying deep body capture:
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
smdg cf request-trace-doctor
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
It checks recent router/app traffic and the remote Node process list so you can confirm whether the app is receiving requests and whether deep inspection is possible.
|
|
345
|
+
|
|
346
|
+
# Network Trace
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
smdg cf request-trace
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
This command can capture request data from inside a running Node.js/CAP app.
|
|
353
|
+
|
|
354
|
+
Use it when you need more than `smdg cf http-watch`, especially request body for POST/PATCH APIs.
|
|
355
|
+
|
|
356
|
+
Recommended mode:
|
|
357
|
+
|
|
358
|
+
```txt
|
|
359
|
+
Deep Node Inspector trace
|
|
360
|
+
Headers + body
|
|
361
|
+
Mask token
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
The trace is temporary and disappears after the app restarts. It does not change source code.
|
|
365
|
+
|
|
366
|
+
If the CLI cannot reach the Node inspector, run the command again and choose the prepare option that sets `NODE_OPTIONS` and restarts the app.
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
# Request Trace Runtime Tools
|
|
370
|
+
|
|
371
|
+
Use this command when you need to inspect real request headers and bodies from a BTP Node.js/CAP app without changing repository source code:
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
smdg cf request-trace
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Alias:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
smdg cf network-trace
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
The CLI will ask for:
|
|
384
|
+
|
|
385
|
+
* target app or apps
|
|
386
|
+
* trace depth: path, headers, body, or response body
|
|
387
|
+
* Authorization handling: masked, full, or omitted
|
|
388
|
+
* displayed headers: minimal, common, all, or custom
|
|
389
|
+
* whether to parse body as JSON/form data
|
|
390
|
+
* whether to export trace events to a JSONL file
|
|
391
|
+
|
|
392
|
+
While the trace is running, you can type commands directly in the same terminal:
|
|
393
|
+
|
|
394
|
+
```txt
|
|
395
|
+
/method POST
|
|
396
|
+
/path getBusinessRequest
|
|
397
|
+
/body CR0000135951
|
|
398
|
+
/status 500
|
|
399
|
+
/text single.npi
|
|
400
|
+
/headers authorization,content-type,x-correlationid,x-vcap-request-id
|
|
401
|
+
/headers all
|
|
402
|
+
/clear
|
|
403
|
+
/show
|
|
404
|
+
/replay
|
|
405
|
+
/pause
|
|
406
|
+
/resume
|
|
407
|
+
/help
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Exported files use JSONL format: one request event per line. This makes it easier to search later with editor tools or scripts.
|
|
411
|
+
|
|
412
|
+
Security note: full Authorization token output should only be used in dev/test and on a trusted machine. The recommended mode is masked token.
|