@lovelybunch/api 1.0.28 → 1.0.29
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/dist/lib/git.d.ts +3 -2
- package/dist/lib/git.js +6 -4
- package/dist/routes/api/v1/git/index.js +16 -4
- package/package.json +3 -3
- package/static/assets/index-OVdzZMZV.js +631 -0
- package/static/index.html +1 -1
package/dist/lib/git.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ export declare function listBranches(): Promise<{
|
|
|
26
26
|
export declare function createBranch(name: string, from?: string): Promise<void>;
|
|
27
27
|
export declare function deleteBranch(name: string): Promise<void>;
|
|
28
28
|
export declare function pushCurrent(): Promise<string>;
|
|
29
|
-
export
|
|
29
|
+
export type PullStrategy = 'merge' | 'rebase' | 'ff-only';
|
|
30
|
+
export declare function pullCurrent(strategy?: PullStrategy): Promise<string>;
|
|
30
31
|
export interface WorktreeInfo {
|
|
31
32
|
name: string;
|
|
32
33
|
path: string;
|
|
@@ -45,4 +46,4 @@ export declare function commitInWorktree(name: string, message: string, files?:
|
|
|
45
46
|
commitHash?: string;
|
|
46
47
|
}>;
|
|
47
48
|
export declare function pushWorktree(name: string): Promise<string>;
|
|
48
|
-
export declare function pullWorktree(name: string): Promise<string>;
|
|
49
|
+
export declare function pullWorktree(name: string, strategy?: PullStrategy): Promise<string>;
|
package/dist/lib/git.js
CHANGED
|
@@ -107,8 +107,9 @@ export async function pushCurrent() {
|
|
|
107
107
|
const { stdout } = await runGit(['push']);
|
|
108
108
|
return stdout;
|
|
109
109
|
}
|
|
110
|
-
export async function pullCurrent() {
|
|
111
|
-
const
|
|
110
|
+
export async function pullCurrent(strategy = 'rebase') {
|
|
111
|
+
const args = strategy === 'rebase' ? ['pull', '--rebase'] : strategy === 'ff-only' ? ['pull', '--ff-only'] : ['pull', '--no-rebase'];
|
|
112
|
+
const { stdout } = await runGit(args);
|
|
112
113
|
return stdout;
|
|
113
114
|
}
|
|
114
115
|
export async function listWorktrees() {
|
|
@@ -193,9 +194,10 @@ export async function pushWorktree(name) {
|
|
|
193
194
|
const { stdout } = await runGit(['-C', wtPath, 'push']);
|
|
194
195
|
return stdout;
|
|
195
196
|
}
|
|
196
|
-
export async function pullWorktree(name) {
|
|
197
|
+
export async function pullWorktree(name, strategy = 'rebase') {
|
|
197
198
|
const found = await getWorktreeByName(name);
|
|
198
199
|
const wtPath = found ? found.path : await resolveSafeWorktreePath(name);
|
|
199
|
-
const
|
|
200
|
+
const args = strategy === 'rebase' ? ['-C', wtPath, 'pull', '--rebase'] : strategy === 'ff-only' ? ['-C', wtPath, 'pull', '--ff-only'] : ['-C', wtPath, 'pull', '--no-rebase'];
|
|
201
|
+
const { stdout } = await runGit(args);
|
|
200
202
|
return stdout;
|
|
201
203
|
}
|
|
@@ -83,8 +83,14 @@ app.post('/push', async (c) => {
|
|
|
83
83
|
});
|
|
84
84
|
app.post('/pull', async (c) => {
|
|
85
85
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
let mode;
|
|
87
|
+
try {
|
|
88
|
+
mode = await c.req.json();
|
|
89
|
+
}
|
|
90
|
+
catch { }
|
|
91
|
+
const strategy = mode?.strategy === 'ff-only' || mode?.strategy === 'merge' ? mode.strategy : 'rebase';
|
|
92
|
+
const result = await pullCurrent(strategy);
|
|
93
|
+
return c.json({ success: true, data: { strategy, result } });
|
|
88
94
|
}
|
|
89
95
|
catch (e) {
|
|
90
96
|
return c.json({ success: false, error: { message: e.message } }, 500);
|
|
@@ -165,8 +171,14 @@ app.post('/worktrees/:name/push', async (c) => {
|
|
|
165
171
|
app.post('/worktrees/:name/pull', async (c) => {
|
|
166
172
|
try {
|
|
167
173
|
const name = c.req.param('name');
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
let mode;
|
|
175
|
+
try {
|
|
176
|
+
mode = await c.req.json();
|
|
177
|
+
}
|
|
178
|
+
catch { }
|
|
179
|
+
const strategy = mode?.strategy === 'ff-only' || mode?.strategy === 'merge' ? mode.strategy : 'rebase';
|
|
180
|
+
const result = await pullWorktree(name, strategy);
|
|
181
|
+
return c.json({ success: true, data: { worktree: name, strategy, result } });
|
|
170
182
|
}
|
|
171
183
|
catch (e) {
|
|
172
184
|
return c.json({ success: false, error: { message: e.message } }, 500);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovelybunch/api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/server-with-static.js",
|
|
6
6
|
"exports": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@hono/node-server": "^1.13.7",
|
|
34
34
|
"@hono/node-ws": "^1.0.6",
|
|
35
|
-
"@lovelybunch/core": "^1.0.
|
|
36
|
-
"@lovelybunch/types": "^1.0.
|
|
35
|
+
"@lovelybunch/core": "^1.0.29",
|
|
36
|
+
"@lovelybunch/types": "^1.0.29",
|
|
37
37
|
"dotenv": "^17.2.1",
|
|
38
38
|
"fuse.js": "^7.0.0",
|
|
39
39
|
"gray-matter": "^4.0.3",
|