@thegitai/cli 1.0.0-preview.58 → 1.0.0-preview.59

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 CHANGED
@@ -42,8 +42,9 @@ Run `ai --help` for sessions, modes, keys, and chat commands.
42
42
 
43
43
  The CLI shows a usage notice at 80% and 95% of your 5-hour, weekly, or monthly
44
44
  allowance while work continues. Notices include when usage starts resetting in
45
- your local time and a reminder to run `/usage`. Windows crossing a threshold
46
- together share one notice. While the CLI stays open, the 80% notice rearms only
45
+ your local time and a reminder to run `/usage`. When more than one allowance is
46
+ nearly used, the notice names only the most urgent one; `/usage` shows them
47
+ all. While the CLI stays open, the 80% notice rearms only
47
48
  below 75% usage and the 95% notice only below 90%, so small fluctuations stay
48
49
  quiet. Restarting the CLI can show a notice again. A nearly exhausted allowance
49
50
  displays "over 99%". Live notices clear when a turn ends or is cancelled, and
@@ -16,7 +16,7 @@ function resetDescription(resetsAt, now) {
16
16
  export function createUsageNoticeTracker() {
17
17
  const shown = new Map();
18
18
  return (usage, now = Date.now()) => {
19
- const lines = [];
19
+ let urgent = null;
20
20
  for (const [label, window] of USAGE_WINDOWS) {
21
21
  const left = usage?.percentLeft?.[window];
22
22
  if (typeof left !== 'number' || !Number.isFinite(left) || left < 0 || left > 100)
@@ -27,21 +27,26 @@ export function createUsageNoticeTracker() {
27
27
  else if (used < 90 && shown.get(window) === 95)
28
28
  shown.set(window, 80);
29
29
  const threshold = used >= 95 ? 95 : used >= 80 ? 80 : 0;
30
- const previous = shown.get(window) ?? 0;
31
- if (!threshold || threshold <= previous)
30
+ if (!threshold)
32
31
  continue;
33
32
  const reset = usage?.resetsAt?.[window];
34
33
  const resetsAt = typeof reset === 'string' ? Date.parse(reset) : NaN;
35
34
  if (!Number.isFinite(resetsAt) || resetsAt <= now)
36
35
  continue;
37
- shown.set(window, threshold);
38
- const percent = used === 100 ? 'over 99%' : `${Math.floor(used)}%`;
39
- lines.push(`You've used ${percent} of your ${label.toLowerCase()} allowance.`);
40
- lines.push(resetDescription(resetsAt, now));
36
+ if (!urgent || used > urgent.used)
37
+ urgent = { label, window, used, threshold, resetsAt };
41
38
  }
42
- if (!lines.length)
39
+ if (!urgent || urgent.threshold <= Math.max(0, ...shown.values()))
43
40
  return null;
44
- lines.push('Run /usage for details.');
45
- return { title: 'Usage notice', body: lines.join('\n') };
41
+ shown.set(urgent.window, urgent.threshold);
42
+ const percent = urgent.used === 100 ? 'over 99%' : `${Math.floor(urgent.used)}%`;
43
+ return {
44
+ title: 'Usage notice',
45
+ body: [
46
+ `You've used ${percent} of your ${urgent.label.toLowerCase()} allowance.`,
47
+ resetDescription(urgent.resetsAt, now),
48
+ 'Run /usage for details.',
49
+ ].join('\n'),
50
+ };
46
51
  };
47
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegitai/cli",
3
- "version": "1.0.0-preview.58",
3
+ "version": "1.0.0-preview.59",
4
4
  "description": "TheGitAI is an agentic AI coding tool for your terminal. It reads and searches your repository, writes and edits files, runs your tests, and verifies the change before handing it back.",
5
5
  "keywords": [
6
6
  "agentic-ai",
@@ -45,11 +45,11 @@
45
45
  "@lydell/node-pty-linux-x64": "1.1.0",
46
46
  "@lydell/node-pty-win32-arm64": "1.1.0",
47
47
  "@lydell/node-pty-win32-x64": "1.1.0",
48
- "@thegitai/tui-darwin-arm64": "1.0.0-preview.58",
49
- "@thegitai/tui-darwin-x64": "1.0.0-preview.58",
50
- "@thegitai/tui-linux-arm64": "1.0.0-preview.58",
51
- "@thegitai/tui-linux-x64": "1.0.0-preview.58",
52
- "@thegitai/tui-win32-x64": "1.0.0-preview.58",
48
+ "@thegitai/tui-darwin-arm64": "1.0.0-preview.59",
49
+ "@thegitai/tui-darwin-x64": "1.0.0-preview.59",
50
+ "@thegitai/tui-linux-arm64": "1.0.0-preview.59",
51
+ "@thegitai/tui-linux-x64": "1.0.0-preview.59",
52
+ "@thegitai/tui-win32-x64": "1.0.0-preview.59",
53
53
  "@vscode/ripgrep": "1.18.0"
54
54
  },
55
55
  "repository": {