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:
Knotty Wyvern
2026-10-29 15:51:21 -07:00
parent 58f77b2e9f
commit d3218b2501
68 changed files with 2068 additions and 324 deletions
+1 -14
View File
@@ -9,7 +9,7 @@ import type { Dispose, FilesApi, FilesTransport, PluginApi, PluginCommand, Plugi
/** The host services that a session gives to its plugin. The host binds them to the plugin ID. */
export type SessionServices = Pick<PluginApi, "workspace" | "settings" | "assets"> & {
openFile?: PluginApi["openFile"]; git?: PluginApi["git"]; backgrounds?: BackgroundFiles;
openFile?: PluginApi["openFile"]; backgrounds?: BackgroundFiles;
completionTransport?: NonNullable<PluginApi["completion"]>["transport"];
pty?: PtyTransport; files?: FilesTransport; serviceHub?: ServiceHub;
};
@@ -88,19 +88,6 @@ export class ExternalSession {
},
} } : {}),
ui: { showActionMenu: options => { this.check(); const menu = showActionMenu(options, this.controller.signal); return { close: () => menu.close() }; } },
...(this.services.git ? { git: {
status: () => { this.check(); return this.services.git!.status(); },
diff: (path: string, staged: boolean) => { this.check(); return this.services.git!.diff(path, staged); },
stage: (paths: string[]) => { this.check(); return this.services.git!.stage(paths); },
unstage: (paths: string[]) => { this.check(); return this.services.git!.unstage(paths); },
commit: (message: string) => { this.check(); return this.services.git!.commit(message); },
blame: (path: string, line: number) => { this.check(); return this.services.git!.blame(path, line); },
push: () => { this.check(); return this.services.git!.push(); },
pull: () => { this.check(); return this.services.git!.pull(); },
graph: () => { this.check(); return this.services.git!.graph(); },
commitDetails: (commit: string) => { this.check(); return this.services.git!.commitDetails!(commit); },
commitDiff: (commit: string, path: string) => { this.check(); return this.services.git!.commitDiff!(commit, path); },
} } : {}),
completion: {
version: 1,
registerProvider: provider => { this.check(); const off = completionHub.registerProvider({ ...provider, id: this.id + ":" + provider.id }); this.contributions.push(off); return off; },