@towles/tool 0.0.117 → 0.0.119
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@towles/tool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.119",
|
|
4
4
|
"description": "One off quality of life scripts that I use on a daily basis.",
|
|
5
5
|
"homepage": "https://github.com/ChrisTowles/towles-tool#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"vitest": "^4.0.17"
|
|
79
79
|
},
|
|
80
80
|
"simple-git-hooks": {
|
|
81
|
-
"pre-commit": "
|
|
81
|
+
"pre-commit": "bun run format:check && bun run lint && bun run typecheck && claude plugin validate ."
|
|
82
82
|
},
|
|
83
83
|
"patchedDependencies": {
|
|
84
84
|
"prompts@2.4.2": "patches/prompts.patch"
|
|
@@ -133,18 +133,36 @@ export function startServer(
|
|
|
133
133
|
const map = getDirSessionMap();
|
|
134
134
|
const direct = map.get(projectDir);
|
|
135
135
|
if (direct) return direct;
|
|
136
|
+
// Find the most specific (longest) matching session dir.
|
|
137
|
+
// Without this, a project dir like /a/b could match /a/b/c (session1)
|
|
138
|
+
// before /a/b/c/d (session2), assigning it to the wrong session.
|
|
139
|
+
let bestMatch: string | null = null;
|
|
140
|
+
let bestLen = 0;
|
|
136
141
|
for (const [dir, name] of map) {
|
|
137
|
-
if (projectDir.startsWith(dir + "/") || dir.startsWith(projectDir + "/"))
|
|
142
|
+
if (projectDir.startsWith(dir + "/") || dir.startsWith(projectDir + "/")) {
|
|
143
|
+
if (dir.length > bestLen) {
|
|
144
|
+
bestLen = dir.length;
|
|
145
|
+
bestMatch = name;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
138
148
|
}
|
|
149
|
+
if (bestMatch) return bestMatch;
|
|
139
150
|
// Fallback: the decoded projectDir may be wrong due to dash ambiguity.
|
|
140
151
|
// Re-encode each known session dir and check if the encoded form matches
|
|
141
152
|
// as a prefix of the (still-encoded) input.
|
|
142
153
|
const encoded = encodeProjectDir(projectDir);
|
|
154
|
+
bestMatch = null;
|
|
155
|
+
bestLen = 0;
|
|
143
156
|
for (const [dir, name] of map) {
|
|
144
157
|
const encodedDir = encodeProjectDir(dir);
|
|
145
|
-
if (encoded.startsWith(encodedDir) || encodedDir.startsWith(encoded))
|
|
158
|
+
if (encoded.startsWith(encodedDir) || encodedDir.startsWith(encoded)) {
|
|
159
|
+
if (encodedDir.length > bestLen) {
|
|
160
|
+
bestLen = encodedDir.length;
|
|
161
|
+
bestMatch = name;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
146
164
|
}
|
|
147
|
-
return
|
|
165
|
+
return bestMatch;
|
|
148
166
|
},
|
|
149
167
|
emit(event: AgentEvent) {
|
|
150
168
|
tracker.applyEvent(event, { seed: !watchersSeeded });
|