@yu_robotics/remote-cli 1.6.26 → 1.6.32
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 +8 -8
- package/dist/client/MessageHandler.d.ts +5 -3
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +57 -26
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/commands/start.d.ts +7 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +29 -8
- package/dist/commands/start.js.map +1 -1
- package/dist/config/ConfigManager.d.ts +2 -0
- package/dist/config/ConfigManager.d.ts.map +1 -1
- package/dist/config/ConfigManager.js +34 -2
- package/dist/config/ConfigManager.js.map +1 -1
- package/dist/executor/AcpExecutor.d.ts +79 -0
- package/dist/executor/AcpExecutor.d.ts.map +1 -0
- package/dist/executor/AcpExecutor.js +532 -0
- package/dist/executor/AcpExecutor.js.map +1 -0
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +2 -1
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/KimiExecutor.d.ts +18 -0
- package/dist/executor/KimiExecutor.d.ts.map +1 -0
- package/dist/executor/KimiExecutor.js +28 -0
- package/dist/executor/KimiExecutor.js.map +1 -0
- package/dist/executor/OpenCodeExecutor.d.ts +19 -0
- package/dist/executor/OpenCodeExecutor.d.ts.map +1 -0
- package/dist/executor/OpenCodeExecutor.js +28 -0
- package/dist/executor/OpenCodeExecutor.js.map +1 -0
- package/dist/executor/ZCodeExecutor.d.ts +20 -0
- package/dist/executor/ZCodeExecutor.d.ts.map +1 -0
- package/dist/executor/ZCodeExecutor.js +37 -0
- package/dist/executor/ZCodeExecutor.js.map +1 -0
- package/dist/executor/acp/AcpClient.d.ts +50 -40
- package/dist/executor/acp/AcpClient.d.ts.map +1 -1
- package/dist/executor/acp/AcpClient.js +113 -189
- package/dist/executor/acp/AcpClient.js.map +1 -1
- package/dist/executor/acp/AcpTypes.d.ts +27 -68
- package/dist/executor/acp/AcpTypes.d.ts.map +1 -1
- package/dist/executor/acp/AcpTypes.js +0 -9
- package/dist/executor/acp/AcpTypes.js.map +1 -1
- package/dist/executor/index.d.ts +8 -13
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +55 -78
- package/dist/executor/index.js.map +1 -1
- package/dist/executor/zcode/ZCodeClient.d.ts +73 -0
- package/dist/executor/zcode/ZCodeClient.d.ts.map +1 -0
- package/dist/executor/zcode/ZCodeClient.js +681 -0
- package/dist/executor/zcode/ZCodeClient.js.map +1 -0
- package/dist/executor/zcode/ZCodeCommand.d.ts +9 -0
- package/dist/executor/zcode/ZCodeCommand.d.ts.map +1 -0
- package/dist/executor/zcode/ZCodeCommand.js +122 -0
- package/dist/executor/zcode/ZCodeCommand.js.map +1 -0
- package/dist/thread/ThreadExecutorPool.js +2 -2
- package/dist/thread/ThreadExecutorPool.js.map +1 -1
- package/dist/thread/types.d.ts +1 -1
- package/dist/thread/types.d.ts.map +1 -1
- package/dist/types/config.d.ts +30 -16
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +8 -2
- package/dist/types/config.js.map +1 -1
- package/package.json +2 -2
- package/dist/executor/ClaudeExecutor.d.ts +0 -93
- package/dist/executor/ClaudeExecutor.d.ts.map +0 -1
- package/dist/executor/ClaudeExecutor.js +0 -380
- package/dist/executor/ClaudeExecutor.js.map +0 -1
- package/dist/executor/CodexExecutor.d.ts +0 -140
- package/dist/executor/CodexExecutor.d.ts.map +0 -1
- package/dist/executor/CodexExecutor.js +0 -789
- package/dist/executor/CodexExecutor.js.map +0 -1
- package/dist/executor/GeminiExecutor.d.ts +0 -93
- package/dist/executor/GeminiExecutor.d.ts.map +0 -1
- package/dist/executor/GeminiExecutor.js +0 -415
- package/dist/executor/GeminiExecutor.js.map +0 -1
- package/dist/executor/acp/SessionManager.d.ts +0 -41
- package/dist/executor/acp/SessionManager.d.ts.map +0 -1
- package/dist/executor/acp/SessionManager.js +0 -152
- package/dist/executor/acp/SessionManager.js.map +0 -1
- package/dist/utils/processUtils.d.ts +0 -16
- package/dist/utils/processUtils.d.ts.map +0 -1
- package/dist/utils/processUtils.js +0 -37
- package/dist/utils/processUtils.js.map +0 -1
- package/dist/worktree/WorktreeManager.d.ts +0 -119
- package/dist/worktree/WorktreeManager.d.ts.map +0 -1
- package/dist/worktree/WorktreeManager.js +0 -451
- package/dist/worktree/WorktreeManager.js.map +0 -1
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SessionManager = void 0;
|
|
37
|
-
const fs = __importStar(require("fs"));
|
|
38
|
-
const path = __importStar(require("path"));
|
|
39
|
-
const os = __importStar(require("os"));
|
|
40
|
-
/**
|
|
41
|
-
* Persists Gemini conversation history as JSONL files for multi-turn context replay.
|
|
42
|
-
*
|
|
43
|
-
* Storage: ~/.remote-cli/gemini-sessions/{sessionId}.jsonl
|
|
44
|
-
* Each line: {"role":"user"|"assistant","text":"...","ts":1234567890}
|
|
45
|
-
*
|
|
46
|
-
* ACP's session/resume is experimental, so we use history replay instead —
|
|
47
|
-
* the same approach used by vibe-kanban.
|
|
48
|
-
*/
|
|
49
|
-
class SessionManager {
|
|
50
|
-
baseDir;
|
|
51
|
-
constructor(baseDir) {
|
|
52
|
-
this.baseDir = baseDir ?? path.join(os.homedir(), '.remote-cli', 'gemini-sessions');
|
|
53
|
-
fs.mkdirSync(this.baseDir, { recursive: true });
|
|
54
|
-
}
|
|
55
|
-
filePath(sessionId) {
|
|
56
|
-
return path.join(this.baseDir, `${sessionId}.jsonl`);
|
|
57
|
-
}
|
|
58
|
-
append(sessionId, role, text) {
|
|
59
|
-
const file = this.filePath(sessionId);
|
|
60
|
-
// If we're appending a user prompt, avoid duplicating the exact same prompt
|
|
61
|
-
// that might be stuck at the end of the history due to a previous failed turn (e.g. Prompt too long error).
|
|
62
|
-
if (role === 'user' && fs.existsSync(file)) {
|
|
63
|
-
const lines = fs.readFileSync(file, 'utf8').trim().split('\n').filter(Boolean);
|
|
64
|
-
if (lines.length > 0) {
|
|
65
|
-
try {
|
|
66
|
-
const lastEntry = JSON.parse(lines[lines.length - 1]);
|
|
67
|
-
if (lastEntry.role === 'user' && lastEntry.text === text) {
|
|
68
|
-
// Last entry is identical, do not append again
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
// Ignore JSON parse errors
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
const entry = { role, text, ts: Date.now() };
|
|
78
|
-
fs.appendFileSync(file, JSON.stringify(entry) + '\n', 'utf8');
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Build a context prefix that replays prior conversation history.
|
|
82
|
-
* Returns empty string if no history exists yet.
|
|
83
|
-
*/
|
|
84
|
-
buildResumeContext(sessionId) {
|
|
85
|
-
const file = this.filePath(sessionId);
|
|
86
|
-
if (!fs.existsSync(file))
|
|
87
|
-
return '';
|
|
88
|
-
const lines = fs.readFileSync(file, 'utf8').trim().split('\n').filter(Boolean);
|
|
89
|
-
if (lines.length === 0)
|
|
90
|
-
return '';
|
|
91
|
-
const entries = lines.map((l) => JSON.parse(l));
|
|
92
|
-
const formatted = entries
|
|
93
|
-
.map((e) => (e.role === 'user' ? `[User]: ${e.text}` : `[Assistant]: ${e.text}`))
|
|
94
|
-
.join('\n');
|
|
95
|
-
return `=== PREVIOUS CONVERSATION ===\n${formatted}\n=== NEW REQUEST ===\n`;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Removes the last entry in the session history if it belongs to the user.
|
|
99
|
-
* Useful when an execution fails and we want to retry without duplicating the prompt.
|
|
100
|
-
*/
|
|
101
|
-
popLastUserEntry(sessionId) {
|
|
102
|
-
const file = this.filePath(sessionId);
|
|
103
|
-
if (!fs.existsSync(file))
|
|
104
|
-
return;
|
|
105
|
-
const lines = fs.readFileSync(file, 'utf8').trim().split('\n').filter(Boolean);
|
|
106
|
-
if (lines.length === 0)
|
|
107
|
-
return;
|
|
108
|
-
try {
|
|
109
|
-
const lastLine = lines[lines.length - 1];
|
|
110
|
-
const lastEntry = JSON.parse(lastLine);
|
|
111
|
-
if (lastEntry.role === 'user') {
|
|
112
|
-
const kept = lines.slice(0, lines.length - 1);
|
|
113
|
-
fs.writeFileSync(file, kept.join('\n') + (kept.length > 0 ? '\n' : ''), 'utf8');
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
// Ignore parse errors
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
clear(sessionId) {
|
|
121
|
-
const file = this.filePath(sessionId);
|
|
122
|
-
if (fs.existsSync(file)) {
|
|
123
|
-
fs.writeFileSync(file, '', 'utf8');
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Truncate session history to the most recent `keepCount` entries.
|
|
128
|
-
* Used by GeminiExecutor's compactWhenFull to reduce context size while
|
|
129
|
-
* preserving recent conversation turns.
|
|
130
|
-
*
|
|
131
|
-
* @returns The number of entries removed.
|
|
132
|
-
*/
|
|
133
|
-
truncate(sessionId, keepCount) {
|
|
134
|
-
const file = this.filePath(sessionId);
|
|
135
|
-
if (!fs.existsSync(file))
|
|
136
|
-
return 0;
|
|
137
|
-
const lines = fs.readFileSync(file, 'utf8').trim().split('\n').filter(Boolean);
|
|
138
|
-
if (lines.length <= keepCount)
|
|
139
|
-
return 0;
|
|
140
|
-
const kept = lines.slice(lines.length - keepCount);
|
|
141
|
-
fs.writeFileSync(file, kept.join('\n') + '\n', 'utf8');
|
|
142
|
-
return lines.length - keepCount;
|
|
143
|
-
}
|
|
144
|
-
remove(sessionId) {
|
|
145
|
-
const file = this.filePath(sessionId);
|
|
146
|
-
if (fs.existsSync(file)) {
|
|
147
|
-
fs.unlinkSync(file);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
exports.SessionManager = SessionManager;
|
|
152
|
-
//# sourceMappingURL=SessionManager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionManager.js","source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;;;;;;OAMG;IACH,QAAQ,CAAC,SAAiB,EAAE,SAAiB;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,CAAC;QAEnC,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC/E,IAAI,KAAK,CAAC,MAAM,IAAI,SAAS;YAAE,OAAO,CAAC,CAAC;QAExC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;QACnD,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;QACvD,OAAO,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,SAAiB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF;AA/GD,wCA+GC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns true if the current process is running in the background
|
|
3
|
-
* (i.e. not the foreground process group of the controlling terminal).
|
|
4
|
-
*
|
|
5
|
-
* Works on Linux by reading /proc/self/stat:
|
|
6
|
-
* field[4] = pgrp (our process group ID)
|
|
7
|
-
* field[7] = tpgid (foreground process group of the controlling terminal)
|
|
8
|
-
*
|
|
9
|
-
* If tpgid == -1, there is no controlling terminal (nohup / systemd / pipe) —
|
|
10
|
-
* the process is also treated as "background" since stdin prompts won't work.
|
|
11
|
-
*
|
|
12
|
-
* Falls back to false (assume foreground) on non-Linux systems or if /proc
|
|
13
|
-
* is unavailable.
|
|
14
|
-
*/
|
|
15
|
-
export declare function isBackgroundProcess(): boolean;
|
|
16
|
-
//# sourceMappingURL=processUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processUtils.d.ts","sourceRoot":"","sources":["../../src/utils/processUtils.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAa7C"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isBackgroundProcess = isBackgroundProcess;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
/**
|
|
9
|
-
* Returns true if the current process is running in the background
|
|
10
|
-
* (i.e. not the foreground process group of the controlling terminal).
|
|
11
|
-
*
|
|
12
|
-
* Works on Linux by reading /proc/self/stat:
|
|
13
|
-
* field[4] = pgrp (our process group ID)
|
|
14
|
-
* field[7] = tpgid (foreground process group of the controlling terminal)
|
|
15
|
-
*
|
|
16
|
-
* If tpgid == -1, there is no controlling terminal (nohup / systemd / pipe) —
|
|
17
|
-
* the process is also treated as "background" since stdin prompts won't work.
|
|
18
|
-
*
|
|
19
|
-
* Falls back to false (assume foreground) on non-Linux systems or if /proc
|
|
20
|
-
* is unavailable.
|
|
21
|
-
*/
|
|
22
|
-
function isBackgroundProcess() {
|
|
23
|
-
try {
|
|
24
|
-
const stat = fs_1.default.readFileSync('/proc/self/stat', 'utf8');
|
|
25
|
-
const fields = stat.split(' ');
|
|
26
|
-
const pgrp = parseInt(fields[4], 10); // process group ID
|
|
27
|
-
const tpgid = parseInt(fields[7], 10); // terminal foreground process group
|
|
28
|
-
// tpgid === -1: no controlling terminal (nohup, systemd, etc.)
|
|
29
|
-
// pgrp !== tpgid: we are a background process group
|
|
30
|
-
return tpgid === -1 || pgrp !== tpgid;
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
// /proc not available (macOS, non-Linux) — fall back to false
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=processUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processUtils.js","sourceRoot":"","sources":["../../src/utils/processUtils.ts"],"names":[],"mappings":";;;;;AAgBA,kDAaC;AA7BD,4CAAoB;AAEpB;;;;;;;;;;;;;GAaG;AACH,SAAgB,mBAAmB;IACjC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,YAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QACxD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAG,mBAAmB;QAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAE,oCAAoC;QAC5E,+DAA+D;QAC/D,oDAAoD;QACpD,OAAO,KAAK,KAAK,CAAC,CAAC,IAAI,IAAI,KAAK,KAAK,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Information about a git worktree
|
|
3
|
-
*/
|
|
4
|
-
export interface WorktreeInfo {
|
|
5
|
-
path: string;
|
|
6
|
-
branch: string;
|
|
7
|
-
commit: string;
|
|
8
|
-
sessionId: string | null;
|
|
9
|
-
isMain: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Git Worktree Manager
|
|
13
|
-
* Manages git worktrees for isolating Claude Code sessions
|
|
14
|
-
*/
|
|
15
|
-
export declare class WorktreeManager {
|
|
16
|
-
constructor();
|
|
17
|
-
/**
|
|
18
|
-
* Create a new worktree for a session
|
|
19
|
-
* @param mainRepoPath Path to the main repository
|
|
20
|
-
* @param sessionId Session UUID
|
|
21
|
-
* @returns Path to the created worktree
|
|
22
|
-
*/
|
|
23
|
-
createWorktree(mainRepoPath: string, sessionId: string): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Create a new worktree with timestamp-based naming
|
|
26
|
-
* @param mainRepoPath Path to the main repository
|
|
27
|
-
* @param timestamp Timestamp string (e.g., "2026-02-17T14-30-00")
|
|
28
|
-
* @returns Path to the created worktree
|
|
29
|
-
*/
|
|
30
|
-
createWorktreeWithTimestamp(mainRepoPath: string, timestamp: string): Promise<string>;
|
|
31
|
-
/**
|
|
32
|
-
* Get worktree path for a session
|
|
33
|
-
* @param mainRepoPath Path to the main repository
|
|
34
|
-
* @param sessionId Session UUID
|
|
35
|
-
* @returns Worktree path if exists, null otherwise
|
|
36
|
-
*/
|
|
37
|
-
getWorktreePath(mainRepoPath: string, sessionId: string): string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Get existing worktree for session or create new one
|
|
40
|
-
* @param mainRepoPath Path to the main repository
|
|
41
|
-
* @param sessionId Session UUID
|
|
42
|
-
* @returns Path to the worktree
|
|
43
|
-
*/
|
|
44
|
-
getOrCreateWorktree(mainRepoPath: string, sessionId: string): Promise<string>;
|
|
45
|
-
/**
|
|
46
|
-
* List all worktrees for a repository
|
|
47
|
-
* @param mainRepoPath Path to the main repository
|
|
48
|
-
* @returns Array of worktree information
|
|
49
|
-
*/
|
|
50
|
-
listWorktrees(mainRepoPath: string): Promise<WorktreeInfo[]>;
|
|
51
|
-
/**
|
|
52
|
-
* Remove a worktree
|
|
53
|
-
* @param worktreePath Path to the worktree to remove
|
|
54
|
-
* @param mainRepoPath Path to the main repository (for branch deletion)
|
|
55
|
-
*/
|
|
56
|
-
removeWorktree(worktreePath: string, mainRepoPath?: string): Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* Check if a directory is a git worktree
|
|
59
|
-
* @param dirPath Directory path to check
|
|
60
|
-
* @returns true if directory is a worktree
|
|
61
|
-
*/
|
|
62
|
-
isWorktree(dirPath: string): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Check if a directory is a git repository
|
|
65
|
-
* @param dirPath Directory path to check
|
|
66
|
-
* @returns true if directory contains .git
|
|
67
|
-
*/
|
|
68
|
-
isGitRepository(dirPath: string): boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Prune stale worktrees older than specified age
|
|
71
|
-
* @param mainRepoPath Path to the main repository
|
|
72
|
-
* @param maxAgeDays Maximum age in days (default: 7)
|
|
73
|
-
* @returns Number of worktrees removed
|
|
74
|
-
*/
|
|
75
|
-
pruneStaleWorktrees(mainRepoPath: string, maxAgeDays?: number): Promise<number>;
|
|
76
|
-
/**
|
|
77
|
-
* Get main repository path from a worktree path
|
|
78
|
-
* @param worktreePath Path to the worktree
|
|
79
|
-
* @returns Main repository path
|
|
80
|
-
*/
|
|
81
|
-
getMainRepoPath(worktreePath: string): Promise<string>;
|
|
82
|
-
/**
|
|
83
|
-
* Get current branch name of a repository
|
|
84
|
-
* @param repoPath Path to the repository
|
|
85
|
-
* @returns Branch name or null if detached HEAD
|
|
86
|
-
*/
|
|
87
|
-
private getCurrentBranch;
|
|
88
|
-
/**
|
|
89
|
-
* Prune stale worktree references
|
|
90
|
-
* @param mainRepoPath Path to the main repository
|
|
91
|
-
*/
|
|
92
|
-
private pruneWorktreeReferences;
|
|
93
|
-
/**
|
|
94
|
-
* Get branch name of a worktree
|
|
95
|
-
* @param worktreePath Path to the worktree
|
|
96
|
-
* @returns Branch name or null if not found
|
|
97
|
-
*/
|
|
98
|
-
private getWorktreeBranch;
|
|
99
|
-
/**
|
|
100
|
-
* Parse git worktree list --porcelain output
|
|
101
|
-
* @param output Output from git worktree list --porcelain
|
|
102
|
-
* @returns Array of worktree information
|
|
103
|
-
*/
|
|
104
|
-
private parseWorktreeList;
|
|
105
|
-
/**
|
|
106
|
-
* Finalize worktree info by extracting session ID
|
|
107
|
-
* @param info Partial worktree info
|
|
108
|
-
* @returns Complete worktree info
|
|
109
|
-
*/
|
|
110
|
-
private finalizeWorktreeInfo;
|
|
111
|
-
/**
|
|
112
|
-
* Execute git command
|
|
113
|
-
* @param args Git command arguments
|
|
114
|
-
* @param options Spawn options
|
|
115
|
-
* @returns Command stdout
|
|
116
|
-
*/
|
|
117
|
-
private execGit;
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=WorktreeManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WorktreeManager.d.ts","sourceRoot":"","sources":["../../src/worktree/WorktreeManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,qBAAa,eAAe;;IAK1B;;;;;OAKG;IACG,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA0D9E;;;;;OAKG;IACG,2BAA2B,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgD3F;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAYvE;;;;;OAKG;IAC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