@colin4k1024/tsp 2.4.3 → 2.4.4
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
|
@@ -87,7 +87,9 @@ function dedupeRecentSessions(searchDirs) {
|
|
|
87
87
|
* Priority (highest to lowest):
|
|
88
88
|
* 1. Exact worktree (cwd) match — most recent
|
|
89
89
|
* 2. Same project name match — most recent
|
|
90
|
-
*
|
|
90
|
+
*
|
|
91
|
+
* If neither matches, returns null so that a fresh project never receives
|
|
92
|
+
* another project's session context.
|
|
91
93
|
*
|
|
92
94
|
* Sessions are already sorted newest-first, so the first match in each
|
|
93
95
|
* category wins.
|
|
@@ -107,19 +109,11 @@ function selectMatchingSession(sessions, cwd, currentProject) {
|
|
|
107
109
|
|
|
108
110
|
let projectMatch = null;
|
|
109
111
|
let projectMatchContent = null;
|
|
110
|
-
let fallbackSession = null;
|
|
111
|
-
let fallbackContent = null;
|
|
112
112
|
|
|
113
113
|
for (const session of sessions) {
|
|
114
114
|
const content = readFile(session.path);
|
|
115
115
|
if (!content) continue;
|
|
116
116
|
|
|
117
|
-
// Cache first readable session+content pair for fallback
|
|
118
|
-
if (!fallbackSession) {
|
|
119
|
-
fallbackSession = session;
|
|
120
|
-
fallbackContent = content;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
117
|
// Extract **Worktree:** field
|
|
124
118
|
const worktreeMatch = content.match(/\*\*Worktree:\*\*\s*(.+)$/m);
|
|
125
119
|
const sessionWorktree = worktreeMatch ? worktreeMatch[1].trim() : '';
|
|
@@ -145,12 +139,7 @@ function selectMatchingSession(sessions, cwd, currentProject) {
|
|
|
145
139
|
return { session: projectMatch, content: projectMatchContent, matchReason: 'project' };
|
|
146
140
|
}
|
|
147
141
|
|
|
148
|
-
//
|
|
149
|
-
if (fallbackSession) {
|
|
150
|
-
return { session: fallbackSession, content: fallbackContent, matchReason: 'recency-fallback' };
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
log('[SessionStart] All session files were unreadable');
|
|
142
|
+
// No match found — do not inject another project's session context
|
|
154
143
|
return null;
|
|
155
144
|
}
|
|
156
145
|
|
|
@@ -186,7 +175,7 @@ async function main() {
|
|
|
186
175
|
additionalContextParts.push(`Previous session summary:\n${content}`);
|
|
187
176
|
}
|
|
188
177
|
} else {
|
|
189
|
-
log(
|
|
178
|
+
log(`[SessionStart] No session matched current project (${currentProject || cwd}); skipping context injection`);
|
|
190
179
|
}
|
|
191
180
|
}
|
|
192
181
|
|