@laoyuehanni/dsh-git-worktree 0.4.8 → 0.4.9

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/lib/wire.d.ts CHANGED
@@ -24,10 +24,21 @@ export declare const ROUTE_BRANCH_RENAME = "/plugin/git-worktree/branch-rename";
24
24
  /** POST ROUTE_PREFIX/branch-delete — delete a LOCAL branch (`-d`, merged
25
25
  * only; git refuses the rest). */
26
26
  export declare const ROUTE_BRANCH_DELETE = "/plugin/git-worktree/branch-delete";
27
- /** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune). */
27
+ /** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune).
28
+ * Streams {@link SyncFrame} lines (NDJSON) so a long transfer can show progress. */
28
29
  export declare const ROUTE_FETCH = "/plugin/git-worktree/fetch";
29
- /** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream. */
30
+ /** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream.
31
+ * Streams {@link SyncFrame} lines (NDJSON), like {@link ROUTE_FETCH}. */
30
32
  export declare const ROUTE_UPDATE = "/plugin/git-worktree/update";
33
+ /** POST push-plan — resolve the selected branch's push destination. */
34
+ export declare const ROUTE_PUSH_PLAN = "/plugin/git-worktree/push-plan";
35
+ /** POST push-preview — inspect one explicit destination without pushing. */
36
+ export declare const ROUTE_PUSH_PREVIEW = "/plugin/git-worktree/push-preview";
37
+ /** POST push — push one explicit local branch. Streams {@link SyncFrame}
38
+ * lines (NDJSON), like {@link ROUTE_FETCH}; the `done` body is a
39
+ * {@link PushResult}. A cancel (499) kills `git push`; the remote only moves
40
+ * a ref once the whole pack has arrived, so a stopped transfer changes nothing. */
41
+ export declare const ROUTE_PUSH = "/plugin/git-worktree/push";
31
42
  /** POST ROUTE_PREFIX/group — git belonging facts for a batch of workspace paths. */
32
43
  export declare const ROUTE_GROUP = "/plugin/git-worktree/group";
33
44
  /** POST ROUTE_PREFIX/inspect — pre-delete facts for one worktree directory. */
@@ -54,6 +65,59 @@ export interface BranchEntry {
54
65
  ahead?: number;
55
66
  /** Commits the local branch is BEHIND its upstream (same conditions). */
56
67
  behind?: number;
68
+ /** Configured upstream; absent means unpublished, not synchronized. */
69
+ upstream?: string;
70
+ /** The configured upstream no longer exists in the local tracking refs. */
71
+ upstreamGone?: true;
72
+ }
73
+ export interface PushPlanBody {
74
+ repoPath: string;
75
+ branch: string;
76
+ }
77
+ export interface PushPlan {
78
+ branch: string;
79
+ remotes: string[];
80
+ remote: string;
81
+ target: string;
82
+ /** Publishing or changing the tracking destination requires a target dialog. */
83
+ confirm: boolean;
84
+ upstream?: string;
85
+ /** `/push-plan` only: display-only snapshot of the default destination from
86
+ * local refs, so opening the push window needs one request, not two. Absent
87
+ * when it could not be built; never a substitute for the verified preview. */
88
+ local?: PushPreview;
89
+ }
90
+ export interface PushBody extends PushPlanBody {
91
+ /** Both present only after the user confirms the publish destination. */
92
+ remote?: string;
93
+ target?: string;
94
+ tags?: 'none' | 'all' | 'follow';
95
+ /** Force only the destination branch, leased against the previewed OID. */
96
+ force?: boolean;
97
+ /** Empty string means the remote branch did not exist in the preview. */
98
+ expectedTarget?: string;
99
+ sourceOid?: string;
100
+ }
101
+ export interface PushPreviewBody extends PushPlanBody {
102
+ remote: string;
103
+ target: string;
104
+ /** Approximate display-only preview from local tracking refs; never contacts the remote. */
105
+ localOnly?: boolean;
106
+ }
107
+ export interface PushPreview {
108
+ sourceOid: string;
109
+ targetOid: string | null;
110
+ commits: {
111
+ oid: string;
112
+ subject: string;
113
+ }[];
114
+ total: number;
115
+ truncated: boolean;
116
+ }
117
+ export interface PushResult {
118
+ branch: string;
119
+ remote: string;
120
+ target: string;
57
121
  }
58
122
  /** One existing worktree of the repository. */
