dsh-ide-git 0.18.6 → 0.18.7

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/dsh.plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "dsh-external/dsh-ide-git",
3
- "version": "0.18.6",
3
+ "version": "0.18.7",
4
4
  "main": "./src/index.js",
5
5
  "description": "IDE 级 Git 操作面板:分支树 + 提交图谱 + 变更/暂存/提交 + 提交详情。装了 dsh-better-sidebar 时挂成它的原生 tab(右侧栏 + 底部工作台);没装时直接挂 DSH 原生右侧栏,单独安装即可用。JetBrains 风格 Git 工具窗口 for DeepSeek Harness.",
6
6
  "engines": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-ide-git",
3
- "version": "0.18.6",
3
+ "version": "0.18.7",
4
4
  "description": "DSH plugin: an IDE-grade Git tool window as a native dsh-better-sidebar tab — branch tree, commit graph, changes, commit details, JetBrains-style actions, in the right sidebar and the bottom panel. | DSH 插件:IDE 级 Git 工具窗口,以 dsh-better-sidebar 原生 Tab 挂载——分支树 / 提交图谱 / 变更与提交详情 / JetBrains 风格操作,右侧栏与底部面板双布局自适应。",
5
5
  "type": "module",
6
6
  "repository": {
package/src/client.js CHANGED
@@ -11612,6 +11612,10 @@ window.__ModuleLoader__.load({
11612
11612
  ⋯ menu's 展开全部/折叠全部 entries drive the same map the folder
11613
11613
  headers toggle. */
11614
11614
  const [foldedDirs, setFoldedDirs] = useState({})
11615
+ /* Last-seen "HEAD hash|branch" signature, from the poll summaries
11616
+ (v0.18.7). A ref, not state: a change triggers a data reload, not a
11617
+ render. null until the first poll tick records the baseline. */
11618
+ const headRef = useRef(null)
11615
11619
  const refresh = useCallback(async (opts) => {
11616
11620
  if (repoRoot === null) return
11617
11621
  const withFetch = opts !== null && typeof opts === 'object' && opts.fetchRemote === true && remoteReady === true
@@ -11622,6 +11626,12 @@ window.__ModuleLoader__.load({
11622
11626
  try { await request('fetch', Object.assign({}, base, { prune: true })) } catch (error) { void error }
11623
11627
  }
11624
11628
  const [summaryData, branchesData, page] = await Promise.all([loadSummary(), loadBranches(), loadCommits(0)])
11629
+ /* Keep the poll's HEAD signature in step (v0.18.7): after an
11630
+ in-panel commit/checkout the next tick must not re-pull
11631
+ branches + history all over again. */
11632
+ if (summaryData !== null && typeof summaryData === 'object' && typeof summaryData.head === 'string') {
11633
+ headRef.current = summaryData.head + '|' + (summaryData.branch === undefined ? '' : summaryData.branch)
11634
+ }
11625
11635
  /* The write side of the first-paint cache: exactly the FIRST page
11626
11636
  (a paged fetch never reaches this path), replaced on every
11627
11637
  refresh — the auto-refresh included — so a session switch through
@@ -11666,11 +11676,29 @@ window.__ModuleLoader__.load({
11666
11676
  if (inFlight === true) return
11667
11677
  inFlight = true
11668
11678
  void (async () => {
11669
- try { await loadSummary() } catch (error) { void error } finally { inFlight = false }
11679
+ try {
11680
+ const data = await loadSummary()
11681
+ /* v0.18.7: the poll used to be summary-only, so commits and
11682
+ checkouts made OUTSIDE the panel (terminal, another tool)
11683
+ never reached the history and branch lists until a manual
11684
+ refresh. Each summary now carries HEAD + branch; when that
11685
+ signature moves, re-pull branches + history. The panel's own
11686
+ actions already refresh everything through run() → refresh()
11687
+ (which also re-records the signature), so this stays quiet
11688
+ for in-panel work. The null baseline (first tick) only
11689
+ records — the mount refresh already pulled everything. */
11690
+ const sig = data !== null && typeof data === 'object' && typeof data.head === 'string'
11691
+ ? data.head + '|' + (data.branch === undefined ? '' : data.branch)
11692
+ : null
11693
+ if (sig !== null && headRef.current !== null && sig !== headRef.current) {
11694
+ await Promise.all([loadBranches(), loadCommits(0)])
11695
+ }
11696
+ if (sig !== null) headRef.current = sig
11697
+ } catch (error) { void error } finally { inFlight = false }
11670
11698
  })()
11671
11699
  }, AUTO_REFRESH_MS)
11672
11700
  return () => clearInterval(timer)
11673
- }, [props.visible, repoRoot, loadSummary])
11701
+ }, [props.visible, repoRoot, loadSummary, loadBranches, loadCommits])
11674
11702
 
11675
11703
  const run = useCallback(async (method, payload) => {
11676
11704
  const result = await guard(() => request(method, Object.assign({}, base, payload)))
@@ -11684,6 +11712,10 @@ window.__ModuleLoader__.load({
11684
11712
  setSummary(null)
11685
11713
  setBranches(null)
11686
11714
  setCommits([])
11715
+ /* The signature is per-repo: force a fresh baseline for the new one
11716
+ so the first poll tick doesn't mistake the repo switch for an
11717
+ outside HEAD move. */
11718
+ headRef.current = null
11687
11719
  setDetail(null)
11688
11720
  setSelectedHash(null)
11689
11721
  setPatch('')
package/src/index.js CHANGED
@@ -614,7 +614,7 @@ async function summary(payload) {
614
614
  large `status` scan no longer serialises behind five cheap calls
615
615
  (issue #11: the sum of ~ten sequential commands became the max of two
616
616
  chains). */
617
- const [branchInfo, statusOut, unstagedStat, stagedStat, ignored, stashCount, worktrees, operation] = await Promise.all([
617
+ const [branchInfo, statusOut, unstagedStat, stagedStat, ignored, stashCount, worktrees, operation, head] = await Promise.all([
618
618
  (async () => {
619
619
  const branch = await currentBranchOf(root)
620
620
  const detached = branch === 'HEAD'
@@ -629,6 +629,10 @@ async function summary(payload) {
629
629
  stashCountOf(root),
630
630
  worktreesOf(root),
631
631
  operationOf(root),
632
+ /* HEAD hash (v0.18.7): lets the client's poll notice OUTSIDE commits and
633
+ checkouts — the panel's own actions already refresh everything, but
634
+ nothing else watches the repo. Empty string on an unborn branch. */
635
+ git(root, ['rev-parse', 'HEAD']).then((out) => out.trim()).catch(() => ''),
632
636
  ])
633
637
  const groups = classify(parsePorcelain(statusOut))
634
638
  return {
@@ -639,6 +643,7 @@ async function summary(payload) {
639
643
  upstream: branchInfo.upstream,
640
644
  ahead: branchInfo.tracking.ahead,
641
645
  behind: branchInfo.tracking.behind,
646
+ head: head,
642
647
  changes: {
643
648
  staged: decorate(groups.staged, stagedStat),
644
649
  unstaged: decorate(groups.unstaged, unstagedStat),