trickle-cli 0.1.218 → 0.1.219
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/dist/commands/hints.d.ts +1 -0
- package/dist/commands/hints.js +12 -4
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/src/commands/hints.ts +11 -4
- package/src/index.ts +2 -1
package/dist/commands/hints.d.ts
CHANGED
package/dist/commands/hints.js
CHANGED
|
@@ -277,8 +277,11 @@ async function hintsCommand(targetFile, opts) {
|
|
|
277
277
|
const typeStr = typeToString(v.type);
|
|
278
278
|
const scope = v.funcName ? ` (in ${v.funcName})` : "";
|
|
279
279
|
const sampleStr = formatSample(v.sample);
|
|
280
|
-
|
|
281
|
-
if (
|
|
280
|
+
const nbShowMode = opts.show || (opts.errors ? "both" : (opts.values ? "both" : "types"));
|
|
281
|
+
if (nbShowMode === "values" && v.sample !== undefined) {
|
|
282
|
+
console.log(`${v.varName} = ${sampleStr}${scope}`);
|
|
283
|
+
}
|
|
284
|
+
else if (nbShowMode === "both" && v.sample !== undefined) {
|
|
282
285
|
console.log(`${v.varName}: ${typeStr} = ${sampleStr}${scope}`);
|
|
283
286
|
}
|
|
284
287
|
else {
|
|
@@ -371,9 +374,14 @@ async function hintsCommand(targetFile, opts) {
|
|
|
371
374
|
if (isFuncParam && afterVar.startsWith(":"))
|
|
372
375
|
continue;
|
|
373
376
|
}
|
|
374
|
-
// Build the hint string
|
|
377
|
+
// Build the hint string based on --show mode
|
|
378
|
+
const showMode = opts.show || (opts.errors ? "both" : (opts.values ? "both" : "types"));
|
|
379
|
+
const hasSample = v.sample !== undefined && v.sample !== null;
|
|
375
380
|
let hint;
|
|
376
|
-
if (
|
|
381
|
+
if (showMode === "values" && hasSample) {
|
|
382
|
+
hint = ` = ${formatSample(v.sample)}`;
|
|
383
|
+
}
|
|
384
|
+
else if (showMode === "both" && hasSample) {
|
|
377
385
|
const sampleStr = formatSample(v.sample);
|
|
378
386
|
hint = sampleStr ? `: ${typeStr} = ${sampleStr}` : `: ${typeStr}`;
|
|
379
387
|
}
|
package/dist/index.js
CHANGED
|
@@ -540,6 +540,7 @@ program
|
|
|
540
540
|
.description("Output source code with inline type hints from runtime observations (for AI agents)")
|
|
541
541
|
.option("--values", "Include sample values alongside types")
|
|
542
542
|
.option("--errors", "Show error mode — variables at crash time with values that caused the error")
|
|
543
|
+
.option("--show <mode>", "What to show inline: types, values, or both (default: both in error mode, types otherwise)")
|
|
543
544
|
.action(async (file, opts) => {
|
|
544
545
|
await (0, hints_1.hintsCommand)(file, opts);
|
|
545
546
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trickle-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.219",
|
|
4
4
|
"description": "Zero-code runtime observability for JS/Python + AI agent debugging. Traces LangChain, CrewAI, OpenAI, Anthropic, Gemini. Eval, security, compliance, cost tracking. Free, local-first.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"observability",
|
package/src/commands/hints.ts
CHANGED
|
@@ -17,6 +17,7 @@ import * as path from "path";
|
|
|
17
17
|
export interface HintsOptions {
|
|
18
18
|
values?: boolean;
|
|
19
19
|
errors?: boolean;
|
|
20
|
+
show?: string; // "types", "values", "both" (default: "both" in error mode, "types" otherwise)
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
interface TypeNode {
|
|
@@ -268,8 +269,10 @@ export async function hintsCommand(
|
|
|
268
269
|
const typeStr = typeToString(v.type);
|
|
269
270
|
const scope = v.funcName ? ` (in ${v.funcName})` : "";
|
|
270
271
|
const sampleStr = formatSample(v.sample);
|
|
271
|
-
|
|
272
|
-
if (
|
|
272
|
+
const nbShowMode = opts.show || (opts.errors ? "both" : (opts.values ? "both" : "types"));
|
|
273
|
+
if (nbShowMode === "values" && v.sample !== undefined) {
|
|
274
|
+
console.log(`${v.varName} = ${sampleStr}${scope}`);
|
|
275
|
+
} else if (nbShowMode === "both" && v.sample !== undefined) {
|
|
273
276
|
console.log(`${v.varName}: ${typeStr} = ${sampleStr}${scope}`);
|
|
274
277
|
} else {
|
|
275
278
|
console.log(`${v.varName}: ${typeStr}${scope}`);
|
|
@@ -363,9 +366,13 @@ export async function hintsCommand(
|
|
|
363
366
|
if (isFuncParam && afterVar.startsWith(":")) continue;
|
|
364
367
|
}
|
|
365
368
|
|
|
366
|
-
// Build the hint string
|
|
369
|
+
// Build the hint string based on --show mode
|
|
370
|
+
const showMode = opts.show || (opts.errors ? "both" : (opts.values ? "both" : "types"));
|
|
371
|
+
const hasSample = v.sample !== undefined && v.sample !== null;
|
|
367
372
|
let hint: string;
|
|
368
|
-
if (
|
|
373
|
+
if (showMode === "values" && hasSample) {
|
|
374
|
+
hint = ` = ${formatSample(v.sample)}`;
|
|
375
|
+
} else if (showMode === "both" && hasSample) {
|
|
369
376
|
const sampleStr = formatSample(v.sample);
|
|
370
377
|
hint = sampleStr ? `: ${typeStr} = ${sampleStr}` : `: ${typeStr}`;
|
|
371
378
|
} else {
|
package/src/index.ts
CHANGED
|
@@ -541,7 +541,8 @@ program
|
|
|
541
541
|
.description("Output source code with inline type hints from runtime observations (for AI agents)")
|
|
542
542
|
.option("--values", "Include sample values alongside types")
|
|
543
543
|
.option("--errors", "Show error mode — variables at crash time with values that caused the error")
|
|
544
|
-
.
|
|
544
|
+
.option("--show <mode>", "What to show inline: types, values, or both (default: both in error mode, types otherwise)")
|
|
545
|
+
.action(async (file: string | undefined, opts: { values?: boolean; errors?: boolean; show?: string }) => {
|
|
545
546
|
await hintsCommand(file, opts);
|
|
546
547
|
});
|
|
547
548
|
|