59
123
  export interface WorktreeEntry {
@@ -228,6 +292,35 @@ export interface UpdateResult {
228
292
  /** False when the upstream already contained the branch (nothing moved). */
229
293
  updated: boolean;
230
294
  }
295
+ /** Content type of a streamed route: one JSON {@link SyncFrame} per line. */
296
+ export declare const NDJSON_TYPE = "application/x-ndjson";
297
+ /**
298
+ * A live event of a long route while it still runs.
299
+ * - `progress` is git's own progress line (`Receiving objects: 3% (2147/58680),
300
+ * 708.01 KiB | 128.00 KiB/s`) with its percentage when it has one, and the
301
+ * remote being fetched (the host fetches them one by one and names each
302
+ * ahead of its counter lines);
303
+ * - `merge` marks the switch from fetching to the fast-forward, the one step
304
+ * that can no longer be cancelled.
305
+ */
306
+ export type SyncEvent = {
307
+ type: 'progress';
308
+ text: string;
309
+ percent?: number;
310
+ remote?: string;
311
+ } | {
312
+ type: 'merge';
313
+ };
314
+ /**
315
+ * One line of a streamed route response. The last line is always `done`,
316
+ * carrying the status and body the same route would have answered in one piece
317
+ * (the result, or a {@link RouteError}); a stream that ends without it was cut.
318
+ */
319
+ export type SyncFrame = SyncEvent | {
320
+ type: 'done';
321
+ status: number;
322
+ body: unknown;
323
+ };
231
324
  /** Error envelope every non-2xx response carries. */
232
325
  export interface RouteError {
233
326
  error: string;
package/lib/wire.js CHANGED
@@ -24,10 +24,21 @@ export const ROUTE_BRANCH_RENAME = `${ROUTE_PREFIX}/branch-rename`;
24
24
  /** POST ROUTE_PREFIX/branch-delete — delete a LOCAL branch (`-d`, merged
25
25
  * only; git refuses the rest). */
26
26
  export const ROUTE_BRANCH_DELETE = `${ROUTE_PREFIX}/branch-delete`;
27
- /** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune). */
27
+ /** POST ROUTE_PREFIX/fetch — sync remote-tracking refs (fetch every remote + prune).
28
+ * Streams {@link SyncFrame} lines (NDJSON) so a long transfer can show progress. */
28
29
  export const ROUTE_FETCH = `${ROUTE_PREFIX}/fetch`;
29
- /** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream. */
30
+ /** POST ROUTE_PREFIX/update — fast-forward the current branch to its upstream.
31
+ * Streams {@link SyncFrame} lines (NDJSON), like {@link ROUTE_FETCH}. */
30
32
  export const ROUTE_UPDATE = `${ROUTE_PREFIX}/update`;
33
+ /** POST push-plan — resolve the selected branch's push destination. */
34
+ export const ROUTE_PUSH_PLAN = `${ROUTE_PREFIX}/push-plan`;
35
+ /** POST push-preview — inspect one explicit destination without pushing. */
36
+ export const ROUTE_PUSH_PREVIEW = `${ROUTE_PREFIX}/push-preview`;
37
+ /** POST push — push one explicit local branch. Streams {@link SyncFrame}
38
+ * lines (NDJSON), like {@link ROUTE_FETCH}; the `done` body is a
39
+ * {@link PushResult}. A cancel (499) kills `git push`; the remote only moves
40
+ * a ref once the whole pack has arrived, so a stopped transfer changes nothing. */
41
+ export const ROUTE_PUSH = `${ROUTE_PREFIX}/push`;
31
42
  /** POST ROUTE_PREFIX/group — git belonging facts for a batch of workspace paths. */
32
43
  export const ROUTE_GROUP = `${ROUTE_PREFIX}/group`;
33
44
  /** POST ROUTE_PREFIX/inspect — pre-delete facts for one worktree directory. */
@@ -44,3 +55,5 @@ export const ROUTE_WORKTREES_ALL = `${ROUTE_PREFIX}/worktrees-all`;
44
55
  /** POST ROUTE_PREFIX/purge — delete a NON-git directory sitting DIRECTLY in
45
56
  * the storage root (an orphaned leftover whose .git is already gone). */
46
57
  export const ROUTE_PURGE = `${ROUTE_PREFIX}/purge`;
58
+ /** Content type of a streamed route: one JSON {@link SyncFrame} per line. */
59
+ export const NDJSON_TYPE = 'application/x-ndjson';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laoyuehanni/dsh-git-worktree",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "DSH plugin: branch visibility and git worktree isolation for Web UI sessions",
5
5
  "keywords": [
6
6
  "dsh",
@@ -65,6 +65,15 @@
65
65
  ]
66
66
  }
67
67
  },
68
+ "scripts": {
69
+ "build": "tsc -p tsconfig.json",
70
+ "build:client": "tsdown",
71
+ "build:all": "pnpm run build && pnpm run build:client",
72
+ "watch:client": "tsdown --watch",
73
+ "test": "vitest run",
74
+ "typecheck": "tsc -p tsconfig.client.json --noEmit",
75
+ "prepublishOnly": "pnpm run typecheck && pnpm test && pnpm run build:all"
76
+ },
68
77
  "peerDependencies": {
69
78
  "@deepseek-ai/cordis": "^4.0.4",
70
79
  "@deepseek-ai/dsh-host-webserver": "^0.2.0-rc.1",
@@ -129,12 +138,5 @@
129
138
  "engines": {
130
139
  "node": ">=22.19"
131
140
  },
132
- "scripts": {
133
- "build": "tsc -p tsconfig.json",
134
- "build:client": "tsdown",
135
- "build:all": "pnpm run build && pnpm run build:client",
136
- "watch:client": "tsdown --watch",
137
- "test": "vitest run",
138
- "typecheck": "tsc -p tsconfig.client.json --noEmit"
139
- }
140
- }
141
+ "packageManager": "pnpm@11.8.0"
142
+ }