@omercnet/paseo-fresh-worktrees 1.2.1-next.117.1 → 1.2.1-next.133.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 +3 -10
- package/index.client.ts +1 -4
- package/package.json +11 -8
- package/paseo-plugin.json +1 -1
- package/server/fresh-worktrees.ts +37 -42
- package/server/workspace-freshness.ts +1 -1
- package/shared/workspace-freshness.ts +5 -1
package/README.md
CHANGED
|
@@ -47,19 +47,12 @@ host.
|
|
|
47
47
|
paseo plugin install npm:@omercnet/paseo-fresh-worktrees
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
Or install from Git:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
paseo plugin add omercnet/paseo-plugins:fresh-worktrees
|
|
54
|
-
```
|
|
55
|
-
|
|
56
50
|
The plugin requires Paseo `>=0.8.0`.
|
|
57
51
|
|
|
58
52
|
## Develop
|
|
59
53
|
|
|
60
54
|
```bash
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
paseo plugin install "$PWD"
|
|
55
|
+
bun install
|
|
56
|
+
bun run typecheck
|
|
57
|
+
bun run test
|
|
65
58
|
```
|
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-next.
|
|
34
|
+
"version": "1.2.1-next.133.1",
|
|
35
35
|
"type": "module",
|
|
36
|
-
"packageManager": "
|
|
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
|
-
"@
|
|
46
|
-
"@getpaseo/
|
|
47
|
-
"@
|
|
48
|
-
"@types/
|
|
47
|
+
"@biomejs/biome": "^2.5.10",
|
|
48
|
+
"@getpaseo/client": "0.9.0",
|
|
49
|
+
"@getpaseo/plugin": "0.9.0",
|
|
50
|
+
"@types/node": "^24.10.1",
|
|
51
|
+
"@types/react": "^19.2.18",
|
|
49
52
|
"react": "19.1.0",
|
|
50
|
-
"typescript": "^7.0.
|
|
53
|
+
"typescript": "^7.0.2",
|
|
51
54
|
"vitest": "^5.0.0",
|
|
52
|
-
"zod": "
|
|
55
|
+
"zod": "4.4.3"
|
|
53
56
|
}
|
|
54
57
|
}
|
package/paseo-plugin.json
CHANGED
|
@@ -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
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
?
|
|
92
|
-
:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
115
|
-
|
|
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({
|
|
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
|
]),
|