gitnexus 1.6.6-rc.152 → 1.6.6-rc.154

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.
@@ -131,18 +131,18 @@ This project is indexed by GitNexus as **${projectName}**${noStats ? '' : ` (${s
131
131
 
132
132
  ## Always Do
133
133
 
134
- - **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run \`gitnexus_impact({target: "symbolName", direction: "upstream"})\` and report the blast radius (direct callers, affected processes, risk level) to the user.
135
- - **MUST run \`gitnexus_detect_changes()\` before committing** to verify your changes only affect expected symbols and execution flows. For regression review, compare against the default branch: \`gitnexus_detect_changes({scope: "compare", base_ref: ${JSON.stringify(markdownSafeBranch(defaultBranch))}})\`.
134
+ - **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run \`impact({target: "symbolName", direction: "upstream"})\` and report the blast radius (direct callers, affected processes, risk level) to the user.
135
+ - **MUST run \`detect_changes()\` before committing** to verify your changes only affect expected symbols and execution flows. For regression review, compare against the default branch: \`detect_changes({scope: "compare", base_ref: ${JSON.stringify(markdownSafeBranch(defaultBranch))}})\`.
136
136
  - **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
137
- - When exploring unfamiliar code, use \`gitnexus_query({query: "concept"})\` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
138
- - When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use \`gitnexus_context({name: "symbolName"})\`.
137
+ - When exploring unfamiliar code, use \`query({query: "concept"})\` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
138
+ - When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use \`context({name: "symbolName"})\`.
139
139
 
140
140
  ## Never Do
141
141
 
142
- - NEVER edit a function, class, or method without first running \`gitnexus_impact\` on it.
142
+ - NEVER edit a function, class, or method without first running \`impact\` on it.
143
143
  - NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
144
- - NEVER rename symbols with find-and-replace — use \`gitnexus_rename\` which understands the call graph.
145
- - NEVER commit changes without running \`gitnexus_detect_changes()\` to check affected scope.
144
+ - NEVER rename symbols with find-and-replace — use \`rename\` which understands the call graph.
145
+ - NEVER commit changes without running \`detect_changes()\` to check affected scope.
146
146
 
147
147
  ## Resources
148
148
 
@@ -482,8 +482,8 @@ const renderSkillMarkdown = (community, projectName, members, files, entryPoints
482
482
  : community.label;
483
483
  lines.push('## How to Explore');
484
484
  lines.push('');
485
- lines.push(`1. \`gitnexus_context({name: "${firstEntry}"})\` \u2014 see callers and callees`);
486
- lines.push(`2. \`gitnexus_query({query: "${community.label.toLowerCase()}"})\` \u2014 find related execution flows`);
485
+ lines.push(`1. \`context({name: "${firstEntry}"})\` \u2014 see callers and callees`);
486
+ lines.push(`2. \`query({query: "${community.label.toLowerCase()}"})\` \u2014 find related execution flows`);
487
487
  lines.push('3. Read key files listed above for implementation details');
488
488
  lines.push('');
489
489
  return lines.join('\n');
@@ -74,9 +74,16 @@ interface RepoHandle {
74
74
  */
75
75
  export declare function resolveWorktreeCwd(repoPath: string, launchCwd: string): string;
76
76
  /**
77
- * Length of the base64url path hash appended to a colliding repo id.
77
+ * Length of the path-derived suffix appended to a colliding repo id.
78
78
  * Exported so tests can pin the suffix shape without re-deriving the
79
- * literal; see `repoId()` and the hashed-id resolution tier (#1658).
79
+ * literal; see `assignRepoId()` and the hashed-id resolution tier (#1658).
80
+ *
81
+ * Note: base64url is an *encoding*, not a hash — it preserves byte order, so
82
+ * two paths that share a long common prefix (sibling clones under one parent)
83
+ * collapse to the same sliced suffix. `assignRepoId()` keeps the legacy
84
+ * base64url suffix only for the first colliding duplicate (id compatibility)
85
+ * and falls back to a content hash of the resolved path on a real collision
86
+ * (#2054).
80
87
  */
81
88
  export declare const REPO_ID_HASH_LENGTH = 6;
82
89
  export declare class LocalBackend {
@@ -118,10 +125,25 @@ export declare class LocalBackend {
118
125
  */
119
126
  private refreshRepos;
120
127
  /**
121
- * Generate a stable repo ID from name + path.
122
- * If names collide, append a hash of the path.
128
+ * Assign a collision-free in-memory id for a registered repo.
129
+ *
130
+ * - Unique name → the bare lowercased name.
131
+ * - Duplicate name → a path-derived suffix. The *first* colliding clone keeps
132
+ * the legacy `base64url(path)` suffix so ids generated before #2054 still
133
+ * resolve (the #1658 hashed-id tier). base64url is an encoding, not a hash:
134
+ * it preserves byte order, so sibling clones under one parent (e.g.
135
+ * `.../REPO_2` and `.../REPO_3`) yield identical leading characters and thus
136
+ * the same sliced suffix. Any further collision therefore falls back to a
137
+ * content hash of the *resolved* path (order-insensitive), extended
138
+ * deterministically until unique.
139
+ *
140
+ * `assigned` maps every id handed out in this refresh to its resolved path,
141
+ * so a candidate is "free" when it is unused or already owned by this exact
142
+ * path. This method records its own assignment into `assigned` before
143
+ * returning, so the map-update is the function's invariant, not a caller
144
+ * obligation. A returned id never overwrites a different path's handle (#2054).
123
145
  */
124
- private repoId;
146
+ private assignRepoId;
125
147
  /**
126
148
  * Resolve which repo to use.
127
149
  * - If repoParam is given, match by name or path
@@ -148,6 +170,16 @@ export declare class LocalBackend {
148
170
  */
149
171
  private pickRepoHandleForCwd;
150
172
  private handleToRegistryEntry;
173
+ /**
174
+ * Ensure the LadybugDB pool is open for the *resolved* repo.
175
+ *
176
+ * Takes the `RepoHandle` the caller resolved — NOT a bare id — and keys the
177
+ * pool (and the init/staleness/reinit maps) by the immutable `lbugPath`. Two
178
+ * things matter for multi-clone correctness: (1) the handle is the one the
179
+ * caller resolved, so a concurrent `refreshRepos` can't substitute a different
180
+ * clone; (2) the pool key is the database path, so distinct clones never share
181
+ * a pool entry even when their name-derived id transiently collides (#2067).
182
+ */
151
183
  private ensureInitialized;
152
184
  /**
153
185
  * Get context for a specific repo (or the single repo if only one).