@thegitai/cli 1.0.2 → 1.0.4

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
@@ -99,6 +99,9 @@ Type `/model` to choose with **↑ / ↓**, and adjust a model's reasoning effor
99
99
  with **← / →** in the same panel: **Default / Low / Balanced / Deep**.
100
100
  **Enter** saves the selected model's choice for this project; **Esc** cancels.
101
101
  Each model remembers its own choice across new and resumed sessions.
102
+ In short terminals, the list scrolls around the highlighted model and shows how
103
+ many models are above and below. Use **PageUp / PageDown** to move a page, or
104
+ **Home / End** to reach the first or last model. Effort controls stay visible.
102
105
  A model your plan does not include stays in the list, grayed out with the
103
106
  reason, and **Enter** does not select it.
104
107
  On Plus or Pro, the footer names the plan after **TheGitAI**.
@@ -53,7 +53,9 @@ function writeLauncher(env, hostScript, platform = process.platform) {
53
53
  const launcherPath = path.join(dir, 'browser-bridge-host.bat');
54
54
  const contents = [
55
55
  '@echo off',
56
- `"${process.execPath}" "${hostScript}" %*`,
56
+ process.versions.electron
57
+ ? `"${process.execPath}" --thegitai-browser-host %*`
58
+ : `"${process.execPath}" "${hostScript}" %*`,
57
59
  '',
58
60
  ].join('\r\n');
59
61
  const existingBat = fs.existsSync(launcherPath)
@@ -66,7 +68,10 @@ function writeLauncher(env, hostScript, platform = process.platform) {
66
68
  }
67
69
  const launcherPath = path.join(dir, 'browser-bridge-host.sh');
68
70
  const quote = (value) => "'" + value.replaceAll("'", "'\\''") + "'";
69
- const contents = `#!/bin/sh\nexec ${quote(process.execPath)} ${quote(hostScript)} "$@"\n`;
71
+ const command = process.versions.electron
72
+ ? `${quote(process.execPath)}${platform === 'linux' ? ' --no-sandbox' : ''} --thegitai-browser-host`
73
+ : `${quote(process.execPath)} ${quote(hostScript)}`;
74
+ const contents = `#!/bin/sh\nexec ${command} "$@"\n`;
70
75
  const existing = fs.existsSync(launcherPath) ? fs.readFileSync(launcherPath, 'utf8') : null;
71
76
  if (existing === contents) {
72
77
  try {
@@ -4,7 +4,7 @@ import { REASONING_EFFORT_LABELS } from '../reasoning-effort.js';
4
4
  import { basename, join as joinPath } from 'node:path';
5
5
  import { createRatatuiBridge } from './tui/bridge.js';
6
6
  import { bucketActionLabel, } from '../permissions.js';
7
- import { AGENT_MODE_LOCKED_STATUS, approvalScrollLimit, buildTuiFrame, formatJobElapsed, formatTodoProgress, pickThinkingFallbackPhrase, renderTranscriptEntryLines, THINKING_FALLBACK_PHRASES, userInputViewportForFrame, } from './tui/build-frame.js';
7
+ import { AGENT_MODE_LOCKED_STATUS, approvalScrollLimit, buildTuiFrame, modelPickerPageSize, formatJobElapsed, formatTodoProgress, pickThinkingFallbackPhrase, renderTranscriptEntryLines, THINKING_FALLBACK_PHRASES, userInputViewportForFrame, } from './tui/build-frame.js';
8
8
  import { createAttentionController, INITIAL_TERMINAL_FOCUS, } from './tui/attention.js';
9
9
  import { backendFor, createNotificationQueue, } from './tui/desktop-notification.js';
10
10
  import { readPreferences, writePreferences } from '../preferences.js';
@@ -3400,6 +3400,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
3400
3400
  return decision;
3401
3401
  };
3402
3402
  const shellInputHandlers = {
3403
+ getModelPickerPageSize: () => modelPickerPageSize(store.getState(), terminalCols, terminalRows),
3403
3404
  getApprovalScrollLimit: () => {
3404
3405
  const contentWidth = frameContentWidth(terminalCols);
3405
3406
  return approvalScrollLimit(store.getState().approvalPrompt, contentWidth, terminalRows);
@@ -1,3 +1,4 @@
1
+ import { modelPickerWindow, modelPickerScrollLabel } from './model-picker-window.js';
1
2
  import { fitModelLabel } from './model-label.js';
2
3
  import { projectModelEffort } from '../../project-model-preferences.js';
3
4
  import { REASONING_EFFORTS, REASONING_EFFORT_LABELS, REASONING_EFFORT_DESCRIPTIONS } from '../../reasoning-effort.js';
@@ -862,8 +863,9 @@ function pickerTopBorder(panelWidth, fullTitle, compactTitle) {
862
863
  const right = available - left;
863
864
  return line(span(`╭${'─'.repeat(left)}`, { color: MODEL_PICKER_BORDER_COLOR }), span(title, { color: MODEL_PICKER_ACCENT_COLOR, bold: true }), span(`${'─'.repeat(right)}╮`, { color: MODEL_PICKER_BORDER_COLOR }));
864
865
  }
865
- function modelPickerDivider(panelWidth) {
866
- return plainLine(`├${'─'.repeat(panelWidth - 2)}┤`, {
866
+ function modelPickerDivider(panelWidth, scrollLabel = '') {
867
+ const label = scrollLabel ? ` ${fitLine(scrollLabel, panelWidth - 4)} ` : '';
868
+ return plainLine(`├${label}${'─'.repeat(Math.max(0, panelWidth - 2 - displayWidth(label)))}┤`, {
867
869
  color: MODEL_PICKER_BORDER_COLOR,
868
870
  });
869
871
  }
@@ -955,16 +957,32 @@ function modelPickerDisplayRows(options, pausedCount, innerWidth) {
955
957
  }
956
958
  return rows;
957
959
  }
958
- function buildModelPickerPanel(options, selectedIndex, width, availableHeight, efforts = {}, pausedCount = 0) {
959
- const panelWidth = Math.max(28, Math.min(width, MODEL_PICKER_PANEL_MAX_WIDTH));
960
- const innerWidth = Math.max(1, panelWidth - 4);
960
+ function modelPickerLayout(options, selectedIndex, innerWidth, availableHeight, pausedCount) {
961
961
  const rows = modelPickerDisplayRows(options, pausedCount, innerWidth);
962
962
  const showEffortDetails = rows.length + 8 <= availableHeight;
963
963
  const fixedLineCount = showEffortDetails ? 8 : 5;
964
- const visibleCount = Math.min(rows.length, Math.max(1, availableHeight - fixedLineCount));
965
964
  const selectedRow = Math.max(0, rows.findIndex((row) => row.kind === 'option' && row.index === selectedIndex));
966
- const firstVisible = Math.max(0, Math.min(selectedRow - visibleCount + 1, rows.length - visibleCount));
967
- const visibleRows = rows.slice(firstVisible, firstVisible + visibleCount);
965
+ const window = modelPickerWindow(rows.length, selectedRow, availableHeight - fixedLineCount);
966
+ const visibleRows = rows.slice(window.start, window.end);
967
+ return {
968
+ showEffortDetails,
969
+ fixedLineCount,
970
+ visibleRows,
971
+ above: rows.slice(0, window.start).filter((row) => row.kind === 'option').length,
972
+ below: rows.slice(window.end).filter((row) => row.kind === 'option').length,
973
+ };
974
+ }
975
+ export function modelPickerPageSize(state, cols, rows) {
976
+ const options = buildModelPickerOptions(state.currentModelId, state.serverModels);
977
+ const panelWidth = Math.max(28, Math.min(frameContentWidth(cols), MODEL_PICKER_PANEL_MAX_WIDTH));
978
+ const layout = modelPickerLayout(options, state.modelPickerIndex, panelWidth - 4, rows, pausedModelCount(state.serverModels));
979
+ return Math.max(1, layout.visibleRows.filter((row) => row.kind === 'option').length);
980
+ }
981
+ function buildModelPickerPanel(options, selectedIndex, width, availableHeight, efforts = {}, pausedCount = 0) {
982
+ const panelWidth = Math.max(28, Math.min(width, MODEL_PICKER_PANEL_MAX_WIDTH));
983
+ const innerWidth = Math.max(1, panelWidth - 4);
984
+ const { showEffortDetails, fixedLineCount, visibleRows, above, below } = modelPickerLayout(options, selectedIndex, innerWidth, availableHeight, pausedCount);
985
+ const scrolling = above > 0 || below > 0;
968
986
  const bodyLineCount = visibleRows.length + fixedLineCount;
969
987
  const marginLineCount = Math.max(0, Math.min(MODEL_PICKER_PANEL_MARGIN_LINES, Math.floor((availableHeight - bodyLineCount) / 2)));
970
988
  const margin = Array.from({ length: marginLineCount }, () => plainLine(''));
@@ -1003,8 +1021,14 @@ function buildModelPickerPanel(options, selectedIndex, width, availableHeight, e
1003
1021
  ? '↑/↓ model • Enter select • Esc cancel'
1004
1022
  : '↑/↓ model • ←/→ effort • Enter select/save • Esc cancel';
1005
1023
  const compactHint = autoSelected ? '↑↓ · Enter · Esc' : '↑↓ · ←→ · Enter · Esc';
1006
- const hint = [...fullHint].length <= innerWidth ? fullHint : compactHint;
1007
- body.push(modelPickerDivider(panelWidth), lockedSelection
1024
+ const navigationHint = scrolling
1025
+ ? fullHint.replace('↑/↓ model', '↑/↓ scroll • PgUp/PgDn page • Home/End')
1026
+ : fullHint;
1027
+ const compactNavigationHint = scrolling
1028
+ ? innerWidth >= 39 ? '↑↓ PgUp/PgDn Home/End · ←→ · Enter · Esc' : '↑↓ PgUp/PgDn Enter Esc'
1029
+ : compactHint;
1030
+ const hint = [...navigationHint].length <= innerWidth ? navigationHint : compactNavigationHint;
1031
+ body.push(modelPickerDivider(panelWidth, scrolling ? modelPickerScrollLabel(above, below, innerWidth) : ''), lockedSelection
1008
1032
  ? modelPickerPanelSideLine(plainLine(fitLine(showEffortDetails ? (lockedLines[0] ?? '') : lockedSelection.note, innerWidth), { color: 'yellow', bold: true }), innerWidth)
1009
1033
  : modelPickerPanelSideLine(plainLine(fitLine(effortText, innerWidth), { color: 'cyan', bold: true }), innerWidth), ...(showEffortDetails ? [
1010
1034
  modelPickerPanelSideLine(plainLine(''), innerWidth),
@@ -0,0 +1,9 @@
1
+ export function modelPickerWindow(rowCount, selectedRow, capacity) {
2
+ const count = Math.min(rowCount, Math.max(1, capacity));
3
+ const start = Math.max(0, Math.min(selectedRow - Math.floor(count / 2), rowCount - count));
4
+ return { start, end: start + count };
5
+ }
6
+ export function modelPickerScrollLabel(above, below, width) {
7
+ const full = `↑ ${above} more above • ↓ ${below} more below`;
8
+ return full.length <= width ? full : `↑ ${above} above · ↓ ${below} below`;
9
+ }
@@ -322,7 +322,7 @@ export function handleShellKeyEvent(store, handlers, event) {
322
322
  if (state.exiting) {
323
323
  return;
324
324
  }
325
- if (key.pageUp || key.pageDown) {
325
+ if (!state.modelPickerOpen && (key.pageUp || key.pageDown)) {
326
326
  scrollTranscript(store, handlers, key.pageUp ? 8 : -8);
327
327
  return;
328
328
  }
@@ -364,13 +364,20 @@ export function handleShellKeyEvent(store, handlers, event) {
364
364
  store.update((current) => ({ ...current, modelPickerOpen: false }));
365
365
  return;
366
366
  }
367
- if (key.upArrow || key.downArrow) {
367
+ if (key.upArrow || key.downArrow || key.pageUp || key.pageDown || key.home || key.end) {
368
368
  store.update((current) => {
369
369
  const options = buildModelPickerOptions(Number(current.currentModelId ?? 0), current.serverModels ?? []);
370
- return {
371
- ...current,
372
- modelPickerIndex: getNextModelPickerIndex(options, current.modelPickerIndex, key.upArrow ? -1 : 1),
373
- };
370
+ const direction = key.upArrow || key.pageUp || key.home ? -1 : 1;
371
+ const steps = key.home || key.end ? options.length
372
+ : key.pageUp || key.pageDown ? Math.max(1, handlers.getModelPickerPageSize?.() ?? 1) : 1;
373
+ let index = current.modelPickerIndex;
374
+ for (let step = 0; step < steps; step++) {
375
+ const next = getNextModelPickerIndex(options, index, direction);
376
+ if (!(key.upArrow || key.downArrow) && (direction < 0 ? next > index : next < index))
377
+ break;
378
+ index = next;
379
+ }
380
+ return { ...current, modelPickerIndex: index };
374
381
  });
375
382
  return;
376
383
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegitai/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
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.2",
49
- "@thegitai/tui-darwin-x64": "1.0.2",
50
- "@thegitai/tui-linux-arm64": "1.0.2",
51
- "@thegitai/tui-linux-x64": "1.0.2",
52
- "@thegitai/tui-win32-x64": "1.0.2",
48
+ "@thegitai/tui-darwin-arm64": "1.0.4",
49
+ "@thegitai/tui-darwin-x64": "1.0.4",
50
+ "@thegitai/tui-linux-arm64": "1.0.4",
51
+ "@thegitai/tui-linux-x64": "1.0.4",
52
+ "@thegitai/tui-win32-x64": "1.0.4",
53
53
  "@vscode/ripgrep": "1.18.0"
54
54
  },
55
55
  "repository": {