Make Git a native feature with an off switch
- Add the native feature runtime in src/lib/features/: the catalog, the switches, the first-start migration, the loader, and the feature sessions. - Add Settings → Features and the features settings section. - Add features_legacy. It reads the old plugin packages and changes nothing. - Move Git from the plugin into src/lib/features/git/, on host internals. - Remove api.git, the git contribution key, and the SDK Git types. - Add pnpm check:features. It fails when a feature module loads at start. - Update the tests, the menu inventory, the docs, and UI-055.
This commit is contained in:
@@ -13,6 +13,12 @@ await runSmoke("appearance/density", async ({ page }) => {
|
||||
files: { "note.md": "# Layout test\n\nA note with a short paragraph.\n\nA second paragraph.\n\n| Name | Value |\n| --- | --- |\n| Alpha | 12 |\n| Beta | 24 |\n" },
|
||||
}),
|
||||
plugins_snapshot: () => ({ root: "D:\\LayoutTest\\plugins", plugins: [] }),
|
||||
// The Git feature asks the host for the line history. The test turns the answer on with `blameOn`.
|
||||
git_blame: ({ path, line }) => {
|
||||
if (!window.blameOn) return null;
|
||||
window.blameCalls.push({ path, line });
|
||||
return { commit: "123456789abcdef", author: "UI test", date: "2026-10-07T12:34:00Z", summary: `Changed line ${line}` };
|
||||
},
|
||||
}),
|
||||
});
|
||||
const row = page.locator('[data-tree-rel="note.md"]');
|
||||
@@ -40,14 +46,7 @@ await runSmoke("appearance/density", async ({ page }) => {
|
||||
assert.equal(await line.evaluate(el => getComputedStyle(el, "::before").width), "3px");
|
||||
assert.equal(await page.locator(".line-history").count(), 0);
|
||||
|
||||
await page.evaluate(async () => {
|
||||
const { pluginHost } = await import("/src/lib/plugins/registry.ts");
|
||||
window.blameCalls = [];
|
||||
window.removeGit = pluginHost.register("ui-test", "git", { blame: async (path, line) => {
|
||||
window.blameCalls.push({ path, line });
|
||||
return { commit: "123456789abcdef", author: "UI test", date: "2026-10-07T12:34:00Z", summary: `Changed line ${line}` };
|
||||
} });
|
||||
});
|
||||
await page.evaluate(() => { window.blameCalls = []; window.blameOn = true; });
|
||||
await line.click();
|
||||
await page.locator(".line-history").waitFor();
|
||||
assert.match(await page.locator(".line-history").getAttribute("title"), /Line 5 · UI test/);
|
||||
@@ -77,7 +76,8 @@ await runSmoke("appearance/density", async ({ page }) => {
|
||||
await view().press("ArrowRight");
|
||||
await page.locator(".source-editor .cm-content").waitFor();
|
||||
await page.locator(".line-history").waitFor();
|
||||
await page.evaluate(() => window.removeGit());
|
||||
// Git off removes the line history at once.
|
||||
await page.evaluate(() => { window.blameOn = false; window.__TEST__.writeSettings("features", { git: false }); });
|
||||
await page.locator(".line-history").waitFor({ state: "hidden" });
|
||||
await view().press("Home");
|
||||
await page.getByRole("button", { name: "Hide outline", exact: true }).click();
|
||||
|
||||
Reference in New Issue
Block a user