@thegitai/cli 1.0.0-preview.67 → 1.0.0-preview.68
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/LICENSE +1 -1
- package/README.md +79 -31
- package/dist/bin/ai.js +1 -1
- package/dist/src/agent-mode.js +1 -0
- package/dist/src/api/browser-login.js +1 -1
- package/dist/src/api/chat.js +2 -0
- package/dist/src/core/clipboard.js +1 -1
- package/dist/src/executor.js +1 -1
- package/dist/src/help-text.js +50 -44
- package/dist/src/patcher.js +3 -0
- package/dist/src/signin.js +1 -1
- package/dist/src/skills/discovery.js +280 -0
- package/dist/src/skills/frontmatter.js +192 -0
- package/dist/src/skills/install.js +394 -0
- package/dist/src/skills/types.js +43 -0
- package/dist/src/skills-command.js +71 -0
- package/dist/src/tools/index.js +2 -0
- package/dist/src/tools/read-file.js +2 -1
- package/dist/src/tools/shell-diagnostics.js +1 -1
- package/dist/src/tools/use-skill.js +38 -0
- package/dist/src/ui/repl.js +147 -13
- package/dist/src/ui/slash-commands.js +19 -1
- package/dist/src/ui/tui/build-frame.js +72 -13
- package/dist/src/ui/tui/shell-input.js +33 -1
- package/dist/src/ui/tui/shortcuts.js +3 -3
- package/dist/src/update-check.js +2 -2
- package/package.json +6 -6
package/dist/src/ui/repl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { sessionMcp } from '../mcp-client.js';
|
|
2
2
|
import { projectModelEffort, readProjectModelEfforts, saveProjectModelEffort } from '../project-model-preferences.js';
|
|
3
3
|
import { REASONING_EFFORT_LABELS } from '../reasoning-effort.js';
|
|
4
|
-
import { basename } from 'node:path';
|
|
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
7
|
import { AGENT_MODE_LOCKED_STATUS, approvalScrollLimit, buildTuiFrame, formatJobElapsed, formatTodoProgress, pickThinkingFallbackPhrase, renderTranscriptEntryLines, THINKING_FALLBACK_PHRASES, userInputViewportForFrame, } from './tui/build-frame.js';
|
|
@@ -10,7 +10,11 @@ import { backendFor, createNotificationQueue, } from './tui/desktop-notification
|
|
|
10
10
|
import { readPreferences, writePreferences } from '../preferences.js';
|
|
11
11
|
import { createTerminalTitleController } from './tui/terminal-title.js';
|
|
12
12
|
import { captureTerminalWrites, releaseTerminalWrites, } from './tui/terminal-writes.js';
|
|
13
|
-
import { getInputCommandToken, getSlashCommandSuggestions, SLASH_COMMANDS, slashCommandMatchesToken, } from './slash-commands.js';
|
|
13
|
+
import { getInputCommandToken, getSlashCommandSuggestions, isSkillSlashCommand, setSkillSlashCommands, SLASH_COMMANDS, slashCommandMatchesToken, } from './slash-commands.js';
|
|
14
|
+
import { buildSkillsPickerItems, SKILLS_ADD_USAGE } from '../skills-command.js';
|
|
15
|
+
import { discoverSkills, personalSkillsRoot, projectSkillsRoot, skillCatalogue, } from '../skills/discovery.js';
|
|
16
|
+
import { installPreparedSkill, parseSkillSource, prepareSkillInstall, preparedSkillHasScripts, } from '../skills/install.js';
|
|
17
|
+
import { BUNDLED_SKILLS } from '../skills/types.js';
|
|
14
18
|
export { getInputCommandToken, getSlashCommandSuggestions, SLASH_COMMANDS, slashCommandMatchesToken, };
|
|
15
19
|
import { composerInputWidth, frameContentWidth } from './tui/composer-layout.js';
|
|
16
20
|
import { agentModeLabel, nextAgentMode, } from '../agent-mode.js';
|
|
@@ -746,6 +750,14 @@ export function buildWorkingToolEntry(event, label = event.call.name) {
|
|
|
746
750
|
title: call.name === 'shell_job_kill' ? 'Kill job' : 'Job output',
|
|
747
751
|
};
|
|
748
752
|
}
|
|
753
|
+
if (call.name === 'use_skill') {
|
|
754
|
+
const name = String(result?.name ?? call.args?.name ?? '').trim().replace(/^\//, '');
|
|
755
|
+
return {
|
|
756
|
+
body: `/${name || 'skill'}${state(result?.alreadyLoaded === true ? ' · already loaded' : ' · loaded')}`,
|
|
757
|
+
kind,
|
|
758
|
+
title: 'Skill',
|
|
759
|
+
};
|
|
760
|
+
}
|
|
749
761
|
if (call.name === 'run_node_script') {
|
|
750
762
|
return {
|
|
751
763
|
body: `node --input-type=module <script via stdin>${state(`\n${formatRunCommandResultState(result)}`)}${error}`,
|
|
@@ -1074,6 +1086,9 @@ function createInitialShellState(session, serverModels, debugUi, serverUrl) {
|
|
|
1074
1086
|
modelPickerIndex: getDefaultModelPickerIndex(session.modelId, serverModels.models),
|
|
1075
1087
|
modelPickerOpen: false,
|
|
1076
1088
|
shortcutsOpen: false,
|
|
1089
|
+
skillsPickerIndex: 0,
|
|
1090
|
+
skillsPickerItems: [],
|
|
1091
|
+
skillsPickerOpen: false,
|
|
1077
1092
|
transientStatus: null,
|
|
1078
1093
|
projectRoot: session.rootDir,
|
|
1079
1094
|
sessionId: session.sessionId,
|
|
@@ -1234,15 +1249,17 @@ export function shouldRemountLiveFrameForComposerInputChange(current, nextInput)
|
|
|
1234
1249
|
}
|
|
1235
1250
|
export function applySlashCommandSuggestion(currentInput, suggestion) {
|
|
1236
1251
|
const token = getInputCommandToken(currentInput);
|
|
1252
|
+
const command = isSkillSlashCommand(suggestion) ? `${suggestion.command} ` : suggestion.command;
|
|
1237
1253
|
if (!token) {
|
|
1238
|
-
return { cursor:
|
|
1254
|
+
return { cursor: command.length, input: command };
|
|
1239
1255
|
}
|
|
1240
1256
|
const tokenStart = currentInput.indexOf(token);
|
|
1241
1257
|
const before = currentInput.slice(0, tokenStart);
|
|
1242
1258
|
const after = currentInput.slice(tokenStart + token.length);
|
|
1259
|
+
const inserted = after.startsWith(' ') ? suggestion.command : command;
|
|
1243
1260
|
return {
|
|
1244
|
-
cursor: before.length +
|
|
1245
|
-
input: `${before}${
|
|
1261
|
+
cursor: before.length + inserted.length,
|
|
1262
|
+
input: `${before}${inserted}${after}`,
|
|
1246
1263
|
};
|
|
1247
1264
|
}
|
|
1248
1265
|
export function insertAtCursor(state, text) {
|
|
@@ -1563,7 +1580,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
1563
1580
|
title: projectLabel,
|
|
1564
1581
|
body: kind === 'blocked'
|
|
1565
1582
|
? 'Waiting for your answer'
|
|
1566
|
-
: 'Finished
|
|
1583
|
+
: 'Finished - your turn',
|
|
1567
1584
|
}, notificationHandle);
|
|
1568
1585
|
});
|
|
1569
1586
|
},
|
|
@@ -2190,7 +2207,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2190
2207
|
body: `${dropped}${buffered.output || '(no output captured)'}`,
|
|
2191
2208
|
kind: 'system',
|
|
2192
2209
|
preformatted: true,
|
|
2193
|
-
title: `${job.id} output
|
|
2210
|
+
title: `${job.id} output - ${truncate(job.command, 80)}`,
|
|
2194
2211
|
});
|
|
2195
2212
|
};
|
|
2196
2213
|
const selectedJobsPickerId = () => {
|
|
@@ -2379,7 +2396,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2379
2396
|
...(fellBack
|
|
2380
2397
|
? [
|
|
2381
2398
|
{
|
|
2382
|
-
body: `This session's model is no longer available
|
|
2399
|
+
body: `This session's model is no longer available - switched to ${formatModelLabel(resolvedModelId, knownModels.models)}. Conversation history preserved.`,
|
|
2383
2400
|
kind: 'system',
|
|
2384
2401
|
title: 'Model',
|
|
2385
2402
|
},
|
|
@@ -2435,8 +2452,8 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2435
2452
|
upsertTurnMessage(row, {
|
|
2436
2453
|
state: 'queued',
|
|
2437
2454
|
note: autoSubmits
|
|
2438
|
-
? 'not read
|
|
2439
|
-
: 'not read
|
|
2455
|
+
? 'not read - sending as the next prompt'
|
|
2456
|
+
: 'not read - left in the composer',
|
|
2440
2457
|
});
|
|
2441
2458
|
}
|
|
2442
2459
|
const existing = store.getState().queuedMessage;
|
|
@@ -2533,14 +2550,125 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2533
2550
|
});
|
|
2534
2551
|
}
|
|
2535
2552
|
catch (error) {
|
|
2536
|
-
rollback(`not sent
|
|
2553
|
+
rollback(`not sent - ${error?.message ?? 'request failed'}`);
|
|
2537
2554
|
return;
|
|
2538
2555
|
}
|
|
2539
2556
|
if (outcome === 'stale') {
|
|
2540
|
-
rollback('turn ended
|
|
2557
|
+
rollback('turn ended - sending as the next prompt');
|
|
2541
2558
|
}
|
|
2542
2559
|
};
|
|
2543
2560
|
const jobWait = createJobWaitTracker(() => session.sessionId);
|
|
2561
|
+
const refreshSkillCommands = () => {
|
|
2562
|
+
try {
|
|
2563
|
+
const local = skillCatalogue(discoverSkills(session.rootDir, session.env));
|
|
2564
|
+
const names = new Set(local.map((skill) => skill.name));
|
|
2565
|
+
setSkillSlashCommands([
|
|
2566
|
+
...local,
|
|
2567
|
+
...BUNDLED_SKILLS.filter((skill) => !names.has(skill.name)),
|
|
2568
|
+
]);
|
|
2569
|
+
}
|
|
2570
|
+
catch {
|
|
2571
|
+
setSkillSlashCommands([]);
|
|
2572
|
+
}
|
|
2573
|
+
};
|
|
2574
|
+
const runSkillsCommand = async (args) => {
|
|
2575
|
+
const builtinCommands = SLASH_COMMANDS.flatMap((option) => [
|
|
2576
|
+
option.command,
|
|
2577
|
+
...(option.aliases ?? []),
|
|
2578
|
+
]);
|
|
2579
|
+
if (!args || args === 'list') {
|
|
2580
|
+
refreshSkillCommands();
|
|
2581
|
+
store.update((current) => ({
|
|
2582
|
+
...current,
|
|
2583
|
+
commandCursor: 0,
|
|
2584
|
+
skillsPickerIndex: 0,
|
|
2585
|
+
skillsPickerItems: buildSkillsPickerItems(session.rootDir, session.env, builtinCommands),
|
|
2586
|
+
skillsPickerOpen: true,
|
|
2587
|
+
}));
|
|
2588
|
+
scheduleLiveFrameRemount();
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
const addMatch = args.match(/^add(?:\s+([\s\S]*))?$/);
|
|
2592
|
+
const project = /(^|\s)--project(\s|$)/.test(args);
|
|
2593
|
+
const sourceText = String(addMatch?.[1] ?? '')
|
|
2594
|
+
.replace(/(^|\s)--project(?=\s|$)/g, ' ')
|
|
2595
|
+
.trim();
|
|
2596
|
+
const source = addMatch && sourceText ? parseSkillSource(sourceText, session.rootDir) : null;
|
|
2597
|
+
if (!source) {
|
|
2598
|
+
appendStaticEntry({
|
|
2599
|
+
body: `Usage: /skills to list skills, or ${SKILLS_ADD_USAGE}`,
|
|
2600
|
+
kind: 'system',
|
|
2601
|
+
title: 'Skills',
|
|
2602
|
+
});
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
const controller = new AbortController();
|
|
2606
|
+
activeTurnAbort = controller;
|
|
2607
|
+
store.update((current) => ({
|
|
2608
|
+
...current,
|
|
2609
|
+
busy: true,
|
|
2610
|
+
status: 'Fetching skill...',
|
|
2611
|
+
activeTurnInput: `/skills add ${sourceText}`,
|
|
2612
|
+
}));
|
|
2613
|
+
try {
|
|
2614
|
+
const prepared = await prepareSkillInstall(source, session.env, globalThis.fetch, controller.signal);
|
|
2615
|
+
if (!prepared.ok) {
|
|
2616
|
+
appendStaticEntry({
|
|
2617
|
+
body: controller.signal.aborted ? 'Skill install cancelled.' : prepared.error,
|
|
2618
|
+
kind: 'system',
|
|
2619
|
+
title: 'Skills',
|
|
2620
|
+
});
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
const skill = prepared.skill;
|
|
2624
|
+
const targetRoot = project
|
|
2625
|
+
? projectSkillsRoot(session.rootDir)
|
|
2626
|
+
: personalSkillsRoot(session.env);
|
|
2627
|
+
const destination = joinPath(targetRoot, skill.name);
|
|
2628
|
+
const files = skill.files.map((file) => file.relPath);
|
|
2629
|
+
const shownFiles = files.slice(0, 12).join(', ') + (files.length > 12 ? `, and ${files.length - 12} more` : '');
|
|
2630
|
+
const decision = await openApprovalPrompt({
|
|
2631
|
+
bucket: 'create',
|
|
2632
|
+
title: `Install skill /${skill.name}?`,
|
|
2633
|
+
body: [
|
|
2634
|
+
skill.description,
|
|
2635
|
+
'',
|
|
2636
|
+
`From: ${skill.origin}`,
|
|
2637
|
+
`To: ${destination}`,
|
|
2638
|
+
`Files (${files.length}): ${shownFiles}`,
|
|
2639
|
+
...(preparedSkillHasScripts(skill)
|
|
2640
|
+
? ['', 'It includes scripts. Nothing runs now, and the agent still asks before running any command.']
|
|
2641
|
+
: []),
|
|
2642
|
+
].join('\n'),
|
|
2643
|
+
options: [
|
|
2644
|
+
{ label: 'Install', decision: { kind: 'once' } },
|
|
2645
|
+
{ label: 'Cancel', decision: { kind: 'deny' } },
|
|
2646
|
+
],
|
|
2647
|
+
}, controller.signal);
|
|
2648
|
+
if (decision.kind === 'deny') {
|
|
2649
|
+
appendStaticEntry({ body: 'Skill not installed.', kind: 'system', title: 'Skills' });
|
|
2650
|
+
return;
|
|
2651
|
+
}
|
|
2652
|
+
const installed = installPreparedSkill(skill, targetRoot);
|
|
2653
|
+
if (!installed.ok) {
|
|
2654
|
+
appendStaticEntry({ body: installed.error, kind: 'system', title: 'Skills' });
|
|
2655
|
+
return;
|
|
2656
|
+
}
|
|
2657
|
+
refreshSkillCommands();
|
|
2658
|
+
appendStaticEntry({
|
|
2659
|
+
body: `Installed /${skill.name} in ${installed.dir}.\nThe agent can use it from your next message, or run it yourself with /${skill.name}.`,
|
|
2660
|
+
kind: 'system',
|
|
2661
|
+
title: 'Skills',
|
|
2662
|
+
});
|
|
2663
|
+
}
|
|
2664
|
+
finally {
|
|
2665
|
+
if (activeTurnAbort === controller)
|
|
2666
|
+
activeTurnAbort = null;
|
|
2667
|
+
store.update((current) => ({ ...current, busy: false, activeTurnInput: '', status: '' }));
|
|
2668
|
+
await remountTui();
|
|
2669
|
+
await flushQueuedMessage();
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2544
2672
|
const handleSubmit = async (rawInput, { jobFollowUp = false } = {}) => {
|
|
2545
2673
|
const chunks = jobFollowUp ? [] : store.getState().pastedChunks;
|
|
2546
2674
|
const expanded = chunks.length
|
|
@@ -2548,6 +2676,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2548
2676
|
: String(rawInput ?? '');
|
|
2549
2677
|
const input = expanded.trim();
|
|
2550
2678
|
const preformatted = chunks.length > 0;
|
|
2679
|
+
refreshSkillCommands();
|
|
2551
2680
|
if (store.getState().busy) {
|
|
2552
2681
|
if (!input || exiting)
|
|
2553
2682
|
return;
|
|
@@ -2640,6 +2769,10 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2640
2769
|
requestExit();
|
|
2641
2770
|
return;
|
|
2642
2771
|
}
|
|
2772
|
+
if (input === '/skills' || input.startsWith('/skills ')) {
|
|
2773
|
+
await runSkillsCommand(input.slice('/skills'.length).trim());
|
|
2774
|
+
return;
|
|
2775
|
+
}
|
|
2643
2776
|
if (input === '/mcp') {
|
|
2644
2777
|
const connections = sessionMcp(session);
|
|
2645
2778
|
const controller = new AbortController();
|
|
@@ -2719,7 +2852,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
2719
2852
|
return;
|
|
2720
2853
|
}
|
|
2721
2854
|
appendStaticEntry({
|
|
2722
|
-
body: 'Usage: /jobs
|
|
2855
|
+
body: 'Usage: /jobs - open the jobs picker · /jobs output <id> - full output · /jobs kill <id> - kill one',
|
|
2723
2856
|
kind: 'system',
|
|
2724
2857
|
title: 'Background jobs',
|
|
2725
2858
|
});
|
|
@@ -3226,6 +3359,7 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
|
|
|
3226
3359
|
scheduleJobFollowUp();
|
|
3227
3360
|
}
|
|
3228
3361
|
});
|
|
3362
|
+
refreshSkillCommands();
|
|
3229
3363
|
session.requestSudoPassword = async ({ command, prompt, signal }) => openSudoPasswordPrompt(command, prompt, signal);
|
|
3230
3364
|
session.requestUserInput = async (request, signal) => openUserInputPrompt(request.questions, signal);
|
|
3231
3365
|
session.requestPermission = async (request) => {
|
|
@@ -8,6 +8,7 @@ export const SLASH_COMMANDS = [
|
|
|
8
8
|
},
|
|
9
9
|
{ command: '/new', description: 'start a new conversation; this session remains saved' },
|
|
10
10
|
{ command: '/mcp', description: 'Check MCP connections and available tools' },
|
|
11
|
+
{ command: '/skills', description: 'List installed skills, or add one: /skills add <source>' },
|
|
11
12
|
{ command: '/jobs', description: 'Background jobs: pick to view output or kill' },
|
|
12
13
|
{
|
|
13
14
|
command: '/notify',
|
|
@@ -19,6 +20,23 @@ export const SLASH_COMMANDS = [
|
|
|
19
20
|
{ command: '/exit', description: 'Quit the current session', aliases: ['/quit'] },
|
|
20
21
|
];
|
|
21
22
|
export const SLASH_COMMAND_SUGGESTION_LIMIT = 5;
|
|
23
|
+
let skillCommands = [];
|
|
24
|
+
export function setSkillSlashCommands(skills) {
|
|
25
|
+
const builtins = new Set(SLASH_COMMANDS.flatMap((option) => [option.command, ...(option.aliases ?? [])]));
|
|
26
|
+
skillCommands = skills
|
|
27
|
+
.filter((skill) => !builtins.has(`/${skill.name}`))
|
|
28
|
+
.map((skill) => ({
|
|
29
|
+
command: `/${skill.name}`,
|
|
30
|
+
description: skill.argumentHint ? `${skill.argumentHint} · ${skill.description}` : skill.description,
|
|
31
|
+
skill: true,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
export function isSkillSlashCommand(option) {
|
|
35
|
+
return option.skill === true;
|
|
36
|
+
}
|
|
37
|
+
function allSlashCommands() {
|
|
38
|
+
return skillCommands.length ? [...SLASH_COMMANDS, ...skillCommands] : SLASH_COMMANDS;
|
|
39
|
+
}
|
|
22
40
|
export function getInputCommandToken(input) {
|
|
23
41
|
const trimmed = String(input ?? '').trimStart();
|
|
24
42
|
const match = trimmed.match(/^\/[^\s]*/);
|
|
@@ -105,7 +123,7 @@ function rankSlashCommands(input) {
|
|
|
105
123
|
const token = getInputCommandToken(input).toLowerCase();
|
|
106
124
|
if (!token)
|
|
107
125
|
return [];
|
|
108
|
-
return
|
|
126
|
+
return allSlashCommands().map((option, order) => ({
|
|
109
127
|
option,
|
|
110
128
|
order,
|
|
111
129
|
score: scoreSlashCommand(option, token),
|
|
@@ -9,6 +9,7 @@ import { renderFormattedBodyLines, renderPreformattedBodyLines, } from './markdo
|
|
|
9
9
|
import { displayWidth, line, padToWidth, plainLine, sliceToWidth, span, wrapText, } from './text.js';
|
|
10
10
|
import { isDarkTerminalBackground, mutedColor, mutedStyle } from './terminal-theme.js';
|
|
11
11
|
import { buildShortcutGroups, shortcutsPanelAvailable, } from './shortcuts.js';
|
|
12
|
+
import { SKILLS_PICKER_ADD_HINT, SKILLS_PICKER_GROUP_TITLES, } from '../../skills-command.js';
|
|
12
13
|
import { buildUserInputOverlayLines, } from './user-input.js';
|
|
13
14
|
import { composerPromptLabel, frameContentWidth, splitComposerInput, } from './composer-layout.js';
|
|
14
15
|
const WORKING_CLOCK_ICON = '◷';
|
|
@@ -26,7 +27,7 @@ const APPROVAL_PADDING_MIN_ROWS = 30;
|
|
|
26
27
|
const APPROVAL_SCROLLBAR_COLUMNS = 2;
|
|
27
28
|
const APPROVAL_ACCENT_COLOR = 'cyan';
|
|
28
29
|
const SUDO_PASSWORD_ASSURANCE = 'The model never sees this. Your password goes straight to sudo on this ' +
|
|
29
|
-
'computer, then is discarded
|
|
30
|
+
'computer, then is discarded - never sent to our servers, saved, or logged.';
|
|
30
31
|
const SUDO_ASSURANCE_COLOR = 'ansi256(248)';
|
|
31
32
|
const APPROVAL_SCROLL_STATUS_COLOR = 'ansi256(248)';
|
|
32
33
|
const APPROVAL_SCROLLBAR_THUMB = '█';
|
|
@@ -852,8 +853,9 @@ const MODEL_PICKER_MODEL_MAX_WIDTH = 54;
|
|
|
852
853
|
const MODEL_PICKER_COLUMN_GAP = ' ';
|
|
853
854
|
const MODEL_PICKER_WIDE_MIN_WIDTH = 78;
|
|
854
855
|
function modelPickerTopBorder(panelWidth) {
|
|
855
|
-
|
|
856
|
-
|
|
856
|
+
return pickerTopBorder(panelWidth, ' TheGitAI - Model Selection ', ' Model Selection ');
|
|
857
|
+
}
|
|
858
|
+
function pickerTopBorder(panelWidth, fullTitle, compactTitle) {
|
|
857
859
|
const title = panelWidth >= fullTitle.length + 4 ? fullTitle : compactTitle;
|
|
858
860
|
const available = Math.max(0, panelWidth - 2 - [...title].length);
|
|
859
861
|
const left = Math.floor(available / 2);
|
|
@@ -1013,16 +1015,68 @@ function buildModelPickerPanel(options, selectedIndex, width, availableHeight, e
|
|
|
1013
1015
|
] : []), modelPickerPanelSideLine(plainLine(fitLine(hint, innerWidth), { color: 'gray' }), innerWidth), plainLine(`╰${'─'.repeat(panelWidth - 2)}╯`, { color: MODEL_PICKER_BORDER_COLOR }));
|
|
1014
1016
|
return [...margin, ...body, ...margin];
|
|
1015
1017
|
}
|
|
1018
|
+
const SKILLS_PICKER_PANEL_MAX_WIDTH = 96;
|
|
1019
|
+
const SKILLS_PICKER_DESCRIPTION_LINES = 3;
|
|
1020
|
+
function skillsPickerDetailLines(item, innerWidth) {
|
|
1021
|
+
const wrapped = wrapText(item.description, innerWidth);
|
|
1022
|
+
const description = wrapped.length > SKILLS_PICKER_DESCRIPTION_LINES
|
|
1023
|
+
? [
|
|
1024
|
+
...wrapped.slice(0, SKILLS_PICKER_DESCRIPTION_LINES - 1),
|
|
1025
|
+
fitLine(wrapped.slice(SKILLS_PICKER_DESCRIPTION_LINES - 1).join(' '), innerWidth),
|
|
1026
|
+
]
|
|
1027
|
+
: wrapped;
|
|
1028
|
+
const descriptionStyle = item.group === 'not-loaded' ? { color: 'yellow', bold: true } : {};
|
|
1029
|
+
return [
|
|
1030
|
+
...description.map((text) => plainLine(text, descriptionStyle)),
|
|
1031
|
+
...(item.path ? [plainLine(fitLine(item.path, innerWidth), { color: 'gray' })] : []),
|
|
1032
|
+
...(item.notes.length ? [plainLine(fitLine(item.notes.join('; '), innerWidth), { color: 'gray' })] : []),
|
|
1033
|
+
];
|
|
1034
|
+
}
|
|
1035
|
+
export function buildSkillsPickerPanel(items, selectedIndex, width, availableHeight) {
|
|
1036
|
+
const panelWidth = Math.max(28, Math.min(width, SKILLS_PICKER_PANEL_MAX_WIDTH));
|
|
1037
|
+
const innerWidth = Math.max(1, panelWidth - 4);
|
|
1038
|
+
const side = (row) => modelPickerPanelSideLine(row, innerWidth);
|
|
1039
|
+
const rows = [];
|
|
1040
|
+
items.forEach((item, index) => {
|
|
1041
|
+
if (items[index - 1]?.group !== item.group) {
|
|
1042
|
+
rows.push({ kind: 'heading', title: SKILLS_PICKER_GROUP_TITLES[item.group] });
|
|
1043
|
+
}
|
|
1044
|
+
rows.push({ kind: 'item', index });
|
|
1045
|
+
});
|
|
1046
|
+
const detailHeight = Math.max(0, ...items.map((item) => skillsPickerDetailLines(item, innerWidth).length));
|
|
1047
|
+
const selected = items[selectedIndex];
|
|
1048
|
+
const detail = selected ? skillsPickerDetailLines(selected, innerWidth) : [];
|
|
1049
|
+
const addHint = wrapText(SKILLS_PICKER_ADD_HINT, innerWidth);
|
|
1050
|
+
const fullHint = '↑/↓ move • Enter use • Esc close';
|
|
1051
|
+
const hint = [...fullHint].length <= innerWidth ? fullHint : '↑↓ · Enter · Esc';
|
|
1052
|
+
const fixedLineCount = 4 + detailHeight + addHint.length + 1;
|
|
1053
|
+
const visibleCount = Math.min(rows.length, Math.max(1, availableHeight - fixedLineCount));
|
|
1054
|
+
const selectedRow = Math.max(0, rows.findIndex((row) => row.kind === 'item' && row.index === selectedIndex));
|
|
1055
|
+
const firstVisible = Math.max(0, Math.min(selectedRow - visibleCount + 1, rows.length - visibleCount));
|
|
1056
|
+
const body = [pickerTopBorder(panelWidth, ' TheGitAI - Skills ', ' Skills ')];
|
|
1057
|
+
for (const row of rows.slice(firstVisible, firstVisible + visibleCount)) {
|
|
1058
|
+
if (row.kind === 'heading') {
|
|
1059
|
+
body.push(side(modelPickerHeadingLine(row.title, innerWidth, false)));
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
const item = items[row.index];
|
|
1063
|
+
const isSelected = row.index === selectedIndex;
|
|
1064
|
+
const style = !item.usable
|
|
1065
|
+
? { color: MODEL_PICKER_LOCKED_COLOR }
|
|
1066
|
+
: isSelected
|
|
1067
|
+
? { color: 'cyan', bold: true }
|
|
1068
|
+
: {};
|
|
1069
|
+
body.push(side(plainLine(fitLine(`${isSelected ? '▶ ' : ' '}/${item.name}`, innerWidth), style)));
|
|
1070
|
+
}
|
|
1071
|
+
body.push(modelPickerDivider(panelWidth), ...detail.map(side), ...Array.from({ length: detailHeight - detail.length }, () => side(plainLine(''))), side(plainLine('')), ...addHint.map((text) => side(plainLine(text, { color: 'gray' }))), side(plainLine(fitLine(hint, innerWidth), { color: 'gray' })), plainLine(`╰${'─'.repeat(panelWidth - 2)}╯`, { color: MODEL_PICKER_BORDER_COLOR }));
|
|
1072
|
+
const marginLineCount = Math.max(0, Math.min(MODEL_PICKER_PANEL_MARGIN_LINES, Math.floor((availableHeight - body.length) / 2)));
|
|
1073
|
+
const margin = Array.from({ length: marginLineCount }, () => plainLine(''));
|
|
1074
|
+
return [...margin, ...body, ...margin];
|
|
1075
|
+
}
|
|
1016
1076
|
const SHORTCUTS_PANEL_MAX_WIDTH = 96;
|
|
1017
1077
|
const SHORTCUTS_KEY_COLUMN_MIN = 10;
|
|
1018
1078
|
function shortcutsTopBorder(panelWidth) {
|
|
1019
|
-
|
|
1020
|
-
const compactTitle = ' Shortcuts ';
|
|
1021
|
-
const title = panelWidth >= fullTitle.length + 4 ? fullTitle : compactTitle;
|
|
1022
|
-
const available = Math.max(0, panelWidth - 2 - [...title].length);
|
|
1023
|
-
const left = Math.floor(available / 2);
|
|
1024
|
-
const right = available - left;
|
|
1025
|
-
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 }));
|
|
1079
|
+
return pickerTopBorder(panelWidth, ' TheGitAI - Keyboard & mouse ', ' Shortcuts ');
|
|
1026
1080
|
}
|
|
1027
1081
|
export function buildShortcutsPanel(groups, width, availableHeight) {
|
|
1028
1082
|
const panelWidth = Math.max(28, Math.min(width, SHORTCUTS_PANEL_MAX_WIDTH));
|
|
@@ -1104,7 +1158,7 @@ function commandPaletteItemLines(option, selected, innerWidth) {
|
|
|
1104
1158
|
}),
|
|
1105
1159
|
], innerWidth);
|
|
1106
1160
|
const metaSpans = padSpansToInnerWidth([
|
|
1107
|
-
span(`${MODEL_PICKER_META_INDENT}${option.description}`, {
|
|
1161
|
+
span(fitLine(`${MODEL_PICKER_META_INDENT}${option.description}`, innerWidth), {
|
|
1108
1162
|
color: 'gray',
|
|
1109
1163
|
}),
|
|
1110
1164
|
], innerWidth);
|
|
@@ -1115,7 +1169,7 @@ function commandPaletteItemLines(option, selected, innerWidth) {
|
|
|
1115
1169
|
}
|
|
1116
1170
|
return [
|
|
1117
1171
|
modelPickerPanelSideLine(line(span(' ', { color: 'gray' }), span(option.command, { color: MODEL_PICKER_ACCENT_COLOR })), innerWidth),
|
|
1118
|
-
modelPickerPanelSideLine(line(span(`${MODEL_PICKER_META_INDENT}${option.description}`, { color: 'gray' })), innerWidth),
|
|
1172
|
+
modelPickerPanelSideLine(line(span(fitLine(`${MODEL_PICKER_META_INDENT}${option.description}`, innerWidth), { color: 'gray' })), innerWidth),
|
|
1119
1173
|
];
|
|
1120
1174
|
}
|
|
1121
1175
|
function buildCommandPalettePanel(suggestions, selectedIndex, hiddenCount, width) {
|
|
@@ -1324,6 +1378,9 @@ function buildOverlayLines(state, width, height, nowMs) {
|
|
|
1324
1378
|
if (state.shortcutsOpen) {
|
|
1325
1379
|
lines.push(...buildShortcutsPanel(buildShortcutGroups(), width, height));
|
|
1326
1380
|
}
|
|
1381
|
+
if (state.skillsPickerOpen) {
|
|
1382
|
+
lines.push(...buildSkillsPickerPanel(state.skillsPickerItems ?? [], state.skillsPickerIndex ?? 0, width, height));
|
|
1383
|
+
}
|
|
1327
1384
|
if (state.modelPickerOpen) {
|
|
1328
1385
|
const options = buildModelPickerOptions(state.currentModelId, state.serverModels);
|
|
1329
1386
|
lines.push(...buildModelPickerPanel(options, state.modelPickerIndex, width, height, state.modelPickerEfforts, pausedModelCount(state.serverModels)));
|
|
@@ -1388,6 +1445,7 @@ function buildOverlayLines(state, width, height, nowMs) {
|
|
|
1388
1445
|
if (!state.busy &&
|
|
1389
1446
|
!state.exiting &&
|
|
1390
1447
|
!state.modelPickerOpen &&
|
|
1448
|
+
!state.skillsPickerOpen &&
|
|
1391
1449
|
!state.resumePickerOpen &&
|
|
1392
1450
|
state.input.trimStart().startsWith('/') &&
|
|
1393
1451
|
!state.input.includes(' ') &&
|
|
@@ -1442,6 +1500,7 @@ export function buildTuiFrame(state, cols, rows, spinnerFrame, elapsedSeconds, n
|
|
|
1442
1500
|
!state.modelPickerOpen &&
|
|
1443
1501
|
!state.jobsPickerOpen &&
|
|
1444
1502
|
!state.shortcutsOpen &&
|
|
1503
|
+
!state.skillsPickerOpen &&
|
|
1445
1504
|
!overlayActive) {
|
|
1446
1505
|
const composerLines = [];
|
|
1447
1506
|
if (state.busy && state.status === 'Starting a new conversation...') {
|
|
@@ -1473,7 +1532,7 @@ export function buildTuiFrame(state, cols, rows, spinnerFrame, elapsedSeconds, n
|
|
|
1473
1532
|
}
|
|
1474
1533
|
const overlayHeight = state.userInputPrompt
|
|
1475
1534
|
? Math.max(0, rows - countSectionLines(sections))
|
|
1476
|
-
: state.jobsPickerOpen || state.shortcutsOpen || state.modelPickerOpen
|
|
1535
|
+
: state.jobsPickerOpen || state.shortcutsOpen || state.modelPickerOpen || state.skillsPickerOpen
|
|
1477
1536
|
? Math.max(Math.min(rows, JOBS_PICKER_MIN_ROWS), rows - countSectionLines(sections))
|
|
1478
1537
|
: rows;
|
|
1479
1538
|
const overlayLines = buildOverlayLines(state, contentWidth, overlayHeight, nowMs);
|
|
@@ -54,7 +54,8 @@ function shouldShowCommandPalette(state) {
|
|
|
54
54
|
state.exiting ||
|
|
55
55
|
state.jobsPickerOpen ||
|
|
56
56
|
state.modelPickerOpen ||
|
|
57
|
-
state.resumePickerOpen
|
|
57
|
+
state.resumePickerOpen ||
|
|
58
|
+
state.skillsPickerOpen) {
|
|
58
59
|
return false;
|
|
59
60
|
}
|
|
60
61
|
const token = getInputCommandToken(state.input);
|
|
@@ -103,6 +104,7 @@ function pasteTextFromClipboard(store, handlers) {
|
|
|
103
104
|
current.jobsPickerOpen ||
|
|
104
105
|
current.modelPickerOpen ||
|
|
105
106
|
current.resumePickerOpen ||
|
|
107
|
+
current.skillsPickerOpen ||
|
|
106
108
|
current.sudoPrompt) {
|
|
107
109
|
return;
|
|
108
110
|
}
|
|
@@ -437,6 +439,36 @@ export function handleShellKeyEvent(store, handlers, event) {
|
|
|
437
439
|
}
|
|
438
440
|
return;
|
|
439
441
|
}
|
|
442
|
+
if (state.skillsPickerOpen) {
|
|
443
|
+
if (key.escape) {
|
|
444
|
+
handlers.onLiveFrameShapeChange();
|
|
445
|
+
store.update((current) => ({ ...current, skillsPickerOpen: false }));
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
if (key.upArrow || key.downArrow) {
|
|
449
|
+
store.update((current) => {
|
|
450
|
+
const count = (current.skillsPickerItems ?? []).length;
|
|
451
|
+
const next = (current.skillsPickerIndex ?? 0) + (key.upArrow ? -1 : 1);
|
|
452
|
+
return { ...current, skillsPickerIndex: Math.max(0, Math.min(next, count - 1)) };
|
|
453
|
+
});
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
if (key.returnKey) {
|
|
457
|
+
const item = (state.skillsPickerItems ?? [])[state.skillsPickerIndex ?? 0];
|
|
458
|
+
if (!item?.usable)
|
|
459
|
+
return;
|
|
460
|
+
const input = `/${item.name} `;
|
|
461
|
+
handlers.onLiveFrameShapeChange();
|
|
462
|
+
store.update((current) => ({
|
|
463
|
+
...current,
|
|
464
|
+
commandCursor: 0,
|
|
465
|
+
cursor: input.length,
|
|
466
|
+
input,
|
|
467
|
+
skillsPickerOpen: false,
|
|
468
|
+
}));
|
|
469
|
+
}
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
440
472
|
if (state.shortcutsOpen) {
|
|
441
473
|
if (key.escape || key.returnKey || key.input === '?' || key.input === 'q') {
|
|
442
474
|
handlers.onLiveFrameShapeChange();
|
|
@@ -22,11 +22,11 @@ export function buildShortcutGroups(platform = process.platform) {
|
|
|
22
22
|
keys: 'Shift+Tab',
|
|
23
23
|
description: `Cycle ${agentModeCycleSequence()} (between turns)`,
|
|
24
24
|
},
|
|
25
|
-
{ keys: '/', description: 'Slash commands
|
|
25
|
+
{ keys: '/', description: 'Slash commands - /help lists them all' },
|
|
26
26
|
{ keys: '↑ / ↓', description: 'Earlier prompts' },
|
|
27
27
|
{ keys: 'Esc', description: 'Clear the composer' },
|
|
28
28
|
{ keys: 'Ctrl+C', description: 'Clear the composer, or quit when empty' },
|
|
29
|
-
{ keys: 'Ctrl+G', description: 'Desktop notifications
|
|
29
|
+
{ keys: 'Ctrl+G', description: 'Desktop notifications - toggle on or off' },
|
|
30
30
|
],
|
|
31
31
|
},
|
|
32
32
|
{
|
|
@@ -50,7 +50,7 @@ export function buildShortcutGroups(platform = process.platform) {
|
|
|
50
50
|
{
|
|
51
51
|
title: 'Transcript',
|
|
52
52
|
rows: [
|
|
53
|
-
{ keys: 'PageUp / PageDown', description: 'Scroll
|
|
53
|
+
{ keys: 'PageUp / PageDown', description: 'Scroll - the mouse wheel works too' },
|
|
54
54
|
{ keys: 'Drag', description: 'Select and copy' },
|
|
55
55
|
{ keys: 'Double-click', description: 'Copy a word' },
|
|
56
56
|
{ keys: 'Triple-click', description: 'Copy a whole row' },
|
package/dist/src/update-check.js
CHANGED
|
@@ -41,7 +41,7 @@ const UPDATE_KEY_HINT = '↑/↓ choose • Enter accepts • Ctrl+C quits';
|
|
|
41
41
|
function formatUpdateHeader(offer) {
|
|
42
42
|
return [
|
|
43
43
|
'',
|
|
44
|
-
` ${chalk.yellow('✨ Update available')}
|
|
44
|
+
` ${chalk.yellow('✨ Update available')} - ${chalk.dim(offer.currentVersion)} → ${chalk.bold(offer.latestVersion)}`,
|
|
45
45
|
'',
|
|
46
46
|
' TheGitAI works best with the latest version. TheGitAI may not work',
|
|
47
47
|
' optimally if not updated.',
|
|
@@ -183,7 +183,7 @@ export async function offerUpdateAtStartup({ currentVersion, latestVersion, ask
|
|
|
183
183
|
return 'cancelled';
|
|
184
184
|
}
|
|
185
185
|
if (answer === 'skip') {
|
|
186
|
-
write(`\n ${chalk.yellow(`Continuing on ${offer.currentVersion}
|
|
186
|
+
write(`\n ${chalk.yellow(`Continuing on ${offer.currentVersion} - you'll be asked again next time.`)}\n\n`);
|
|
187
187
|
return 'skipped';
|
|
188
188
|
}
|
|
189
189
|
write(`\n ${chalk.dim(`$ ${offer.display}`)}\n\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thegitai/cli",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.68",
|
|
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.
|
|
49
|
-
"@thegitai/tui-darwin-x64": "1.0.0-preview.
|
|
50
|
-
"@thegitai/tui-linux-arm64": "1.0.0-preview.
|
|
51
|
-
"@thegitai/tui-linux-x64": "1.0.0-preview.
|
|
52
|
-
"@thegitai/tui-win32-x64": "1.0.0-preview.
|
|
48
|
+
"@thegitai/tui-darwin-arm64": "1.0.0-preview.68",
|
|
49
|
+
"@thegitai/tui-darwin-x64": "1.0.0-preview.68",
|
|
50
|
+
"@thegitai/tui-linux-arm64": "1.0.0-preview.68",
|
|
51
|
+
"@thegitai/tui-linux-x64": "1.0.0-preview.68",
|
|
52
|
+
"@thegitai/tui-win32-x64": "1.0.0-preview.68",
|
|
53
53
|
"@vscode/ripgrep": "1.18.0"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|