santree 0.0.13 → 0.0.14
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/commands/statusline.js +1 -1
- package/dist/lib/git.d.ts +0 -2
- package/dist/lib/git.js +5 -3
- package/package.json +1 -1
|
@@ -132,7 +132,7 @@ function formatChanges(changes) {
|
|
|
132
132
|
// Build statusline for santree worktree
|
|
133
133
|
function buildSantreeStatusline(cwd, metadata, model, usedPercentage) {
|
|
134
134
|
const parts = [];
|
|
135
|
-
const branch =
|
|
135
|
+
const branch = git(cwd, "rev-parse --abbrev-ref HEAD") || "unknown";
|
|
136
136
|
// Ticket ID (prominent)
|
|
137
137
|
const ticketId = extractTicketId(branch);
|
|
138
138
|
if (ticketId) {
|
package/dist/lib/git.d.ts
CHANGED
|
@@ -25,9 +25,7 @@ export declare function removeWorktree(branchName: string, repoRoot: string, for
|
|
|
25
25
|
export declare function extractTicketId(branch: string): string | null;
|
|
26
26
|
export declare function getWorktreePath(branchName: string): string | null;
|
|
27
27
|
export declare function getWorktreeMetadata(worktreePath: string): {
|
|
28
|
-
branch_name?: string;
|
|
29
28
|
base_branch?: string;
|
|
30
|
-
created_at?: string;
|
|
31
29
|
} | null;
|
|
32
30
|
export declare function hasUncommittedChanges(): boolean;
|
|
33
31
|
export declare function hasStagedChanges(): boolean;
|
package/dist/lib/git.js
CHANGED
|
@@ -130,7 +130,11 @@ export function getWorktreesDir(repoRoot) {
|
|
|
130
130
|
return path.join(getSantreeDir(repoRoot), "worktrees");
|
|
131
131
|
}
|
|
132
132
|
export async function createWorktree(branchName, baseBranch, repoRoot) {
|
|
133
|
-
const
|
|
133
|
+
const ticketId = extractTicketId(branchName);
|
|
134
|
+
if (!ticketId) {
|
|
135
|
+
return { success: false, error: "No ticket ID found in branch name (expected pattern like TEAM-123)" };
|
|
136
|
+
}
|
|
137
|
+
const dirName = ticketId;
|
|
134
138
|
const worktreesDir = getWorktreesDir(repoRoot);
|
|
135
139
|
const worktreePath = path.join(worktreesDir, dirName);
|
|
136
140
|
if (fs.existsSync(worktreePath)) {
|
|
@@ -164,9 +168,7 @@ export async function createWorktree(branchName, baseBranch, repoRoot) {
|
|
|
164
168
|
}
|
|
165
169
|
// Save metadata
|
|
166
170
|
const metadata = {
|
|
167
|
-
branch_name: branchName,
|
|
168
171
|
base_branch: baseBranch,
|
|
169
|
-
created_at: new Date().toISOString(),
|
|
170
172
|
};
|
|
171
173
|
fs.writeFileSync(path.join(worktreePath, ".santree_metadata.json"), JSON.stringify(metadata, null, 2));
|
|
172
174
|
return { success: true, path: worktreePath };
|