glab-agent 0.2.2 → 0.2.3
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/package.json
CHANGED
|
@@ -981,7 +981,8 @@ function createDependencies(config: LocalAgentConfig, logger?: Logger): WatcherD
|
|
|
981
981
|
stateStore: new FileStateStore(config.statePath),
|
|
982
982
|
worktreeManager: new WorktreeManager({
|
|
983
983
|
repoPath: config.agentRepoPath,
|
|
984
|
-
worktreeRoot: config.agentWorktreeRoot
|
|
984
|
+
worktreeRoot: config.agentWorktreeRoot,
|
|
985
|
+
agentName: config.agentDefinition?.name
|
|
985
986
|
}),
|
|
986
987
|
agentRunner,
|
|
987
988
|
logger
|
|
@@ -13,6 +13,7 @@ export interface WorktreeInfo {
|
|
|
13
13
|
interface WorktreeManagerOptions {
|
|
14
14
|
repoPath: string;
|
|
15
15
|
worktreeRoot: string;
|
|
16
|
+
agentName?: string;
|
|
16
17
|
execFileImpl?: typeof execFileAsync;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -28,8 +29,9 @@ export function slugifyTitle(title: string): string {
|
|
|
28
29
|
return (slug || "task").slice(0, 48);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export function branchNameForIssue(issueIid: number, title: string): string {
|
|
32
|
-
|
|
32
|
+
export function branchNameForIssue(issueIid: number, title: string, agentName?: string): string {
|
|
33
|
+
const prefix = agentName ?? "agent";
|
|
34
|
+
return `${prefix}/issue-${issueIid}-${slugifyTitle(title)}`;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export function worktreePathForIssue(worktreeRoot: string, issueIid: number, title: string): string {
|
|
@@ -41,16 +43,19 @@ export class WorktreeManager {
|
|
|
41
43
|
|
|
42
44
|
private readonly worktreeRoot: string;
|
|
43
45
|
|
|
46
|
+
private readonly agentName: string | undefined;
|
|
47
|
+
|
|
44
48
|
private readonly execFileImpl: typeof execFileAsync;
|
|
45
49
|
|
|
46
50
|
constructor(options: WorktreeManagerOptions) {
|
|
47
51
|
this.repoPath = options.repoPath;
|
|
48
52
|
this.worktreeRoot = options.worktreeRoot;
|
|
53
|
+
this.agentName = options.agentName;
|
|
49
54
|
this.execFileImpl = options.execFileImpl ?? execFileAsync;
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
async ensureWorktree(issueIid: number, title: string): Promise<WorktreeInfo> {
|
|
53
|
-
const branch = branchNameForIssue(issueIid, title);
|
|
58
|
+
const branch = branchNameForIssue(issueIid, title, this.agentName);
|
|
54
59
|
const worktreePath = worktreePathForIssue(this.worktreeRoot, issueIid, title);
|
|
55
60
|
|
|
56
61
|
await mkdir(this.worktreeRoot, { recursive: true });
|