tldr-experts 0.3.0

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +913 -0
  2. package/LICENSE +21 -0
  3. package/README.md +174 -0
  4. package/dist/hooks/answer-capture.js +174 -0
  5. package/dist/hooks/budget-gate.js +173 -0
  6. package/dist/hooks/chunk-0bt6yb2q.js +88 -0
  7. package/dist/hooks/chunk-1zwcxd3f.js +66 -0
  8. package/dist/hooks/chunk-9gb21660.js +66 -0
  9. package/dist/hooks/chunk-a8p2rc94.js +20 -0
  10. package/dist/hooks/chunk-ae6bkfs5.js +0 -0
  11. package/dist/hooks/chunk-azctppjh.js +198 -0
  12. package/dist/hooks/chunk-g395gk7e.js +503 -0
  13. package/dist/hooks/chunk-j234zf0t.js +339 -0
  14. package/dist/hooks/chunk-kw4tffzf.js +139 -0
  15. package/dist/hooks/chunk-p274ckxv.js +7435 -0
  16. package/dist/hooks/chunk-sdjnnmzz.js +497 -0
  17. package/dist/hooks/chunk-t56k6146.js +14 -0
  18. package/dist/hooks/chunk-t8tdv11p.js +35 -0
  19. package/dist/hooks/chunk-x98qs959.js +302 -0
  20. package/dist/hooks/chunk-y0jdr3et.js +627 -0
  21. package/dist/hooks/claim-sources.js +72 -0
  22. package/dist/hooks/dod-gate.js +198 -0
  23. package/dist/hooks/no-reask.js +67 -0
  24. package/dist/hooks/session-start.js +1348 -0
  25. package/dist/hooks/statusline.js +116 -0
  26. package/dist/tldrx.js +34219 -0
  27. package/env.yml +79 -0
  28. package/package.json +60 -0
  29. package/plugin/.claude-plugin/plugin.json +9 -0
  30. package/plugin/README.md +113 -0
  31. package/plugin/agents/README.md +22 -0
  32. package/plugin/hooks/hooks.json +107 -0
  33. package/plugin/skills/tldrx/SKILL.md +170 -0
  34. package/stages/build/stage.md +70 -0
  35. package/stages/build/stage.yml +54 -0
  36. package/stages/how/stage.md +89 -0
  37. package/stages/how/stage.yml +53 -0
  38. package/stages/plan/stage.md +89 -0
  39. package/stages/plan/stage.yml +48 -0
  40. package/stages/watch/stage.md +85 -0
  41. package/stages/watch/stage.yml +61 -0
  42. package/stages/what/stage.md +89 -0
  43. package/stages/what/stage.yml +61 -0
  44. package/templates/budget.yml +17 -0
  45. package/templates/competencies.yml +14 -0
  46. package/templates/env.yml +19 -0
  47. package/templates/epic.md +38 -0
  48. package/templates/expert.md +51 -0
  49. package/templates/experts/architect.md +77 -0
  50. package/templates/experts/delivery.md +76 -0
  51. package/templates/experts/developer.md +78 -0
  52. package/templates/experts/operations.md +74 -0
  53. package/templates/experts/product.md +78 -0
  54. package/templates/facts.yml +18 -0
  55. package/templates/handoff.md +63 -0
  56. package/templates/process.yml +33 -0
  57. package/templates/questions.md +63 -0
  58. package/templates/run.yml +24 -0
  59. package/templates/story.md +55 -0
  60. package/templates/watcher.md +68 -0
  61. package/templates/waves.yml +17 -0
  62. package/templates/workspace.yml +30 -0
  63. package/workflows/bugfix.yml +26 -0
  64. package/workflows/docs.yml +23 -0
  65. package/workflows/feature.yml +22 -0
  66. package/workflows/hotfix.yml +24 -0
  67. package/workflows/integration.yml +24 -0
  68. package/workflows/migration.yml +24 -0
  69. package/workflows/performance.yml +23 -0
  70. package/workflows/prototype.yml +24 -0
  71. package/workflows/refactor.yml +24 -0
  72. package/workflows/retro.yml +20 -0
  73. package/workflows/security-patch.yml +23 -0
  74. package/workflows/spike.yml +23 -0
  75. package/workflows/upgrade.yml +23 -0
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ bar,
4
+ runSnapshot
5
+ } from "./chunk-y0jdr3et.js";
6
+ import"./chunk-sdjnnmzz.js";
7
+ import"./chunk-azctppjh.js";
8
+ import"./chunk-ae6bkfs5.js";
9
+ import"./chunk-j234zf0t.js";
10
+ import"./chunk-t56k6146.js";
11
+ import"./chunk-g395gk7e.js";
12
+ import"./chunk-0bt6yb2q.js";
13
+ import {
14
+ findWorkspaceRoot,
15
+ runtime
16
+ } from "./chunk-p274ckxv.js";
17
+
18
+ // src/core/statusline/renderStatusLine.ts
19
+ var NO_SESSION_DATA = "[tldrx] no session data";
20
+ function renderStatusLine(input) {
21
+ if (typeof input !== "object" || input === null)
22
+ return NO_SESSION_DATA;
23
+ const payload = input;
24
+ const model = payload.model?.display_name;
25
+ const pct = payload.context_window?.used_percentage;
26
+ const cost = payload.cost?.total_cost_usd;
27
+ if (typeof model !== "string" || model === "")
28
+ return NO_SESSION_DATA;
29
+ if (typeof pct !== "number" || Number.isNaN(pct))
30
+ return NO_SESSION_DATA;
31
+ if (typeof cost !== "number" || Number.isNaN(cost))
32
+ return NO_SESSION_DATA;
33
+ return `[tldrx] ${model} ctx:${Math.floor(pct)}% $${cost.toFixed(2)}`;
34
+ }
35
+ function renderStatusLineFromText(text) {
36
+ try {
37
+ return renderStatusLine(JSON.parse(text));
38
+ } catch {
39
+ return NO_SESSION_DATA;
40
+ }
41
+ }
42
+
43
+ // src/core/statusline/renderRunLine.ts
44
+ function renderRunLine(host, snapshot) {
45
+ const phase = snapshot.phase === "" ? "?" : snapshot.phase.toUpperCase();
46
+ const stage = snapshot.stage === "" ? "?" : snapshot.stage;
47
+ const expert = snapshot.expert === null || snapshot.expert === "" ? "" : ` — ${snapshot.expert}`;
48
+ return `[tldrx] ${snapshot.run}${alsoOpen(snapshot.openCount)} · ${phase} [${bar(snapshot.done, snapshot.total)}] ` + `${String(snapshot.done)}/${String(snapshot.total)}${signedByMachine(snapshot)} > ${stage}${expert} | ` + `${host.modelName} ctx:${String(Math.floor(host.usedPercentage))}% ` + `${money(host.totalCostUsd)}/${money(snapshot.ceilingUsd)}`;
49
+ }
50
+ function signedByMachine(snapshot) {
51
+ const parts = [];
52
+ if (snapshot.autoGates > 0)
53
+ parts.push(`auto:${String(snapshot.autoGates)}`);
54
+ if (snapshot.staleStages > 0)
55
+ parts.push(`stale:${String(snapshot.staleStages)}`);
56
+ return parts.length === 0 ? "" : ` ${parts.join(" ")}`;
57
+ }
58
+ function alsoOpen(openCount) {
59
+ return openCount > 1 ? ` (+${String(openCount - 1)} open)` : "";
60
+ }
61
+ function money(amount) {
62
+ return `$${amount.toFixed(2).replace(/\.00$/, "")}`;
63
+ }
64
+ function hostFrom(input) {
65
+ if (typeof input !== "object" || input === null)
66
+ return null;
67
+ const payload = input;
68
+ const modelName = payload.model?.display_name;
69
+ const pct = payload.context_window?.used_percentage;
70
+ const cost = payload.cost?.total_cost_usd;
71
+ if (typeof modelName !== "string" || modelName === "")
72
+ return null;
73
+ if (typeof pct !== "number" || Number.isNaN(pct))
74
+ return null;
75
+ if (typeof cost !== "number" || Number.isNaN(cost))
76
+ return null;
77
+ return { modelName, usedPercentage: pct, totalCostUsd: cost };
78
+ }
79
+ function locateFrom(input) {
80
+ if (typeof input !== "object" || input === null)
81
+ return null;
82
+ const payload = input;
83
+ const candidates = [payload.workspace?.project_dir, payload.cwd, payload.workspace?.current_dir];
84
+ for (const candidate of candidates) {
85
+ if (typeof candidate === "string" && candidate !== "")
86
+ return candidate;
87
+ }
88
+ return null;
89
+ }
90
+
91
+ // src/hooks/statusline.ts
92
+ var text = await runtime.readStdin();
93
+ process.stdout.write(`${render(text)}
94
+ `);
95
+ process.exit(0);
96
+ function render(input) {
97
+ let payload;
98
+ try {
99
+ payload = JSON.parse(input);
100
+ } catch {
101
+ return NO_SESSION_DATA;
102
+ }
103
+ try {
104
+ const host = hostFrom(payload);
105
+ const where = locateFrom(payload);
106
+ if (host !== null && where !== null) {
107
+ const root = findWorkspaceRoot(where);
108
+ const snapshot = root === null ? null : runSnapshot(root);
109
+ if (snapshot !== null)
110
+ return renderRunLine(host, snapshot);
111
+ }
112
+ return renderStatusLine(payload);
113
+ } catch {
114
+ return renderStatusLineFromText(input);
115
+ }
116
+ }