claude-code-plus-plus 0.3.0 → 0.4.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.
- package/dist/constants.d.ts +6 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +7 -2
- package/dist/constants.js.map +1 -1
- package/dist/diff/diff-handler.d.ts +15 -0
- package/dist/diff/diff-handler.d.ts.map +1 -0
- package/dist/diff/diff-handler.js +235 -0
- package/dist/diff/diff-handler.js.map +1 -0
- package/dist/diff/diff-manager.d.ts +63 -0
- package/dist/diff/diff-manager.d.ts.map +1 -0
- package/dist/diff/diff-manager.js +271 -0
- package/dist/diff/diff-manager.js.map +1 -0
- package/dist/diff/diff-pane-render.d.ts +34 -0
- package/dist/diff/diff-pane-render.d.ts.map +1 -0
- package/dist/diff/diff-pane-render.js +222 -0
- package/dist/diff/diff-pane-render.js.map +1 -0
- package/dist/diff/file-diff-content-handler.d.ts +16 -0
- package/dist/diff/file-diff-content-handler.d.ts.map +1 -0
- package/dist/diff/file-diff-content-handler.js +142 -0
- package/dist/diff/file-diff-content-handler.js.map +1 -0
- package/dist/diff/file-diff-header-handler.d.ts +16 -0
- package/dist/diff/file-diff-header-handler.d.ts.map +1 -0
- package/dist/diff/file-diff-header-handler.js +191 -0
- package/dist/diff/file-diff-header-handler.js.map +1 -0
- package/dist/diff/file-diff-header-render.d.ts +30 -0
- package/dist/diff/file-diff-header-render.d.ts.map +1 -0
- package/dist/diff/file-diff-header-render.js +101 -0
- package/dist/diff/file-diff-header-render.js.map +1 -0
- package/dist/diff/file-diff-render.d.ts +27 -0
- package/dist/diff/file-diff-render.d.ts.map +1 -0
- package/dist/diff/file-diff-render.js +211 -0
- package/dist/diff/file-diff-render.js.map +1 -0
- package/dist/diff/git-diff.d.ts +54 -0
- package/dist/diff/git-diff.d.ts.map +1 -0
- package/dist/diff/git-diff.js +599 -0
- package/dist/diff/git-diff.js.map +1 -0
- package/dist/diff/index.d.ts +8 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +37 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/sidebar/app.d.ts +69 -0
- package/dist/sidebar/app.d.ts.map +1 -1
- package/dist/sidebar/app.js +508 -10
- package/dist/sidebar/app.js.map +1 -1
- package/dist/sidebar/commands.d.ts +1 -0
- package/dist/sidebar/commands.d.ts.map +1 -1
- package/dist/sidebar/commands.js +11 -0
- package/dist/sidebar/commands.js.map +1 -1
- package/dist/sidebar/pane-orchestrator.d.ts.map +1 -1
- package/dist/sidebar/pane-orchestrator.js +10 -1
- package/dist/sidebar/pane-orchestrator.js.map +1 -1
- package/dist/sidebar/render.d.ts.map +1 -1
- package/dist/sidebar/render.js +2 -1
- package/dist/sidebar/render.js.map +1 -1
- package/dist/tmux/index.d.ts +1 -1
- package/dist/tmux/index.d.ts.map +1 -1
- package/dist/tmux/index.js +2 -1
- package/dist/tmux/index.js.map +1 -1
- package/dist/tmux/pane.d.ts +5 -0
- package/dist/tmux/pane.d.ts.map +1 -1
- package/dist/tmux/pane.js +10 -0
- package/dist/tmux/pane.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* File Diff View Rendering
|
|
4
|
+
*
|
|
5
|
+
* Renders a full-screen colored diff view for a single file.
|
|
6
|
+
* Shows in the Claude pane area when viewing a file diff.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.renderFileDiffView = renderFileDiffView;
|
|
10
|
+
exports.getMaxScrollOffset = getMaxScrollOffset;
|
|
11
|
+
const ansi_1 = require("../ansi");
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// Helpers
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Parse diff content into colored lines
|
|
17
|
+
*/
|
|
18
|
+
function parseDiffLines(diffContent) {
|
|
19
|
+
const lines = diffContent.split('\n');
|
|
20
|
+
const coloredLines = [];
|
|
21
|
+
for (const line of lines) {
|
|
22
|
+
if (line.startsWith('+++') || line.startsWith('---')) {
|
|
23
|
+
// File header lines
|
|
24
|
+
coloredLines.push(`${ansi_1.ansi.bold}${ansi_1.ansi.fg.white}${line}${ansi_1.ansi.reset}`);
|
|
25
|
+
}
|
|
26
|
+
else if (line.startsWith('@@')) {
|
|
27
|
+
// Hunk header
|
|
28
|
+
coloredLines.push(`${ansi_1.ansi.fg.cyan}${line}${ansi_1.ansi.reset}`);
|
|
29
|
+
}
|
|
30
|
+
else if (line.startsWith('+')) {
|
|
31
|
+
// Added line
|
|
32
|
+
coloredLines.push(`${ansi_1.ansi.fg.green}${line}${ansi_1.ansi.reset}`);
|
|
33
|
+
}
|
|
34
|
+
else if (line.startsWith('-')) {
|
|
35
|
+
// Removed line
|
|
36
|
+
coloredLines.push(`${ansi_1.ansi.fg.red}${line}${ansi_1.ansi.reset}`);
|
|
37
|
+
}
|
|
38
|
+
else if (line.startsWith('\\')) {
|
|
39
|
+
// "No newline at end of file" etc.
|
|
40
|
+
coloredLines.push(`${ansi_1.ansi.dim}${line}${ansi_1.ansi.reset}`);
|
|
41
|
+
}
|
|
42
|
+
else if (line.startsWith('diff ')) {
|
|
43
|
+
// Diff command line
|
|
44
|
+
coloredLines.push(`${ansi_1.ansi.bold}${ansi_1.ansi.fg.white}${line}${ansi_1.ansi.reset}`);
|
|
45
|
+
}
|
|
46
|
+
else if (line.startsWith('index ')) {
|
|
47
|
+
// Index line
|
|
48
|
+
coloredLines.push(`${ansi_1.ansi.dim}${line}${ansi_1.ansi.reset}`);
|
|
49
|
+
}
|
|
50
|
+
else if (line.startsWith('Binary files')) {
|
|
51
|
+
// Binary file indicator
|
|
52
|
+
coloredLines.push(`${ansi_1.ansi.fg.yellow}${line}${ansi_1.ansi.reset}`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// Context line
|
|
56
|
+
coloredLines.push(line);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return coloredLines;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Truncate string to fit width
|
|
63
|
+
*/
|
|
64
|
+
function truncate(str, maxLen) {
|
|
65
|
+
if (str.length <= maxLen)
|
|
66
|
+
return str;
|
|
67
|
+
return str.slice(0, maxLen - 1) + '…';
|
|
68
|
+
}
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// Rendering
|
|
71
|
+
// ============================================================================
|
|
72
|
+
/**
|
|
73
|
+
* Render the file diff view for fullscreen display
|
|
74
|
+
*
|
|
75
|
+
* @param state - The file diff view state
|
|
76
|
+
* @param width - Available width in columns
|
|
77
|
+
* @param height - Available height in rows
|
|
78
|
+
* @returns ANSI output string
|
|
79
|
+
*/
|
|
80
|
+
function renderFileDiffView(state, width, height) {
|
|
81
|
+
let output = ansi_1.ansi.hideCursor + ansi_1.ansi.clearScreen + ansi_1.ansi.moveTo(1, 1);
|
|
82
|
+
const headerRows = 4;
|
|
83
|
+
const footerRows = 3;
|
|
84
|
+
const contentHeight = height - headerRows - footerRows;
|
|
85
|
+
// Header - Back option (the only selectable item)
|
|
86
|
+
output += `${ansi_1.ansi.fg.cyan}${ansi_1.ansi.bold}▸${ansi_1.ansi.reset} `;
|
|
87
|
+
output += `${ansi_1.ansi.inverse} ← Back to Claude ${ansi_1.ansi.reset}`;
|
|
88
|
+
output += '\n';
|
|
89
|
+
// Separator
|
|
90
|
+
output += `${ansi_1.ansi.dim}${'─'.repeat(width - 1)}${ansi_1.ansi.reset}\n`;
|
|
91
|
+
// File info
|
|
92
|
+
const filename = truncate(state.filename, width - 20);
|
|
93
|
+
output += `${ansi_1.ansi.bold}${ansi_1.ansi.fg.white}${filename}${ansi_1.ansi.reset}`;
|
|
94
|
+
// Stats
|
|
95
|
+
if (state.insertions > 0 || state.deletions > 0) {
|
|
96
|
+
output += ' ';
|
|
97
|
+
if (state.insertions > 0) {
|
|
98
|
+
output += `${ansi_1.ansi.fg.green}+${state.insertions}${ansi_1.ansi.reset}`;
|
|
99
|
+
}
|
|
100
|
+
if (state.deletions > 0) {
|
|
101
|
+
output += ` ${ansi_1.ansi.fg.red}-${state.deletions}${ansi_1.ansi.reset}`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
output += '\n';
|
|
105
|
+
// Separator
|
|
106
|
+
output += `${ansi_1.ansi.dim}${'─'.repeat(width - 1)}${ansi_1.ansi.reset}\n`;
|
|
107
|
+
// Diff content
|
|
108
|
+
if (!state.diffContent) {
|
|
109
|
+
output += ansi_1.ansi.moveTo(headerRows + 2, 1);
|
|
110
|
+
output += `${ansi_1.ansi.dim}No diff content available${ansi_1.ansi.reset}`;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const coloredLines = parseDiffLines(state.diffContent);
|
|
114
|
+
const totalLines = coloredLines.length;
|
|
115
|
+
// Calculate visible range
|
|
116
|
+
const visibleStart = state.scrollOffset;
|
|
117
|
+
const visibleEnd = Math.min(totalLines, visibleStart + contentHeight);
|
|
118
|
+
for (let i = visibleStart; i < visibleEnd; i++) {
|
|
119
|
+
const row = headerRows + 1 + (i - visibleStart);
|
|
120
|
+
output += ansi_1.ansi.moveTo(row, 1);
|
|
121
|
+
// Line number (right-aligned, dim)
|
|
122
|
+
const lineNum = String(i + 1).padStart(4, ' ');
|
|
123
|
+
output += `${ansi_1.ansi.dim}${lineNum}${ansi_1.ansi.reset} `;
|
|
124
|
+
// Line content (truncated to fit)
|
|
125
|
+
const line = coloredLines[i];
|
|
126
|
+
const maxLineLen = width - 6; // Account for line number and space
|
|
127
|
+
// Strip ANSI codes for length calculation
|
|
128
|
+
const plainLine = line.replace(/\x1b\[[0-9;]*m/g, '');
|
|
129
|
+
if (plainLine.length > maxLineLen) {
|
|
130
|
+
// Need to truncate while preserving ANSI codes
|
|
131
|
+
output += truncateWithAnsi(line, maxLineLen);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
output += line;
|
|
135
|
+
}
|
|
136
|
+
output += '\n';
|
|
137
|
+
}
|
|
138
|
+
// Scroll indicator
|
|
139
|
+
if (totalLines > contentHeight) {
|
|
140
|
+
const scrollPercent = totalLines > 1
|
|
141
|
+
? Math.floor((state.scrollOffset / (totalLines - contentHeight)) * 100)
|
|
142
|
+
: 0;
|
|
143
|
+
const scrollIndicator = `${scrollPercent}%`;
|
|
144
|
+
output += ansi_1.ansi.moveTo(headerRows + 1, width - scrollIndicator.length);
|
|
145
|
+
output += `${ansi_1.ansi.dim}${scrollIndicator}${ansi_1.ansi.reset}`;
|
|
146
|
+
// Draw scroll bar
|
|
147
|
+
const scrollBarHeight = contentHeight;
|
|
148
|
+
const scrollBarPos = Math.floor((state.scrollOffset / (totalLines - 1)) * (scrollBarHeight - 1));
|
|
149
|
+
for (let i = 0; i < scrollBarHeight && i + visibleStart < totalLines; i++) {
|
|
150
|
+
output += ansi_1.ansi.moveTo(headerRows + 1 + i, width);
|
|
151
|
+
if (i === scrollBarPos) {
|
|
152
|
+
output += `${ansi_1.ansi.fg.cyan}█${ansi_1.ansi.reset}`;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
output += `${ansi_1.ansi.dim}│${ansi_1.ansi.reset}`;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Footer
|
|
161
|
+
output += ansi_1.ansi.moveTo(height - 2, 1);
|
|
162
|
+
output += `${ansi_1.ansi.dim}${'─'.repeat(width - 1)}${ansi_1.ansi.reset}\n`;
|
|
163
|
+
output += `${ansi_1.ansi.dim}j/k scroll g top G bottom ↵/Esc back${ansi_1.ansi.reset}`;
|
|
164
|
+
return output;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Truncate a string with ANSI codes while preserving formatting
|
|
168
|
+
*/
|
|
169
|
+
function truncateWithAnsi(str, maxLen) {
|
|
170
|
+
// Simple approach: just truncate and add reset
|
|
171
|
+
let visibleLen = 0;
|
|
172
|
+
let result = '';
|
|
173
|
+
let inEscape = false;
|
|
174
|
+
for (let i = 0; i < str.length; i++) {
|
|
175
|
+
const char = str[i];
|
|
176
|
+
if (char === '\x1b') {
|
|
177
|
+
inEscape = true;
|
|
178
|
+
result += char;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (inEscape) {
|
|
182
|
+
result += char;
|
|
183
|
+
if (char === 'm') {
|
|
184
|
+
inEscape = false;
|
|
185
|
+
}
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (visibleLen < maxLen) {
|
|
189
|
+
result += char;
|
|
190
|
+
visibleLen++;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (visibleLen >= maxLen) {
|
|
197
|
+
result += ansi_1.ansi.reset + '…';
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Calculate the maximum scroll offset for the diff content
|
|
203
|
+
*/
|
|
204
|
+
function getMaxScrollOffset(diffContent, viewHeight) {
|
|
205
|
+
const headerRows = 4;
|
|
206
|
+
const footerRows = 3;
|
|
207
|
+
const contentHeight = viewHeight - headerRows - footerRows;
|
|
208
|
+
const totalLines = diffContent.split('\n').length;
|
|
209
|
+
return Math.max(0, totalLines - contentHeight);
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=file-diff-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-diff-render.js","sourceRoot":"","sources":["../../src/diff/file-diff-render.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiFH,gDAwGC;AA8CD,gDAOC;AA5OD,kCAA+B;AAc/B,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,SAAS,cAAc,CAAC,WAAmB;IACzC,MAAM,KAAK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AAE,CAAC;YACb,MAAM,IAAI,IAAI,CAAC;YACf,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACjB,QAAQ,GAAG,KAAK,CAAC;YACnB,CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,UAAU,GAAG,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,IAAI,CAAC;YACf,UAAU,EAAE,CAAC;QACf,CAAC;aAAM,CAAC;YACN,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;QACzB,MAAM,IAAI,WAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IAC7B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,kBAAkB,CAAC,WAAmB,EAAE,UAAkB;IACxE,MAAM,UAAU,GAAG,CAAC,CAAC;IACrB,MAAM,UAAU,GAAG,CAAC,CAAC;IACrB,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;IAE3D,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,aAAa,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Diff Operations
|
|
3
|
+
*
|
|
4
|
+
* Functions for getting git diff summaries and file diffs.
|
|
5
|
+
* Uses simple-git for git operations.
|
|
6
|
+
*/
|
|
7
|
+
export type ChangeType = 'M' | 'A' | 'D' | 'R' | 'C' | 'U' | '?';
|
|
8
|
+
export interface DiffFileSummary {
|
|
9
|
+
file: string;
|
|
10
|
+
changeType: ChangeType;
|
|
11
|
+
insertions: number;
|
|
12
|
+
deletions: number;
|
|
13
|
+
binary: boolean;
|
|
14
|
+
oldFile?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get a summary of all changed files in the working directory
|
|
18
|
+
* Includes both staged and unstaged changes compared to HEAD
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDiffSummary(repoPath: string): Promise<DiffFileSummary[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the full diff content for a specific file
|
|
23
|
+
*/
|
|
24
|
+
export declare function getFileDiff(repoPath: string, filename: string): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Get the full file content with inline diff markers colored.
|
|
27
|
+
* Shows the complete file with changed lines highlighted.
|
|
28
|
+
* For new files, shows all lines as added (green).
|
|
29
|
+
* For modified files, shows the full unified diff with colors.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getFileWithInlineDiff(repoPath: string, filename: string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the full file content with inline diffs.
|
|
34
|
+
* Shows the COMPLETE current file with changed sections highlighted:
|
|
35
|
+
* - Unchanged lines: normal text
|
|
36
|
+
* - Deleted lines: shown in red at the position they were removed
|
|
37
|
+
* - Added lines: shown in green (these are already in the current file)
|
|
38
|
+
*
|
|
39
|
+
* For new files, shows all lines as added (green).
|
|
40
|
+
*/
|
|
41
|
+
export declare function getFullFileWithInlineDiff(repoPath: string, filename: string): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Get a "diffs only" view of a file - shows just the hunks without file headers.
|
|
44
|
+
* This is a compact view showing only the changed sections.
|
|
45
|
+
*
|
|
46
|
+
* For new/untracked files, shows all lines as added with a synthetic hunk header.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getDiffsOnlyView(repoPath: string, filename: string): Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Watch for file changes in a repository
|
|
51
|
+
* Returns a cleanup function to stop watching
|
|
52
|
+
*/
|
|
53
|
+
export declare function watchForChanges(repoPath: string, callback: () => void): () => void;
|
|
54
|
+
//# sourceMappingURL=git-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-diff.d.ts","sourceRoot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