@groundtrack/hooks 0.1.15 → 0.1.16

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.
@@ -178,6 +178,7 @@ export function discoverSessions(options) {
178
178
  return null;
179
179
  return identity.remotes.values().next().value ?? null;
180
180
  };
181
+ const targetRemote = soleRemote(options.repository);
181
182
  for (const candidate of discovered.included) {
182
183
  const { path, metadata } = candidate;
183
184
  const modifiedAtMs = candidate.modifiedAt?.getTime() ??
@@ -202,11 +203,16 @@ export function discoverSessions(options) {
202
203
  const normalizedRemote = metadata.repositoryUrl
203
204
  ? normalizeRepositoryUrl(metadata.repositoryUrl)
204
205
  : null;
205
- const cwdMatchesCurrentRepository = Boolean(options.repository && metadata.cwd && isInside(metadata.cwd, options.repository.root));
206
- const currentRepositoryRemote = cwdMatchesCurrentRepository
207
- ? soleRemote(options.repository)
208
- : null;
206
+ const pathMatchesCurrentRepository = Boolean(options.repository && metadata.cwd && isInside(metadata.cwd, options.repository.root));
209
207
  const remoteMatchesCurrentRepository = Boolean(options.repository && normalizedRemote && options.repository.remotes.has(normalizedRemote));
208
+ // A session may retain an old remote after an owner rename. Its recorded checkout
209
+ // can still identify the target repository even when importing from another worktree.
210
+ const checkoutMatchesCurrentRepository = Boolean(targetRemote &&
211
+ !pathMatchesCurrentRepository &&
212
+ !remoteMatchesCurrentRepository &&
213
+ soleRemote(repositoryIdentityForCwd(metadata.cwd)) === targetRemote);
214
+ const cwdMatchesCurrentRepository = pathMatchesCurrentRepository || checkoutMatchesCurrentRepository;
215
+ const currentRepositoryRemote = cwdMatchesCurrentRepository ? targetRemote : null;
210
216
  const matchesCurrentRepository = options.repository
211
217
  ? remoteMatchesCurrentRepository ||
212
218
  (!normalizedRemote && cwdMatchesCurrentRepository) ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groundtrack/hooks",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Lifecycle hook utilities for Groundtrack MCP clients.",
5
5
  "keywords": [
6
6
  "claude-code",