getprismo 0.1.26 → 0.1.28
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 +62 -3
- package/lib/prismo-dev/cursor-sessions.js +641 -0
- package/lib/prismo-dev/firewall.js +119 -0
- package/lib/prismo-dev/mcp.js +16 -0
- package/lib/prismo-dev/scan-detect.js +30 -8
- package/lib/prismo-dev/scan.js +30 -1
- package/lib/prismo-dev/usage-sessions.js +68 -0
- package/lib/prismo-dev/usage-watch.js +23 -0
- package/lib/prismo-dev-scan.js +101 -12
- package/package.json +1 -1
package/lib/prismo-dev-scan.js
CHANGED
|
@@ -53,6 +53,9 @@ const {
|
|
|
53
53
|
|
|
54
54
|
const {
|
|
55
55
|
analyzeSessionFile,
|
|
56
|
+
analyzeCursorSessions,
|
|
57
|
+
buildCursorDiagnosis,
|
|
58
|
+
buildCursorSessionTimeline,
|
|
56
59
|
calculateClaudeCost,
|
|
57
60
|
compactUsageSummary,
|
|
58
61
|
formatMoney,
|
|
@@ -60,11 +63,13 @@ const {
|
|
|
60
63
|
getClaudeCodeCostSummary,
|
|
61
64
|
getClaudeSessionFiles,
|
|
62
65
|
getCodexSessionFiles,
|
|
66
|
+
getCursorSessionSummary,
|
|
63
67
|
getUsageSummary,
|
|
64
68
|
getPositionals,
|
|
65
69
|
parsePositiveInt,
|
|
66
70
|
parseScopeAndTarget,
|
|
67
71
|
renderClaudeCostTerminal,
|
|
72
|
+
renderCursorTerminal,
|
|
68
73
|
renderUsageTerminal,
|
|
69
74
|
renderContextThrottle,
|
|
70
75
|
renderRescuePrompt,
|
|
@@ -202,6 +207,7 @@ const {
|
|
|
202
207
|
const {
|
|
203
208
|
renderFirewallTerminal,
|
|
204
209
|
runFirewall,
|
|
210
|
+
runTimelineFirewallSuggestions,
|
|
205
211
|
} = require("./prismo-dev/firewall")({
|
|
206
212
|
fs,
|
|
207
213
|
path,
|
|
@@ -263,9 +269,10 @@ Usage:
|
|
|
263
269
|
prismo scan [--fix] [--ci] [--json] [--usage] [--optimizer-fit] [--report-card] [--simple] [--no-report] [path]
|
|
264
270
|
prismo optimize [scope] [--json] [path]
|
|
265
271
|
prismo context [scope] [--json] [path]
|
|
266
|
-
prismo cc [list|last N|all] [--json] [--limit N] [path]
|
|
267
|
-
prismo
|
|
268
|
-
prismo
|
|
272
|
+
prismo cc [list|last N|all|timeline] [--json] [--limit N] [--firewall] [--task TASK] [path]
|
|
273
|
+
prismo cursor [list|authorship|timeline|files|all] [--json] [--limit N] [path]
|
|
274
|
+
prismo usage [codex|claude|cursor|all] [--json] [--limit N] [path]
|
|
275
|
+
prismo watch [codex|claude|cursor|all] [--json] [--once] [--agents] [--report] [--rescue] [--guardrails] [--throttle] [--events] [--no-events] [--auto] [--budget N] [--redact-paths] [--interval N] [path]
|
|
269
276
|
prismo demo
|
|
270
277
|
|
|
271
278
|
Commands:
|
|
@@ -280,7 +287,8 @@ Commands:
|
|
|
280
287
|
optimize Generate lightweight AI-readable project context files in .prismo/.
|
|
281
288
|
context Print a copy-pasteable compact context prompt for AI coding tools.
|
|
282
289
|
cc Show Claude Code token cost, cache cost, and all-time totals.
|
|
283
|
-
|
|
290
|
+
cursor Show Cursor session data, AI authorship, and AI-generated file tracking.
|
|
291
|
+
usage Read local Codex/Claude Code/Cursor session logs and summarize token usage.
|
|
284
292
|
watch Refresh local session usage in the terminal.
|
|
285
293
|
demo Show sample output without needing a messy repo.
|
|
286
294
|
setup Detect coding tools, tracking modes, local logs, and Prismo proxy readiness.
|
|
@@ -295,6 +303,8 @@ Options:
|
|
|
295
303
|
--simple Print a plain-English scan summary for first-time or non-technical users.
|
|
296
304
|
--no-report Do not write .prismo/prismo-dev-report.md.
|
|
297
305
|
--limit N Number of recent local sessions to show.
|
|
306
|
+
--firewall Generate cc timeline-derived firewall suggestion files.
|
|
307
|
+
--task TASK Name the task for timeline-derived firewall suggestions.
|
|
298
308
|
--interval N Refresh interval in seconds for watch mode.
|
|
299
309
|
--dry-run Preview doctor/fix actions without writing files.
|
|
300
310
|
--apply-ignores-only Only create/suggest AI ignore files in doctor mode.
|
|
@@ -377,7 +387,7 @@ Output:
|
|
|
377
387
|
|
|
378
388
|
Usage:
|
|
379
389
|
prismo cc [--json] [path]
|
|
380
|
-
prismo cc timeline [--json] [path]
|
|
390
|
+
prismo cc timeline [--json] [--firewall] [--task TASK] [path]
|
|
381
391
|
prismo cc list [--json] [--limit N] [path]
|
|
382
392
|
prismo cc last N [--json] [path]
|
|
383
393
|
prismo cc all [--json] [path]
|
|
@@ -385,6 +395,7 @@ Usage:
|
|
|
385
395
|
Examples:
|
|
386
396
|
prismo cc
|
|
387
397
|
prismo cc timeline
|
|
398
|
+
prismo cc timeline --firewall --task auth-bug
|
|
388
399
|
prismo cc list
|
|
389
400
|
prismo cc last 5
|
|
390
401
|
prismo cc all --json
|
|
@@ -393,23 +404,47 @@ Examples:
|
|
|
393
404
|
Reads ~/.claude/projects session logs and estimates Claude API token cost from input, output, cache write, and cache read tokens.
|
|
394
405
|
Adds Prismo diagnosis: cost drivers, estimated avoidable spend, and context-optimization next actions.
|
|
395
406
|
timeline shows context spikes, repeated commands, artifact leaks, and tool-output pressure for the latest session.
|
|
407
|
+
--firewall writes .prismo/timeline-firewall-suggestions.md and suggested allow/block files from timeline evidence.
|
|
396
408
|
Without a path, cc commands read all Claude Code projects. Passing a path filters to that project.`,
|
|
409
|
+
cursor: `Prismo Cursor Sessions
|
|
410
|
+
|
|
411
|
+
Usage:
|
|
412
|
+
prismo cursor [--json] [--limit N] [path]
|
|
413
|
+
prismo cursor list [--json] [--limit N] [path]
|
|
414
|
+
prismo cursor authorship [--json] [--limit N] [path]
|
|
415
|
+
prismo cursor timeline [--json] [--limit N] [path]
|
|
416
|
+
prismo cursor files [--json] [--limit N] [path]
|
|
417
|
+
prismo cursor all [--json] [--limit N] [path]
|
|
418
|
+
|
|
419
|
+
Examples:
|
|
420
|
+
prismo cursor
|
|
421
|
+
prismo cursor authorship
|
|
422
|
+
prismo cursor list --limit 20
|
|
423
|
+
prismo cursor timeline --json
|
|
424
|
+
prismo cursor files
|
|
425
|
+
|
|
426
|
+
Output:
|
|
427
|
+
Reads ~/.cursor/ai-tracking/ai-code-tracking.db and Cursor workspace state databases.
|
|
428
|
+
Shows Cursor composer sessions, AI authorship percentages from scored commits, AI-generated file tracking, and churn analysis.
|
|
429
|
+
Requires sqlite3 to be installed on the system.`,
|
|
397
430
|
usage: `Prismo Usage
|
|
398
431
|
|
|
399
432
|
Usage:
|
|
400
|
-
prismo usage [codex|claude|all] [--json] [--limit N] [path]
|
|
433
|
+
prismo usage [codex|claude|cursor|all] [--json] [--limit N] [path]
|
|
401
434
|
|
|
402
435
|
Examples:
|
|
403
436
|
prismo usage
|
|
404
437
|
prismo usage codex --json
|
|
438
|
+
prismo usage cursor
|
|
405
439
|
prismo usage claude --limit 3`,
|
|
406
440
|
watch: `Prismo Watch
|
|
407
441
|
|
|
408
442
|
Usage:
|
|
409
|
-
prismo watch [codex|claude|all] [--json] [--once] [--agents] [--report] [--rescue] [--guardrails] [--throttle] [--events] [--no-events] [--auto] [--budget N] [--redact-paths] [--interval N] [path]
|
|
443
|
+
prismo watch [codex|claude|cursor|all] [--json] [--once] [--agents] [--report] [--rescue] [--guardrails] [--throttle] [--events] [--no-events] [--auto] [--budget N] [--redact-paths] [--interval N] [path]
|
|
410
444
|
|
|
411
445
|
Examples:
|
|
412
446
|
prismo watch codex
|
|
447
|
+
prismo watch cursor --once --json
|
|
413
448
|
prismo watch claude --once --json
|
|
414
449
|
prismo watch --agents --once
|
|
415
450
|
prismo watch --once --report
|
|
@@ -514,6 +549,7 @@ Tools exposed:
|
|
|
514
549
|
prismo_context_pack
|
|
515
550
|
prismo_firewall
|
|
516
551
|
prismo_cc_timeline
|
|
552
|
+
prismo_cursor_sessions
|
|
517
553
|
|
|
518
554
|
Output:
|
|
519
555
|
Starts a local JSON-RPC MCP server over stdio. Use it from MCP-compatible clients so agents can scan context waste, search shielded command output, and request scoped context without loading huge logs into chat.
|
|
@@ -569,8 +605,8 @@ async function runCli(argv) {
|
|
|
569
605
|
printCommandHelp(command);
|
|
570
606
|
return;
|
|
571
607
|
}
|
|
572
|
-
if (!["dev", "init", "doctor", "firewall", "benchmark", "shield", "mcp", "setup", "scan", "optimize", "context", "cc", "usage", "watch", "demo"].includes(command)) {
|
|
573
|
-
throw new Error(`Unknown command: ${command}. Try: prismo doctor, prismo watch, prismo benchmark, prismo shield, prismo mcp, prismo firewall, prismo init, prismo scan, prismo optimize, prismo context, prismo cc, or prismo usage`);
|
|
608
|
+
if (!["dev", "init", "doctor", "firewall", "benchmark", "shield", "mcp", "setup", "scan", "optimize", "context", "cc", "cursor", "usage", "watch", "demo"].includes(command)) {
|
|
609
|
+
throw new Error(`Unknown command: ${command}. Try: prismo doctor, prismo watch, prismo benchmark, prismo shield, prismo mcp, prismo firewall, prismo init, prismo scan, prismo optimize, prismo context, prismo cc, prismo cursor, or prismo usage`);
|
|
574
610
|
}
|
|
575
611
|
|
|
576
612
|
if (command === "demo") {
|
|
@@ -720,6 +756,7 @@ async function runCli(argv) {
|
|
|
720
756
|
toDoctorJsonPayload,
|
|
721
757
|
getUsageSummary,
|
|
722
758
|
getClaudeCodeCostSummary,
|
|
759
|
+
getCursorSessionSummary,
|
|
723
760
|
runOptimize,
|
|
724
761
|
createOptimizeContext,
|
|
725
762
|
renderStarterPrompt,
|
|
@@ -759,7 +796,17 @@ async function runCli(argv) {
|
|
|
759
796
|
if (command === "cc") {
|
|
760
797
|
const json = rest.includes("--json");
|
|
761
798
|
const limitIndex = rest.indexOf("--limit");
|
|
762
|
-
const
|
|
799
|
+
const firewall = rest.includes("--firewall");
|
|
800
|
+
const taskIndex = rest.indexOf("--task");
|
|
801
|
+
const firewallTask = taskIndex >= 0 && rest[taskIndex + 1] && !rest[taskIndex + 1].startsWith("-")
|
|
802
|
+
? rest[taskIndex + 1]
|
|
803
|
+
: "timeline-followup";
|
|
804
|
+
const ccArgs = rest.filter((_, index) => {
|
|
805
|
+
if (index === rest.indexOf("--firewall")) return false;
|
|
806
|
+
if (taskIndex >= 0 && (index === taskIndex || index === taskIndex + 1)) return false;
|
|
807
|
+
return true;
|
|
808
|
+
});
|
|
809
|
+
const positional = getPositionals(ccArgs, new Set(["--limit"]));
|
|
763
810
|
const subcommand = positional[0] && ["list", "last", "all", "timeline"].includes(positional[0].toLowerCase()) ? positional[0].toLowerCase() : "latest";
|
|
764
811
|
const lastCount = subcommand === "last" ? parsePositiveInt(positional[1], 5) : null;
|
|
765
812
|
const limit = subcommand === "list"
|
|
@@ -780,6 +827,9 @@ async function runCli(argv) {
|
|
|
780
827
|
if (json) {
|
|
781
828
|
if (subcommand === "timeline") {
|
|
782
829
|
const latest = summary.sessions[0] || null;
|
|
830
|
+
const firewallSuggestions = firewall && latest
|
|
831
|
+
? runTimelineFirewallSuggestions(path.resolve(target), latest, { task: firewallTask, dryRun: false })
|
|
832
|
+
: null;
|
|
783
833
|
console.log(JSON.stringify({
|
|
784
834
|
schemaVersion: 1,
|
|
785
835
|
generatedAt: summary.generatedAt,
|
|
@@ -796,6 +846,7 @@ async function runCli(argv) {
|
|
|
796
846
|
}
|
|
797
847
|
: null,
|
|
798
848
|
timeline: latest ? latest.timeline || [] : [],
|
|
849
|
+
firewallSuggestions,
|
|
799
850
|
suggestedAction: latest?.prismo?.recommendations?.[0] || `${NPX_COMMAND} doctor`,
|
|
800
851
|
}, null, 2));
|
|
801
852
|
return;
|
|
@@ -803,13 +854,48 @@ async function runCli(argv) {
|
|
|
803
854
|
console.log(JSON.stringify(summary, null, 2));
|
|
804
855
|
return;
|
|
805
856
|
}
|
|
806
|
-
|
|
857
|
+
const output = [renderClaudeCostTerminal(summary)];
|
|
858
|
+
if (subcommand === "timeline" && firewall) {
|
|
859
|
+
const latest = summary.sessions[0] || null;
|
|
860
|
+
if (latest) {
|
|
861
|
+
const suggestions = runTimelineFirewallSuggestions(path.resolve(target), latest, { task: firewallTask, dryRun: false });
|
|
862
|
+
output.push("");
|
|
863
|
+
output.push("Timeline Firewall Suggestions");
|
|
864
|
+
output.push(`Wrote: ${suggestions.generatedFiles.join(", ")}`);
|
|
865
|
+
output.push(`Session-derived allowed: ${suggestions.sessionAllowed.length}`);
|
|
866
|
+
output.push(`Session-derived blocked: ${suggestions.sessionBlocked.length}`);
|
|
867
|
+
output.push("Tell your agent: Use .prismo/context-firewall.suggested.md for the next scoped session.");
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
console.log(output.join("\n"));
|
|
871
|
+
return;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
if (command === "cursor") {
|
|
875
|
+
const json = rest.includes("--json");
|
|
876
|
+
const limitIndex = rest.indexOf("--limit");
|
|
877
|
+
const positional = getPositionals(rest, new Set(["--limit"]));
|
|
878
|
+
const subcommand = positional[0] && ["list", "authorship", "timeline", "files", "all"].includes(positional[0].toLowerCase())
|
|
879
|
+
? positional[0].toLowerCase()
|
|
880
|
+
: "latest";
|
|
881
|
+
const target = (subcommand !== "latest" ? positional[1] : positional[0]) || process.cwd();
|
|
882
|
+
const limit = parsePositiveInt(limitIndex >= 0 ? rest[limitIndex + 1] : null, subcommand === "all" ? 200 : 20);
|
|
883
|
+
const summary = getCursorSessionSummary({
|
|
884
|
+
cwd: path.resolve(target),
|
|
885
|
+
limit,
|
|
886
|
+
mode: subcommand,
|
|
887
|
+
});
|
|
888
|
+
if (json) {
|
|
889
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
console.log(renderCursorTerminal(summary, subcommand));
|
|
807
893
|
return;
|
|
808
894
|
}
|
|
809
895
|
|
|
810
896
|
if (command === "usage" || command === "watch") {
|
|
811
897
|
const json = rest.includes("--json");
|
|
812
|
-
const knownTools = new Set(["codex", "claude", "all"]);
|
|
898
|
+
const knownTools = new Set(["codex", "claude", "cursor", "all"]);
|
|
813
899
|
const positional = getPositionals(rest, new Set(["--limit", "--interval", "--budget"]));
|
|
814
900
|
const explicitTool = positional[0] && knownTools.has(positional[0].toLowerCase());
|
|
815
901
|
const tool = explicitTool ? positional[0].toLowerCase() : "all";
|
|
@@ -989,6 +1075,7 @@ module.exports = {
|
|
|
989
1075
|
renderMarkdownReport,
|
|
990
1076
|
renderSimpleScanReport,
|
|
991
1077
|
renderClaudeCostTerminal,
|
|
1078
|
+
renderCursorTerminal,
|
|
992
1079
|
renderUsageTerminal,
|
|
993
1080
|
renderContextThrottle,
|
|
994
1081
|
renderRescuePrompt,
|
|
@@ -1008,7 +1095,9 @@ module.exports = {
|
|
|
1008
1095
|
runCli,
|
|
1009
1096
|
scanRepo,
|
|
1010
1097
|
getClaudeCodeCostSummary,
|
|
1098
|
+
getCursorSessionSummary,
|
|
1011
1099
|
getUsageSummary,
|
|
1100
|
+
analyzeCursorSessions,
|
|
1012
1101
|
analyzeSessionFile,
|
|
1013
1102
|
calculateClaudeCost,
|
|
1014
1103
|
toDoctorJsonPayload,
|
package/package.json
CHANGED