trickle-cli 0.1.218 → 0.1.220
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 +17 -21
- package/package.json +1 -1
- package/src/commands/hints.ts +11 -4
- package/src/index.ts +14 -22
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
|
@@ -83,10 +83,23 @@ const next_1 = require("./commands/next");
|
|
|
83
83
|
const python_1 = require("./commands/python");
|
|
84
84
|
const hints_1 = require("./commands/hints");
|
|
85
85
|
const program = new commander_1.Command();
|
|
86
|
+
// Only these commands show in --help. All others still work but are hidden.
|
|
87
|
+
const VISIBLE_COMMANDS = new Set(["run", "hints", "vars", "init", "help"]);
|
|
86
88
|
program
|
|
87
89
|
.name("trickle")
|
|
88
|
-
.description("
|
|
89
|
-
.version(
|
|
90
|
+
.description("Runtime type annotations for Python — see tensor shapes, variable types, and crash-time values as you code")
|
|
91
|
+
.version((() => { try {
|
|
92
|
+
return require("../package.json").version;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return "0.0.0";
|
|
96
|
+
} })())
|
|
97
|
+
.configureHelp({
|
|
98
|
+
visibleCommands: (cmd) => {
|
|
99
|
+
return cmd.commands.filter(c => VISIBLE_COMMANDS.has(c.name()));
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
.addHelpText("after", "\nAll other commands are available but hidden from this list. Run `trickle <command> --help` for any command.");
|
|
90
103
|
// trickle init
|
|
91
104
|
program
|
|
92
105
|
.command("init")
|
|
@@ -540,6 +553,7 @@ program
|
|
|
540
553
|
.description("Output source code with inline type hints from runtime observations (for AI agents)")
|
|
541
554
|
.option("--values", "Include sample values alongside types")
|
|
542
555
|
.option("--errors", "Show error mode — variables at crash time with values that caused the error")
|
|
556
|
+
.option("--show <mode>", "What to show inline: types, values, or both (default: both in error mode, types otherwise)")
|
|
543
557
|
.action(async (file, opts) => {
|
|
544
558
|
await (0, hints_1.hintsCommand)(file, opts);
|
|
545
559
|
});
|
|
@@ -1043,23 +1057,5 @@ if (firstArg &&
|
|
|
1043
1057
|
// Inject "run" before the file argument
|
|
1044
1058
|
process.argv.splice(2, 0, "run");
|
|
1045
1059
|
}
|
|
1046
|
-
//
|
|
1047
|
-
program.addHelpText('before', `
|
|
1048
|
-
${chalk_1.default.bold('Quick Start')}
|
|
1049
|
-
trickle init Set up trickle in your project
|
|
1050
|
-
trickle run <command> Run with observability (zero code changes)
|
|
1051
|
-
trickle test [command] Run tests with structured results
|
|
1052
|
-
|
|
1053
|
-
${chalk_1.default.bold('Analyze')}
|
|
1054
|
-
trickle summary Full overview: errors, queries, root causes
|
|
1055
|
-
trickle explain <file> Understand a file: functions, call graph, data flow
|
|
1056
|
-
trickle flamegraph Performance hotspots visualization
|
|
1057
|
-
trickle doctor Health check with recommended actions
|
|
1058
|
-
|
|
1059
|
-
${chalk_1.default.bold('Fix & Verify')}
|
|
1060
|
-
trickle verify --baseline Save metrics before fixing
|
|
1061
|
-
trickle verify Compare after fixing
|
|
1062
|
-
|
|
1063
|
-
${chalk_1.default.bold('All Commands')}
|
|
1064
|
-
`);
|
|
1060
|
+
// Help text removed — visibleCommands filter handles it
|
|
1065
1061
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trickle-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.220",
|
|
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
|
@@ -48,10 +48,19 @@ import { hintsCommand } from "./commands/hints";
|
|
|
48
48
|
|
|
49
49
|
const program = new Command();
|
|
50
50
|
|
|
51
|
+
// Only these commands show in --help. All others still work but are hidden.
|
|
52
|
+
const VISIBLE_COMMANDS = new Set(["run", "hints", "vars", "init", "help"]);
|
|
53
|
+
|
|
51
54
|
program
|
|
52
55
|
.name("trickle")
|
|
53
|
-
.description("
|
|
54
|
-
.version("0.
|
|
56
|
+
.description("Runtime type annotations for Python — see tensor shapes, variable types, and crash-time values as you code")
|
|
57
|
+
.version((() => { try { return require("../package.json").version; } catch { return "0.0.0"; } })())
|
|
58
|
+
.configureHelp({
|
|
59
|
+
visibleCommands: (cmd: Command) => {
|
|
60
|
+
return cmd.commands.filter(c => VISIBLE_COMMANDS.has(c.name()));
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
.addHelpText("after", "\nAll other commands are available but hidden from this list. Run `trickle <command> --help` for any command.");
|
|
55
64
|
|
|
56
65
|
// trickle init
|
|
57
66
|
program
|
|
@@ -541,7 +550,8 @@ program
|
|
|
541
550
|
.description("Output source code with inline type hints from runtime observations (for AI agents)")
|
|
542
551
|
.option("--values", "Include sample values alongside types")
|
|
543
552
|
.option("--errors", "Show error mode — variables at crash time with values that caused the error")
|
|
544
|
-
.
|
|
553
|
+
.option("--show <mode>", "What to show inline: types, values, or both (default: both in error mode, types otherwise)")
|
|
554
|
+
.action(async (file: string | undefined, opts: { values?: boolean; errors?: boolean; show?: string }) => {
|
|
545
555
|
await hintsCommand(file, opts);
|
|
546
556
|
});
|
|
547
557
|
|
|
@@ -1089,24 +1099,6 @@ if (
|
|
|
1089
1099
|
process.argv.splice(2, 0, "run");
|
|
1090
1100
|
}
|
|
1091
1101
|
|
|
1092
|
-
//
|
|
1093
|
-
program.addHelpText('before', `
|
|
1094
|
-
${chalk.bold('Quick Start')}
|
|
1095
|
-
trickle init Set up trickle in your project
|
|
1096
|
-
trickle run <command> Run with observability (zero code changes)
|
|
1097
|
-
trickle test [command] Run tests with structured results
|
|
1098
|
-
|
|
1099
|
-
${chalk.bold('Analyze')}
|
|
1100
|
-
trickle summary Full overview: errors, queries, root causes
|
|
1101
|
-
trickle explain <file> Understand a file: functions, call graph, data flow
|
|
1102
|
-
trickle flamegraph Performance hotspots visualization
|
|
1103
|
-
trickle doctor Health check with recommended actions
|
|
1104
|
-
|
|
1105
|
-
${chalk.bold('Fix & Verify')}
|
|
1106
|
-
trickle verify --baseline Save metrics before fixing
|
|
1107
|
-
trickle verify Compare after fixing
|
|
1108
|
-
|
|
1109
|
-
${chalk.bold('All Commands')}
|
|
1110
|
-
`);
|
|
1102
|
+
// Help text removed — visibleCommands filter handles it
|
|
1111
1103
|
|
|
1112
1104
|
program.parse();
|