@omercnet/paseo-fresh-worktrees 1.2.1 → 2.0.0-next.162.1

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
@@ -6,6 +6,10 @@ branch-off workspace.
6
6
  The plugin runs the refresh inside the Paseo daemon and adds a workspace-header indicator when an
7
7
  active worktree falls behind the source checkout's remote base.
8
8
 
9
+ ## Demo
10
+
11
+ https://github.com/user-attachments/assets/d0687b37-8292-459d-ad28-7960c193195a
12
+
9
13
  ## Screenshots
10
14
 
11
15
  The repository, remote, branch, and workspace are disposable local fixtures. Both PNGs come from
@@ -47,19 +51,12 @@ host.
47
51
  paseo plugin install npm:@omercnet/paseo-fresh-worktrees
48
52
  ```
49
53
 
50
- Or install from Git:
51
-
52
- ```bash
53
- paseo plugin add omercnet/paseo-plugins:fresh-worktrees
54
- ```
55
-
56
- The plugin requires Paseo `>=0.8.0`.
54
+ The plugin requires Paseo `^0.9.0`.
57
55
 
58
56
  ## Develop
59
57
 
60
58
  ```bash
61
- npm ci
62
- npm run typecheck
63
- npm test
64
- paseo plugin install "$PWD"
59
+ bun install
60
+ bun run typecheck
61
+ bun run test
65
62
  ```
package/index.client.ts CHANGED
@@ -20,10 +20,7 @@ interface ReleasableSubscription {
20
20
  export default function contribute(client: PluginClientContext) {
21
21
  const buttons = new Map<string, PluginButtonRegistration>();
22
22
  const checks = new Map<string, Promise<void>>();
23
- const workspaceLocations = new Map<
24
- string,
25
- { projectId: string; workspaceDirectory: string }
26
- >();
23
+ const workspaceLocations = new Map<string, { projectId: string; workspaceDirectory: string }>();
27
24
  const projectRoots = new Map<string, string>();
28
25
  let stopped = false;
29
26
  let workspaceSubscription: ReleasableSubscription | undefined;
package/package.json CHANGED
@@ -31,24 +31,27 @@
31
31
  "shared",
32
32
  "paseo-plugin.json"
33
33
  ],
34
- "version": "1.2.1",
34
+ "version": "2.0.0-next.162.1",
35
35
  "type": "module",
36
- "packageManager": "npm@11.19.1",
36
+ "packageManager": "bun@1.4.2",
37
37
  "engines": {
38
38
  "node": ">=24"
39
39
  },
40
40
  "scripts": {
41
+ "check": "biome check .",
42
+ "check:write": "biome check --write .",
41
43
  "test": "vitest run",
42
44
  "typecheck": "tsc --noEmit"
43
45
  },
44
46
  "devDependencies": {
45
- "@getpaseo/client": "0.9.0-beta.1",
46
- "@getpaseo/plugin": "0.9.0-beta.1",
47
- "@types/node": "^24.5.2",
48
- "@types/react": "~19.2.0",
47
+ "@biomejs/biome": "^2.5.10",
48
+ "@getpaseo/client": "0.9.2",
49
+ "@getpaseo/plugin": "0.9.2",
50
+ "@types/node": "^24.10.1",
51
+ "@types/react": "^19.2.18",
49
52
  "react": "19.1.0",
50
- "typescript": "^7.0.0",
53
+ "typescript": "^7.0.2",
51
54
  "vitest": "^5.0.0",
52
- "zod": "^4.4.3"
55
+ "zod": "4.4.3"
53
56
  }
54
57
  }
package/paseo-plugin.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "id": "fresh-worktrees",
3
- "requirements": {
4
- "paseo": ">=0.8.0"
5
- }
3
+ "description": "Fast-forwards clean local base branches before Paseo creates branch-off worktrees.",
4
+ "requirements": { "paseo": "^0.9.0" }
6
5
  }
@@ -42,7 +42,6 @@ export interface RefreshDependencies {
42
42
  const execFileAsync = promisify(execFile);
43
43
  const GIT_TIMEOUT_MS = 10_000;
44
44
 
45
-
46
45
  export async function executeGit(
47
46
  cwd: string,
48
47
  args: readonly string[],
@@ -79,41 +78,43 @@ export function createRepositoryRefreshCoordinator(
79
78
  if (existingRefresh) return existingRefresh;
80
79
 
81
80
  const previousRefresh = repositoryTails.get(cwd) ?? Promise.resolve();
82
- const refresh = previousRefresh.catch(() => {}).then(async (): Promise<RepositoryRefreshResult> => {
83
- await runGit(cwd, ["fetch", "--prune", "--quiet", remote], signal);
84
- if (!localBranch) return { kind: "unchanged" };
85
-
86
- const matchingRemoteBranch = `${remote}/${localBranch}`;
87
- const freshBase =
88
- upstream && (await remoteRefExists(runGit, cwd, upstream, signal))
89
- ? upstream
90
- : (await remoteRefExists(runGit, cwd, matchingRemoteBranch, signal))
91
- ? matchingRemoteBranch
92
- : null;
93
- if (!freshBase) return { kind: "unchanged" };
94
-
95
- const currentBranch = await optionalGit(
96
- runGit,
97
- cwd,
98
- ["symbolic-ref", "--quiet", "--short", "HEAD"],
99
- signal,
100
- );
101
- if (currentBranch !== localBranch) {
102
- throw new Error(
103
- `Cannot refresh local branch ${localBranch} in ${cwd}: the source checkout is on ${currentBranch ?? "a detached HEAD"}`,
81
+ const refresh = previousRefresh
82
+ .catch(() => {})
83
+ .then(async (): Promise<RepositoryRefreshResult> => {
84
+ await runGit(cwd, ["fetch", "--prune", "--quiet", remote], signal);
85
+ if (!localBranch) return { kind: "unchanged" };
86
+
87
+ const matchingRemoteBranch = `${remote}/${localBranch}`;
88
+ const freshBase =
89
+ upstream && (await remoteRefExists(runGit, cwd, upstream, signal))
90
+ ? upstream
91
+ : (await remoteRefExists(runGit, cwd, matchingRemoteBranch, signal))
92
+ ? matchingRemoteBranch
93
+ : null;
94
+ if (!freshBase) return { kind: "unchanged" };
95
+
96
+ const currentBranch = await optionalGit(
97
+ runGit,
98
+ cwd,
99
+ ["symbolic-ref", "--quiet", "--short", "HEAD"],
100
+ signal,
104
101
  );
105
- }
106
-
107
- const status = await runGit(
108
- cwd,
109
- ["status", "--porcelain", "--untracked-files=normal"],
110
- signal,
111
- );
112
- if (status) return { kind: "dirty" };
102
+ if (currentBranch !== localBranch) {
103
+ throw new Error(
104
+ `Cannot refresh local branch ${localBranch} in ${cwd}: the source checkout is on ${currentBranch ?? "a detached HEAD"}`,
105
+ );
106
+ }
107
+
108
+ const status = await runGit(
109
+ cwd,
110
+ ["status", "--porcelain", "--untracked-files=normal"],
111
+ signal,
112
+ );
113
+ if (status) return { kind: "dirty" };
113
114
 
114
- await runGit(cwd, ["merge", "--ff-only", "--quiet", freshBase], signal);
115
- return { kind: "updated", freshBase };
116
- });
115
+ await runGit(cwd, ["merge", "--ff-only", "--quiet", freshBase], signal);
116
+ return { kind: "updated", freshBase };
117
+ });
117
118
  const tail = refresh.then(
118
119
  () => {},
119
120
  () => {},
@@ -186,8 +187,7 @@ async function remoteRefExists(
186
187
  ): Promise<boolean> {
187
188
  const fullRef = ref.startsWith("refs/remotes/") ? ref : `refs/remotes/${ref}`;
188
189
  return (
189
- (await optionalGit(runGit, cwd, ["show-ref", "--verify", "--quiet", fullRef], signal)) !==
190
- null
190
+ (await optionalGit(runGit, cwd, ["show-ref", "--verify", "--quiet", fullRef], signal)) !== null
191
191
  );
192
192
  }
193
193
 
@@ -242,12 +242,7 @@ export async function refreshWorkspaceRequest(
242
242
  dependencies.signal,
243
243
  );
244
244
  if (currentBranch) {
245
- localBranch = await localBranchDetails(
246
- runGit,
247
- cwd,
248
- currentBranch,
249
- dependencies.signal,
250
- );
245
+ localBranch = await localBranchDetails(runGit, cwd, currentBranch, dependencies.signal);
251
246
  }
252
247
  }
253
248
 
@@ -1,7 +1,7 @@
1
1
  import type { RpcOutput } from "@getpaseo/plugin";
2
+ import type { workspaceFreshness } from "../shared/workspace-freshness";
2
3
  import type { GitRunner, RepositoryRefresh } from "./fresh-worktrees";
3
4
  import { executeGit } from "./fresh-worktrees";
4
- import { workspaceFreshness } from "../shared/workspace-freshness";
5
5
 
6
6
  export interface WorkspaceFreshnessDependencies {
7
7
  signal: AbortSignal;
@@ -8,7 +8,11 @@ export const workspaceFreshness = defineRpc({
8
8
  workspaceDirectory: z.string().min(1),
9
9
  }),
10
10
  output: z.discriminatedUnion("kind", [
11
- z.object({ kind: z.literal("behind"), remoteRef: z.string(), behindBy: z.number().int().positive() }),
11
+ z.object({
12
+ kind: z.literal("behind"),
13
+ remoteRef: z.string(),
14
+ behindBy: z.number().int().positive(),
15
+ }),
12
16
  z.object({ kind: z.literal("current"), remoteRef: z.string() }),
13
17
  z.object({ kind: z.literal("unavailable") }),
14
18
  ]),