finch-git-branch 0.3.2 → 0.3.5

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
@@ -32,7 +32,7 @@ The first version intentionally leaves out force-push, rebase, reset, cherry-pic
32
32
 
33
33
  ## Permissions
34
34
 
35
- This tool needs shell permission because it runs `git` commands locally. No network access needed.
35
+ This tool needs shell permission to run local `git` commands and read-only filesystem permission to inspect repository metadata and changed files. No network access needed.
36
36
 
37
37
  ## Development
38
38
 
package/README.zh-CN.md CHANGED
@@ -27,7 +27,7 @@ Git 源码管理小工具是 [Finch](https://finchwork.app/) 的扩展。Finch
27
27
 
28
28
  ## 权限
29
29
 
30
- 这个工具需要在本地执行 `git` 命令,所以需要 shell 权限。不需要联网。
30
+ 这个工具需要 shell 权限来执行本地 `git` 命令,以及只读文件权限来读取仓库元数据和变更文件。不需要联网。
31
31
 
32
32
  ## 开发
33
33
 
package/dist/scm-panel.js CHANGED
@@ -154,7 +154,10 @@ export function activateScmPanel(ctx) {
154
154
  let generation = 0;
155
155
  let repos = [];
156
156
  let unavailable = false;
157
- const active = () => !unavailable && panel.visible;
157
+ // A panel can receive its initial bridge message before `visible` flips to
158
+ // true. Treat the live handle as available so that init is never dropped;
159
+ // visibility still triggers an explicit refresh below.
160
+ const active = () => !unavailable;
158
161
  const post = async (message) => {
159
162
  if (!active())
160
163
  return false;
@@ -185,12 +188,12 @@ export function activateScmPanel(ctx) {
185
188
  // Also push config immediately: an already-live Webview may not emit finch:env again
186
189
  // after the mini tool backend is reloaded.
187
190
  void sendConfig().catch(() => undefined);
188
- const setScope = async (message, useCurrentWorkspace = false) => {
189
- const webviewCwd = typeof message.cwd === 'string' ? message.cwd : '';
190
- // Session switches can retain a live Webview without replaying finch:env.
191
- // The backend workspace follows the active session and is authoritative for heartbeat refreshes.
192
- const activeCwd = ctx.workspace.directoryPath ?? ctx.workspace.projectPath ?? '';
193
- const nextCwd = useCurrentWorkspace && activeCwd ? activeCwd : webviewCwd;
191
+ const setScope = async (message) => {
192
+ // A Panel belongs to the Session that opened it. Its bridged finch:env cwd
193
+ // remains the only reliable scope after switching other Spaces/Sessions;
194
+ // ctx.workspace describes the globally active workspace and can belong to
195
+ // a different Session by the time this callback runs.
196
+ const nextCwd = typeof message.cwd === 'string' ? message.cwd : '';
194
197
  const nextScopeKey = typeof message.scopeKey === 'string' ? message.scopeKey : (scopeKey || nextCwd);
195
198
  if (nextScopeKey === scopeKey && nextCwd === cwd)
196
199
  return false;
@@ -268,12 +271,12 @@ export function activateScmPanel(ctx) {
268
271
  return;
269
272
  }
270
273
  if (message.type === 'refresh') {
271
- await setScope(message, true);
274
+ await setScope(message);
272
275
  await refresh(message.silent !== true);
273
276
  return;
274
277
  }
275
278
  if (message.type === 'syncWorkspace') {
276
- const changed = await setScope(message, true);
279
+ const changed = await setScope(message);
277
280
  await sendConfig();
278
281
  if (changed || repos.length === 0)
279
282
  await refresh();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finch-git-branch",
3
- "version": "0.3.2",
3
+ "version": "0.3.5",
4
4
  "description": "Git Source Control for Finch Composer toolbar.",
5
5
  "author": {
6
6
  "name": "Finch Team",
@@ -98,7 +98,7 @@
98
98
  "skills": false
99
99
  },
100
100
  "permissions": {
101
- "filesystem": "none",
101
+ "filesystem": "read",
102
102
  "network": false,
103
103
  "shell": true
104
104
  }