trickle-cli 0.1.228 → 0.1.229
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/run.js +36 -2
- package/dist/index.js +1 -0
- package/package.json +1 -1
- package/src/commands/run.ts +36 -2
- package/src/index.ts +1 -0
package/dist/commands/run.js
CHANGED
|
@@ -410,6 +410,8 @@ async function executeSingleRun(instrumentedCommand, env, opts, singleFile, loca
|
|
|
410
410
|
const localDir = env.TRICKLE_LOCAL_DIR || process.env.TRICKLE_LOCAL_DIR || path.join(process.cwd(), ".trickle");
|
|
411
411
|
const jsonlPath = path.join(localDir, "observations.jsonl");
|
|
412
412
|
const { generateLocalStubs, generateFromJsonl, readObservations } = await Promise.resolve().then(() => __importStar(require("../local-codegen")));
|
|
413
|
+
// Snapshot JSONL file sizes before the run so we only show new data in summary
|
|
414
|
+
const obsOffsetBefore = fs.existsSync(jsonlPath) ? fs.statSync(jsonlPath).size : 0;
|
|
413
415
|
// Check if stub generation is enabled (opt-in: TRICKLE_STUBS=1 enables .pyi/.d.ts files)
|
|
414
416
|
const stubsEnabled = (env.TRICKLE_STUBS || process.env.TRICKLE_STUBS || "0").toLowerCase() !== "0";
|
|
415
417
|
// Start live type generation — types update while the process runs
|
|
@@ -435,8 +437,37 @@ async function executeSingleRun(instrumentedCommand, env, opts, singleFile, loca
|
|
|
435
437
|
if (singleFile && stubsEnabled) {
|
|
436
438
|
generateLocalStubs(singleFile, jsonlPath);
|
|
437
439
|
}
|
|
438
|
-
// Show local summary with function signatures
|
|
439
|
-
|
|
440
|
+
// Show local summary with only NEW function signatures from this run.
|
|
441
|
+
// Read only bytes appended after the pre-run snapshot to avoid showing stale data.
|
|
442
|
+
let observations = readObservations(jsonlPath);
|
|
443
|
+
if (obsOffsetBefore > 0 && fs.existsSync(jsonlPath)) {
|
|
444
|
+
const tmpPath = jsonlPath + ".run-delta";
|
|
445
|
+
try {
|
|
446
|
+
const fd = fs.openSync(jsonlPath, "r");
|
|
447
|
+
const totalSize = fs.fstatSync(fd).size;
|
|
448
|
+
const newSize = totalSize - obsOffsetBefore;
|
|
449
|
+
if (newSize > 0) {
|
|
450
|
+
const buf = Buffer.alloc(newSize);
|
|
451
|
+
fs.readSync(fd, buf, 0, newSize, obsOffsetBefore);
|
|
452
|
+
fs.closeSync(fd);
|
|
453
|
+
fs.writeFileSync(tmpPath, buf);
|
|
454
|
+
observations = readObservations(tmpPath);
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
fs.closeSync(fd);
|
|
458
|
+
observations = [];
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
catch {
|
|
462
|
+
// Fall back to showing all observations
|
|
463
|
+
}
|
|
464
|
+
finally {
|
|
465
|
+
try {
|
|
466
|
+
fs.unlinkSync(tmpPath);
|
|
467
|
+
}
|
|
468
|
+
catch { }
|
|
469
|
+
}
|
|
470
|
+
}
|
|
440
471
|
const totalFunctions = observations.length;
|
|
441
472
|
console.log("");
|
|
442
473
|
console.log(chalk_1.default.bold(" trickle summary"));
|
|
@@ -1280,6 +1311,9 @@ function ensureTricklePythonPath(targetPython, env) {
|
|
|
1280
1311
|
continue;
|
|
1281
1312
|
}
|
|
1282
1313
|
}
|
|
1314
|
+
// trickle not found anywhere — warn the user
|
|
1315
|
+
console.error(chalk_1.default.yellow("\n ⚠ trickle Python package not found. Install it with:\n\n" +
|
|
1316
|
+
" pip install trickle-observe\n"));
|
|
1283
1317
|
}
|
|
1284
1318
|
function resolveObservePath() {
|
|
1285
1319
|
try {
|
package/dist/index.js
CHANGED
|
@@ -130,6 +130,7 @@ program
|
|
|
130
130
|
.option("--annotate <path>", "Auto-annotate this file or directory with types after the run")
|
|
131
131
|
.option("-w, --watch", "Watch source files and re-run on changes")
|
|
132
132
|
.allowUnknownOption()
|
|
133
|
+
.passThroughOptions()
|
|
133
134
|
.action(async (commandParts, opts) => {
|
|
134
135
|
const command = commandParts.length > 0 ? commandParts.join(" ") : undefined;
|
|
135
136
|
await (0, run_1.runCommand)(command, opts);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trickle-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.229",
|
|
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/run.ts
CHANGED
|
@@ -460,6 +460,9 @@ async function executeSingleRun(
|
|
|
460
460
|
|
|
461
461
|
const { generateLocalStubs, generateFromJsonl, readObservations } = await import("../local-codegen");
|
|
462
462
|
|
|
463
|
+
// Snapshot JSONL file sizes before the run so we only show new data in summary
|
|
464
|
+
const obsOffsetBefore = fs.existsSync(jsonlPath) ? fs.statSync(jsonlPath).size : 0;
|
|
465
|
+
|
|
463
466
|
// Check if stub generation is enabled (opt-in: TRICKLE_STUBS=1 enables .pyi/.d.ts files)
|
|
464
467
|
const stubsEnabled = (env.TRICKLE_STUBS || process.env.TRICKLE_STUBS || "0").toLowerCase() !== "0";
|
|
465
468
|
|
|
@@ -492,8 +495,31 @@ async function executeSingleRun(
|
|
|
492
495
|
generateLocalStubs(singleFile, jsonlPath);
|
|
493
496
|
}
|
|
494
497
|
|
|
495
|
-
// Show local summary with function signatures
|
|
496
|
-
|
|
498
|
+
// Show local summary with only NEW function signatures from this run.
|
|
499
|
+
// Read only bytes appended after the pre-run snapshot to avoid showing stale data.
|
|
500
|
+
let observations = readObservations(jsonlPath);
|
|
501
|
+
if (obsOffsetBefore > 0 && fs.existsSync(jsonlPath)) {
|
|
502
|
+
const tmpPath = jsonlPath + ".run-delta";
|
|
503
|
+
try {
|
|
504
|
+
const fd = fs.openSync(jsonlPath, "r");
|
|
505
|
+
const totalSize = fs.fstatSync(fd).size;
|
|
506
|
+
const newSize = totalSize - obsOffsetBefore;
|
|
507
|
+
if (newSize > 0) {
|
|
508
|
+
const buf = Buffer.alloc(newSize);
|
|
509
|
+
fs.readSync(fd, buf, 0, newSize, obsOffsetBefore);
|
|
510
|
+
fs.closeSync(fd);
|
|
511
|
+
fs.writeFileSync(tmpPath, buf);
|
|
512
|
+
observations = readObservations(tmpPath);
|
|
513
|
+
} else {
|
|
514
|
+
fs.closeSync(fd);
|
|
515
|
+
observations = [];
|
|
516
|
+
}
|
|
517
|
+
} catch {
|
|
518
|
+
// Fall back to showing all observations
|
|
519
|
+
} finally {
|
|
520
|
+
try { fs.unlinkSync(tmpPath); } catch {}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
497
523
|
const totalFunctions = observations.length;
|
|
498
524
|
|
|
499
525
|
console.log("");
|
|
@@ -1410,6 +1436,14 @@ function ensureTricklePythonPath(
|
|
|
1410
1436
|
continue;
|
|
1411
1437
|
}
|
|
1412
1438
|
}
|
|
1439
|
+
|
|
1440
|
+
// trickle not found anywhere — warn the user
|
|
1441
|
+
console.error(
|
|
1442
|
+
chalk.yellow(
|
|
1443
|
+
"\n ⚠ trickle Python package not found. Install it with:\n\n" +
|
|
1444
|
+
" pip install trickle-observe\n",
|
|
1445
|
+
),
|
|
1446
|
+
);
|
|
1413
1447
|
}
|
|
1414
1448
|
|
|
1415
1449
|
function resolveObservePath(): string {
|
package/src/index.ts
CHANGED
|
@@ -94,6 +94,7 @@ program
|
|
|
94
94
|
.option("--annotate <path>", "Auto-annotate this file or directory with types after the run")
|
|
95
95
|
.option("-w, --watch", "Watch source files and re-run on changes")
|
|
96
96
|
.allowUnknownOption()
|
|
97
|
+
.passThroughOptions()
|
|
97
98
|
.action(async (commandParts: string[], opts) => {
|
|
98
99
|
const command = commandParts.length > 0 ? commandParts.join(" ") : undefined;
|
|
99
100
|
await runCommand(command, opts);
|