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:
@@ -1,7 +1,6 @@
|
||||
import type { BackgroundApi } from "./backgrounds.ts";
|
||||
import type { CompletionApi } from "./completion.ts";
|
||||
import type { Contributions } from "./contributions.ts";
|
||||
import type { GitApi } from "./git.ts";
|
||||
import type { ActionIcon } from "./icons.ts";
|
||||
import type { ActionMenuItem, ActionMenuOptions } from "./menu.ts";
|
||||
|
||||
@@ -95,7 +94,6 @@ export interface PluginApi {
|
||||
services?: ServicesApi;
|
||||
backgrounds?: BackgroundApi;
|
||||
ui?: UiApi;
|
||||
git?: GitApi;
|
||||
completion?: CompletionApi;
|
||||
readonly id: string;
|
||||
readonly signal: AbortSignal;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Dispose } from "./api.ts";
|
||||
import type { GitLineInfo } from "./git.ts";
|
||||
|
||||
export type TerminalAction = "toggle" | "new" | "window" | "split" | "previous" | "next" | "commands" | "directories";
|
||||
export interface TerminalProps {
|
||||
@@ -14,7 +13,6 @@ export interface TerminalMount {
|
||||
}
|
||||
/** Host features that `api.contribute(key, value)` registers. Only one enabled plugin can own each key. */
|
||||
export interface Contributions {
|
||||
git: { blame(path: string, line: number): Promise<GitLineInfo | null> };
|
||||
browser: {
|
||||
/** Opens a browser tab, with `url` when it is given. */
|
||||
newTab?(url?: string): Promise<void>;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { FilesApi, PluginApi, PtyApi, ServicesApi, SettingsApi, UiApi, WorkspaceApi } from "./api.ts";
|
||||
import type { BackgroundApi } from "./backgrounds.ts";
|
||||
import type { CompletionApi } from "./completion.ts";
|
||||
import type { GitApi } from "./git.ts";
|
||||
|
||||
/**
|
||||
* The optional members of `PluginApi`, by path, and the type that `requireFeature` returns for each path.
|
||||
@@ -12,12 +11,6 @@ export interface PluginFeatures {
|
||||
files: FilesApi;
|
||||
services: ServicesApi;
|
||||
backgrounds: BackgroundApi;
|
||||
git: GitApi;
|
||||
"git.push": GitApi["push"];
|
||||
"git.pull": GitApi["pull"];
|
||||
"git.graph": GitApi["graph"];
|
||||
"git.commitDetails": GitApi["commitDetails"];
|
||||
"git.commitDiff": GitApi["commitDiff"];
|
||||
completion: CompletionApi;
|
||||
"completion.transport": NonNullable<CompletionApi["transport"]>;
|
||||
"ui.showActionMenu": UiApi["showActionMenu"];
|
||||
@@ -44,12 +37,6 @@ const descriptions: { [K in PluginFeature]: string } = {
|
||||
files: "the folder grant API",
|
||||
services: "the plugin service API",
|
||||
backgrounds: "the background API",
|
||||
git: "the Git API",
|
||||
"git.push": "Git push",
|
||||
"git.pull": "Git pull",
|
||||
"git.graph": "the Git commit graph",
|
||||
"git.commitDetails": "Git commit details",
|
||||
"git.commitDiff": "Git commit diffs",
|
||||
completion: "the completion API",
|
||||
"completion.transport": "the completion model transport",
|
||||
"ui.showActionMenu": "the shared action menu",
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/** Git types. The host runs the `git` program for the active workspace. */
|
||||
export interface GitChange {
|
||||
path: string;
|
||||
originalPath?: string;
|
||||
index: string;
|
||||
worktree: string;
|
||||
}
|
||||
|
||||
export interface GitStatus {
|
||||
available: boolean;
|
||||
repository: boolean;
|
||||
branch: string | null;
|
||||
changes: GitChange[];
|
||||
}
|
||||
|
||||
export interface GitLineInfo {
|
||||
commit: string;
|
||||
author: string;
|
||||
/** The author date in ISO 8601 format. */
|
||||
date: string;
|
||||
summary: string;
|
||||
}
|
||||
|
||||
/** Older hosts can have `git` without `push`, `pull`, `graph`, `commitDetails`, or `commitDiff`. Use `hasFeature` first. */
|
||||
export interface GitApi {
|
||||
status(): Promise<GitStatus>;
|
||||
diff(path: string, staged: boolean): Promise<string>;
|
||||
stage(paths: string[]): Promise<void>;
|
||||
unstage(paths: string[]): Promise<void>;
|
||||
commit(message: string): Promise<void>;
|
||||
push(): Promise<void>;
|
||||
pull(): Promise<void>;
|
||||
graph(): Promise<GitGraph>;
|
||||
commitDetails(commit: string): Promise<GitCommitDetails>;
|
||||
commitDiff(commit: string, path: string): Promise<string>;
|
||||
blame(path: string, line: number): Promise<GitLineInfo | null>;
|
||||
}
|
||||
|
||||
export interface GitGraphCommit {
|
||||
id: string;
|
||||
parents: string[];
|
||||
refs: string[];
|
||||
summary: string;
|
||||
author: string;
|
||||
date: string;
|
||||
}
|
||||
|
||||
export interface GitGraph {
|
||||
commits: GitGraphCommit[];
|
||||
}
|
||||
|
||||
export interface GitCommitFile {
|
||||
path: string;
|
||||
originalPath?: string;
|
||||
status: string;
|
||||
}
|
||||
export interface GitCommitDetails {
|
||||
id: string;
|
||||
parents: string[];
|
||||
author: string;
|
||||
date: string;
|
||||
message: string;
|
||||
files: GitCommitFile[];
|
||||
}
|
||||
@@ -4,7 +4,6 @@ export type * from "./api.ts";
|
||||
export type * from "./backgrounds.ts";
|
||||
export type * from "./completion.ts";
|
||||
export type * from "./contributions.ts";
|
||||
export type * from "./git.ts";
|
||||
export type * from "./menu.ts";
|
||||
export type { ActionIcon } from "./icons.ts";
|
||||
export { API_VERSION, type PluginManifest } from "./manifest.ts";
|
||||
|
||||
Reference in New Issue
Block a user