cherrypick-interactive 1.11.0 → 1.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cherrypick-interactive",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Interactively cherry-pick commits that are in dev but not in main, using subject-based comparison.",
5
5
  "main": "cli.js",
6
6
  "bin": "cli.js",
@@ -15,7 +15,11 @@
15
15
  "check": "biome check .",
16
16
  "fix": "biome check --write .",
17
17
  "release": "npm publish --access public",
18
- "test": "node --test test/**/*.test.js"
18
+ "test": "node --test test/**/*.test.js",
19
+ "prepare": "simple-git-hooks"
20
+ },
21
+ "simple-git-hooks": {
22
+ "pre-push": "yarn test"
19
23
  },
20
24
  "engines": {
21
25
  "node": ">=20"
@@ -33,7 +37,8 @@
33
37
  "yargs": "^18.0.0"
34
38
  },
35
39
  "devDependencies": {
36
- "@biomejs/biome": "^1.9.4"
40
+ "@biomejs/biome": "^1.9.4",
41
+ "simple-git-hooks": "^2.13.1"
37
42
  },
38
43
  "keywords": [
39
44
  "git",
package/src/tui/App.js CHANGED
@@ -14,6 +14,7 @@ export function App({ commits, gitRawFn, devBranch, mainBranch, since, onDone })
14
14
  const [filterText, setFilterText] = useState('');
15
15
  const [isSearching, setIsSearching] = useState(false);
16
16
  const [searchInput, setSearchInput] = useState('');
17
+ const [showPreview, setShowPreview] = useState(true);
17
18
  const [showDiff, setShowDiff] = useState(false);
18
19
  const [diffText, setDiffText] = useState('');
19
20
  const [confirmQuit, setConfirmQuit] = useState(false);
@@ -28,7 +29,7 @@ export function App({ commits, gitRawFn, devBranch, mainBranch, since, onDone })
28
29
  useEffect(() => {
29
30
  if (!currentCommit) return;
30
31
  let cancelled = false;
31
- gitRawFn(['show', '--stat', '--format=', currentCommit.hash]).then((text) => {
32
+ gitRawFn(['show', '--stat', '--format=', '--color=always', currentCommit.hash]).then((text) => {
32
33
  if (!cancelled) setPreviewText(text.trim());
33
34
  }).catch(() => {
34
35
  if (!cancelled) setPreviewText('(unable to load preview)');
@@ -114,7 +115,7 @@ export function App({ commits, gitRawFn, devBranch, mainBranch, since, onDone })
114
115
  if (currentCommit) {
115
116
  setShowDiff(true);
116
117
  setDiffText('Loading...');
117
- gitRawFn(['show', '--stat', '-p', currentCommit.hash]).then((text) => {
118
+ gitRawFn(['show', '--stat', '-p', '--color=always', currentCommit.hash]).then((text) => {
118
119
  setDiffText(text.trim());
119
120
  }).catch(() => {
120
121
  setDiffText('(unable to load diff)');
@@ -122,6 +123,11 @@ export function App({ commits, gitRawFn, devBranch, mainBranch, since, onDone })
122
123
  }
123
124
  }
124
125
 
126
+ // Toggle preview
127
+ else if (input === 'p') {
128
+ setShowPreview((v) => !v);
129
+ }
130
+
125
131
  // Confirm
126
132
  else if (key.return) {
127
133
  const selectedHashes = [...selected];
@@ -185,10 +191,12 @@ export function App({ commits, gitRawFn, devBranch, mainBranch, since, onDone })
185
191
  isSearching=${isSearching}
186
192
  selectedCount=${selected.size}
187
193
  />
188
- <${Preview}
189
- previewText=${previewText}
190
- hash=${currentCommit?.hash}
191
- />
194
+ ${showPreview ? html`
195
+ <${Preview}
196
+ previewText=${previewText}
197
+ hash=${currentCommit?.hash}
198
+ />
199
+ ` : null}
192
200
  </${Box}>
193
201
  `;
194
202
  }
package/src/tui/KeyBar.js CHANGED
@@ -13,7 +13,7 @@ export function KeyBar({ isSearching, selectedCount }) {
13
13
  return html`
14
14
  <${Box} paddingX=${1}>
15
15
  <${Text} color="dim">
16
- [space] toggle [a] all [n] none [/] search [d] diff [enter] confirm (${selectedCount}) [q] quit
16
+ [space] toggle [a] all [n] none [/] search [d] diff [p] preview [enter] confirm (${selectedCount}) [q] quit
17
17
  </${Text}>
18
18
  </${Box}>
19
19
  `;