gitnexus 1.6.6-rc.36 → 1.6.6-rc.38
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/cli/ai-context.js +16 -7
- package/package.json +1 -1
package/dist/cli/ai-context.js
CHANGED
|
@@ -156,7 +156,7 @@ async function fileExists(filePath) {
|
|
|
156
156
|
* - If file exists without GitNexus section: append
|
|
157
157
|
* - If file exists with GitNexus section: replace that section
|
|
158
158
|
*/
|
|
159
|
-
async function upsertGitNexusSection(filePath, content, projectName, stats) {
|
|
159
|
+
async function upsertGitNexusSection(filePath, content, projectName, stats, noStats) {
|
|
160
160
|
const exists = await fileExists(filePath);
|
|
161
161
|
if (!exists) {
|
|
162
162
|
await fs.writeFile(filePath, content, 'utf-8');
|
|
@@ -189,13 +189,22 @@ async function upsertGitNexusSection(filePath, content, projectName, stats) {
|
|
|
189
189
|
// like `({target: "symbolName", direction: "upstream"})`
|
|
190
190
|
// when noStats is set
|
|
191
191
|
// Passing projectName + stats explicitly makes the contract obvious.
|
|
192
|
-
//
|
|
192
|
+
// --no-stats wins in the keep path too (#1706): a lean block committed
|
|
193
|
+
// to git would otherwise churn the volatile counts on every analyze,
|
|
194
|
+
// producing no-value merge conflicts between branches. Under noStats we
|
|
195
|
+
// drop the parenthetical but still refresh the project name so renames
|
|
196
|
+
// propagate.
|
|
193
197
|
const newStatsInner = `${stats.nodes || 0} symbols, ${stats.edges || 0} relationships, ${stats.processes || 0} execution flows`;
|
|
194
|
-
const statsLine =
|
|
198
|
+
const statsLine = noStats
|
|
199
|
+
? `Indexed as **${projectName}**`
|
|
200
|
+
: `Indexed as **${projectName}** (${newStatsInner})`;
|
|
195
201
|
// Match either canonical phrasing at line start (`^` with `m` flag) so we
|
|
196
202
|
// cannot replace prose embedded mid-paragraph. Deliberately no `$`: text
|
|
197
|
-
// after the
|
|
198
|
-
|
|
203
|
+
// after the line on the same line (e.g. ". MCP tools.") stays intact.
|
|
204
|
+
// The parenthetical is optional so a count-free line left by a prior
|
|
205
|
+
// --no-stats run still matches — letting the name refresh, and letting
|
|
206
|
+
// counts return if --no-stats is later dropped.
|
|
207
|
+
const statsPattern = /^(?:Indexed as|indexed by GitNexus as) \*\*[^*]+\*\*(?: \([^)]+\))?/m;
|
|
199
208
|
if (statsPattern.test(existingSection)) {
|
|
200
209
|
const updatedSection = existingSection.replace(statsPattern, statsLine);
|
|
201
210
|
const before = existingContent.substring(0, startIdx);
|
|
@@ -300,11 +309,11 @@ export async function generateAIContextFiles(repoPath, _storagePath, projectName
|
|
|
300
309
|
if (!options?.skipAgentsMd) {
|
|
301
310
|
// Create AGENTS.md (standard for Cursor, Windsurf, OpenCode, Cline, etc.)
|
|
302
311
|
const agentsPath = path.join(repoPath, 'AGENTS.md');
|
|
303
|
-
const agentsResult = await upsertGitNexusSection(agentsPath, content, projectName, stats);
|
|
312
|
+
const agentsResult = await upsertGitNexusSection(agentsPath, content, projectName, stats, options?.noStats);
|
|
304
313
|
createdFiles.push(`AGENTS.md (${agentsResult})`);
|
|
305
314
|
// Create CLAUDE.md (for Claude Code)
|
|
306
315
|
const claudePath = path.join(repoPath, 'CLAUDE.md');
|
|
307
|
-
const claudeResult = await upsertGitNexusSection(claudePath, content, projectName, stats);
|
|
316
|
+
const claudeResult = await upsertGitNexusSection(claudePath, content, projectName, stats, options?.noStats);
|
|
308
317
|
createdFiles.push(`CLAUDE.md (${claudeResult})`);
|
|
309
318
|
}
|
|
310
319
|
else {
|
package/package.json
CHANGED