diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f476e6947..643d4d9004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,6 +125,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - `codegraph install` and `upgrade` no longer break Codex's `config.toml` when CodeGraph's `[mcp_servers.codegraph]` entry is written differently from how CodeGraph writes it, such as indented, with spaces or quotes inside the brackets, or with Windows line endings: the entry is now updated in place, where before a second copy was added and Codex could load none of the file. A file already broken that way is repaired on the next install or upgrade, an example of the entry inside a multiline setting such as `developer_instructions` is no longer mistaken for it, uninstall removes the entry however it is written, and an entry you wrote with dotted keys or as an inline table is left as you wrote it. When your `mcp_servers` settings are one inline table, CodeGraph now says it can't add itself instead of breaking the file. Thanks @dencoseca for the report, and @danusha2345 and @rudycelekli for the first fixes. (#2562) - For Hermes Agent, `codegraph install` and `upgrade` no longer add `mcp-codegraph` to `platform_toolsets.cli`. Hermes up to 0.22.2 reported that name as an unknown toolset on every start, and Hermes 0.22.4 reads it as the only MCP server to load, hiding your others from CLI sessions; an entry an earlier install added is taken out again. A refresh also no longer resets your own `mcp_servers.codegraph` settings, such as an absolute command path, timeouts or `enabled: false`, and a config indented or written differently from Hermes's default no longer gets a duplicate or unreadable entry. Thanks @Huy3ko for the report, @conifercone for confirming it, and @rudycelekli for the first fix. (#2485) - `codegraph upgrade` now upgrades a global npm install when run from your home folder, which holds npm's global folder on Windows and with tools like nvm: before, it ran `npm install` without `-g` there, which left the global copy on the old version and put a second copy in your home folder. A copy installed in a project is now upgraded in that project wherever you run the command, with a warning if npm left it on the old version, and a copy installed with pnpm, yarn or bun gets the command that upgrades it instead of npm. Thanks @timlincool for the report and @maxmilian for the first fix. (#2477) +- After an upgrade, `codegraph status` and the upgrade reminder now tell you to run `codegraph index`. They used to offer `codegraph sync`, which leaves files that didn't change as the older engine read them, and `codegraph index -f`, whose `-f` only allows a home or root folder. Thanks @Adam0120. - The Windows installer, `irm …/install.ps1 | iex`, no longer stops with "(403) Forbidden" once GitHub's hourly limit for anonymous requests is used up, as it often is on shared networks and in CI: it now finds the latest release the way the macOS and Linux installer and `codegraph upgrade` do, and asks GitHub's API only when that fails. A version set without its `v`, like `CODEGRAPH_VERSION=1.6.2`, now installs too, where before its download failed. Thanks @hiyochi. - `codegraph status` no longer says the index is up to date while indexed files are missing their symbols: it now names files the parser couldn't read and files stored without their symbols (which `codegraph sync` repairs), `status --json` counts both, and `codegraph files --json` lists each file's recorded errors. Thanks @lipchey for the report. (#2336) - `codegraph sync` no longer says "Already up to date" on an index built by an older CodeGraph: it syncs your changed files as before, then warns that the files it didn't touch still need a full `codegraph index`. Thanks @bompus. diff --git a/__tests__/status-during-rebuild.test.ts b/__tests__/status-during-rebuild.test.ts index 95b45ebe45..2133253018 100644 --- a/__tests__/status-during-rebuild.test.ts +++ b/__tests__/status-during-rebuild.test.ts @@ -237,4 +237,19 @@ describe('codegraph status on an index an older release built (#2913)', () => { after.close(); } }); + + it('names only the full rebuild when an older engine built it', () => { + const conn = DatabaseConnection.open(dbPath); + try { + conn.getDb().exec("UPDATE project_metadata SET value = '1' WHERE key = 'indexed_with_extraction_version'"); + } finally { + conn.close(); + } + + // sync leaves unchanged files as the older engine read them. + const out = runStatus(dir, false); + expect(out).toContain('re-index to pick up'); + expect(out).toContain('Run "codegraph index" for a full rebuild'); + expect(out).not.toContain('codegraph sync'); + }); }); diff --git a/__tests__/upgrade.test.ts b/__tests__/upgrade.test.ts index 3c9b698602..a02953db53 100644 --- a/__tests__/upgrade.test.ts +++ b/__tests__/upgrade.test.ts @@ -302,10 +302,13 @@ describe('version helpers', () => { expect(parseLatestTagFromLocation('https://github.com/o/r/releases')).toBeNull(); }); - it('reindexAdvisory mentions the refresh commands', () => { + it('reindexAdvisory names the one command that picks up a new engine', () => { + // sync leaves unchanged files as the old engine read them, and index's -f + // only allows a home or root folder. const a = reindexAdvisory(); - expect(a).toContain('codegraph sync'); - expect(a).toContain('codegraph index -f'); + expect(a).toContain('codegraph index'); + expect(a).not.toContain('codegraph sync'); + expect(a).not.toContain('codegraph index -f'); }); it('buildWindowsUpgradeScript targets the right asset per arch', () => { @@ -513,7 +516,7 @@ describe('runUpgrade', () => { expect(calls.runs[0].args[1]).toContain('curl -fsSL'); expect(calls.runs[0].args[1]).toContain('| sh'); expect(calls.runs[0].env?.CODEGRAPH_INSTALL_DIR).toBe('/h/.codegraph'); - expect(calls.logs.join('\n')).toMatch(/codegraph sync/); // re-index advisory printed + expect(calls.logs.join('\n')).toMatch(/codegraph index/); // re-index advisory printed }); it('unix bundle: falls back to wget, and errors when neither downloader exists', async () => { diff --git a/src/bin/codegraph.ts b/src/bin/codegraph.ts index 9f37d748b8..001d35036c 100644 --- a/src/bin/codegraph.ts +++ b/src/bin/codegraph.ts @@ -1431,7 +1431,7 @@ program if (reindexRecommended) { const builtWith = buildInfo.version ? `v${buildInfo.version.replace(/^v/, '')}` : 'an earlier version'; warn(`Index was built by ${builtWith}; re-index to pick up this engine's improvements.`); - info('Run "codegraph index" (full rebuild) or "codegraph sync"'); + info('Run "codegraph index" for a full rebuild'); console.log(); } if (frameworkChanges) { diff --git a/src/upgrade/index.ts b/src/upgrade/index.ts index e5384f973d..bb4830d025 100644 --- a/src/upgrade/index.ts +++ b/src/upgrade/index.ts @@ -408,9 +408,8 @@ const c = { export function reindexAdvisory(): string { return [ c.dim('Your existing project indexes keep working, but were built by the previous version.'), - c.dim('To pick up this version’s extraction improvements, refresh each project:'), - ` ${c.cyan('codegraph sync')} ${c.dim('# incremental, fast')}`, - ` ${c.cyan('codegraph index -f')} ${c.dim('# full rebuild')}`, + c.dim('To pick up this version’s extraction improvements, rebuild each project:'), + ` ${c.cyan('codegraph index')} ${c.dim('# full rebuild')}`, c.dim('(`codegraph status` flags any index that predates the engine you’re running.)'), ].join('\n'); }