@saptools/cf-inspector 0.3.7 → 0.3.8
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 +4 -2
- package/dist/cli.js +7 -15
- package/dist/cli.js.map +1 -1
- package/dist/index.js +7 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Built so an AI agent (or a CI job) can drive a debugger from a single shell comm
|
|
|
22
22
|
- ✅ **Conditional breakpoints** — `--condition 'req.userId === "abc"'` only pauses when the predicate is truthy
|
|
23
23
|
- 🎭 **Multi-breakpoint** — repeat `--bp` to race several locations; first hit wins
|
|
24
24
|
- 📡 **Non-pausing logpoints** — `cf-inspector log --at file:line --expr 'JSON.stringify({…})'` streams JSON Lines as the line executes, **without ever pausing the inspectee** (safe for production traffic)
|
|
25
|
-
- 🧠 **Agent-friendly** — JSON-by-default I/O, deterministic shape,
|
|
25
|
+
- 🧠 **Agent-friendly** — JSON-by-default I/O, deterministic shape, bounded value previews for large debugger payloads
|
|
26
26
|
- 🧭 **Path mapping** — local `src/handler.ts:42` is matched against the remote URL via a `urlRegex`, with optional `--remote-root` literal or regex (same DSL as `cds-debug`)
|
|
27
27
|
- 🔁 **Composes with `cf-debugger`** — pass `--app/--region/--org/--space` and the tunnel is opened automatically; pass `--port` to attach to anything CDP-speaking
|
|
28
28
|
- 🪶 **Tiny dependency footprint** — `commander` + `ws` only, no heavy CDP framework
|
|
@@ -120,7 +120,9 @@ cf-inspector snapshot --port 9229 \
|
|
|
120
120
|
JSON output includes frame metadata and `captures` by default. `topFrame.scopes`
|
|
121
121
|
is only present with `--include-scopes`, because Cloud Foundry Node apps often
|
|
122
122
|
carry large local/closure/module objects that drown out targeted captures. The
|
|
123
|
-
output
|
|
123
|
+
output contains raw debugger values; use it only against trusted targets and be
|
|
124
|
+
careful when sharing logs. The output also includes `pausedDurationMs`, the
|
|
125
|
+
client-observed time from receiving
|
|
124
126
|
the matching pause event until `Debugger.resume` completes. It does not include
|
|
125
127
|
the time spent waiting for the breakpoint to hit. When `--keep-paused` is used,
|
|
126
128
|
`pausedDurationMs` is `null` because `cf-inspector` intentionally skips
|
package/dist/cli.js
CHANGED
|
@@ -1072,7 +1072,6 @@ var MAX_SCOPE_VARIABLES = 20;
|
|
|
1072
1072
|
var MAX_CHILD_VARIABLES = 8;
|
|
1073
1073
|
var MAX_VARIABLE_DEPTH = 2;
|
|
1074
1074
|
var MAX_VALUE_LENGTH = 240;
|
|
1075
|
-
var SENSITIVE_NAME_REGEX = /(pass(?:word)?|credentials?|creds?|token|secret|api[_-]?key|authorization|cookie|session|private[_-]?key)/i;
|
|
1076
1075
|
var PRIORITY_BY_TYPE = {
|
|
1077
1076
|
local: 0,
|
|
1078
1077
|
arguments: 1,
|
|
@@ -1133,13 +1132,7 @@ function formatPrimitive(value) {
|
|
|
1133
1132
|
}
|
|
1134
1133
|
return String(value);
|
|
1135
1134
|
}
|
|
1136
|
-
function
|
|
1137
|
-
return SENSITIVE_NAME_REGEX.test(name);
|
|
1138
|
-
}
|
|
1139
|
-
function sanitizeValue(name, raw) {
|
|
1140
|
-
if (isSensitiveName(name)) {
|
|
1141
|
-
return "[REDACTED]";
|
|
1142
|
-
}
|
|
1135
|
+
function limitValueLength(raw) {
|
|
1143
1136
|
if (raw.length <= MAX_VALUE_LENGTH) {
|
|
1144
1137
|
return raw;
|
|
1145
1138
|
}
|
|
@@ -1155,9 +1148,8 @@ async function captureProperties(session, objectId, limit, depth) {
|
|
|
1155
1148
|
limited.map(async (prop) => {
|
|
1156
1149
|
const name = typeof prop.name === "string" ? prop.name : "?";
|
|
1157
1150
|
const described = describeProperty(prop);
|
|
1158
|
-
const sensitive = isSensitiveName(name);
|
|
1159
1151
|
let children;
|
|
1160
|
-
if (
|
|
1152
|
+
if (depth > 0 && described.objectId !== void 0 && isExpandable(described.type)) {
|
|
1161
1153
|
try {
|
|
1162
1154
|
const nested = await captureProperties(
|
|
1163
1155
|
session,
|
|
@@ -1171,7 +1163,7 @@ async function captureProperties(session, objectId, limit, depth) {
|
|
|
1171
1163
|
} catch {
|
|
1172
1164
|
}
|
|
1173
1165
|
}
|
|
1174
|
-
const sanitizedValue =
|
|
1166
|
+
const sanitizedValue = limitValueLength(described.value);
|
|
1175
1167
|
const base = { name, value: sanitizedValue };
|
|
1176
1168
|
const withType = described.type === void 0 ? base : { ...base, type: described.type };
|
|
1177
1169
|
return children === void 0 ? withType : { ...withType, children };
|
|
@@ -1206,7 +1198,7 @@ async function captureScopes(session, frame) {
|
|
|
1206
1198
|
function evalResultToCaptured(expression, result) {
|
|
1207
1199
|
if (result.exceptionDetails !== void 0) {
|
|
1208
1200
|
const text = typeof result.exceptionDetails.exception?.description === "string" ? result.exceptionDetails.exception.description : typeof result.exceptionDetails.text === "string" ? result.exceptionDetails.text : "evaluation failed";
|
|
1209
|
-
return { expression, error:
|
|
1201
|
+
return { expression, error: limitValueLength(text) };
|
|
1210
1202
|
}
|
|
1211
1203
|
const inner = result.result;
|
|
1212
1204
|
if (!inner) {
|
|
@@ -1214,7 +1206,7 @@ function evalResultToCaptured(expression, result) {
|
|
|
1214
1206
|
}
|
|
1215
1207
|
const type = typeof inner.type === "string" ? inner.type : void 0;
|
|
1216
1208
|
const buildCaptured = (rendered) => {
|
|
1217
|
-
const sanitized =
|
|
1209
|
+
const sanitized = limitValueLength(rendered);
|
|
1218
1210
|
const base = { expression, value: sanitized };
|
|
1219
1211
|
return type === void 0 ? base : { ...base, type };
|
|
1220
1212
|
};
|
|
@@ -1346,7 +1338,7 @@ async function withSerializedObjectCapture(session, expression, evalResult, capt
|
|
|
1346
1338
|
if (normalized === void 0) {
|
|
1347
1339
|
return captured;
|
|
1348
1340
|
}
|
|
1349
|
-
const value =
|
|
1341
|
+
const value = limitValueLength(normalized);
|
|
1350
1342
|
return captured.type === void 0 ? { expression, value } : { expression, value, type: captured.type };
|
|
1351
1343
|
}
|
|
1352
1344
|
async function captureSnapshot(session, pause, options = {}) {
|
|
@@ -1373,7 +1365,7 @@ async function captureSnapshot(session, pause, options = {}) {
|
|
|
1373
1365
|
return await withSerializedObjectCapture(session, expression, result, captured);
|
|
1374
1366
|
} catch (err) {
|
|
1375
1367
|
const message = err instanceof Error ? err.message : String(err);
|
|
1376
|
-
return { expression, error: message };
|
|
1368
|
+
return { expression, error: limitValueLength(message) };
|
|
1377
1369
|
}
|
|
1378
1370
|
})
|
|
1379
1371
|
);
|