dsh-easygit-plugin 0.2.3 → 0.3.0
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/README.md +66 -67
- package/README.zh-CN.md +66 -67
- package/assets/preview.png +0 -0
- package/lib/client.js +1501 -860
- package/lib/index.js +644 -44
- package/lib/types/client/commit-actions.d.ts +18 -0
- package/lib/types/client/conflict-model.d.ts +15 -0
- package/lib/types/client/conflict-tab.d.ts +14 -0
- package/lib/types/client/index.d.ts +30 -4
- package/lib/types/client/merge-tab.d.ts +16 -0
- package/lib/types/client/panel-controller.d.ts +9 -37
- package/lib/types/client/stash-tab.d.ts +15 -0
- package/lib/types/client/view-model.d.ts +1 -35
- package/lib/types/host/actions.d.ts +6 -3
- package/lib/types/host/conflict-worker.d.ts +1 -0
- package/lib/types/host/git-repository-service.d.ts +13 -2
- package/lib/types/host/stash-worker.d.ts +1 -0
- package/lib/types/shared/contracts.d.ts +197 -0
- package/package.json +3 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EasyGitAction, EasyGitRequest, EasyGitResponse } from '../shared/contracts';
|
|
2
|
+
interface Props {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
revision: number;
|
|
5
|
+
hash?: string;
|
|
6
|
+
parents?: string[];
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
rpc<A extends EasyGitAction>(request: EasyGitRequest<A>, signal?: AbortSignal): Promise<EasyGitResponse<A>>;
|
|
9
|
+
onChanged(): void;
|
|
10
|
+
onConflicts(): void;
|
|
11
|
+
onBusy?(busy: boolean): void;
|
|
12
|
+
onCommand(label: string, command: string): (success: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function GitCommitActions(props: Props): import("react").DetailedReactHTMLElement<{
|
|
15
|
+
className: string;
|
|
16
|
+
'aria-label': string;
|
|
17
|
+
}, HTMLElement>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ConflictBlock {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
ours: string;
|
|
5
|
+
base: string | null;
|
|
6
|
+
theirs: string;
|
|
7
|
+
}
|
|
8
|
+
/** Result coordinates include marker lines, and update with the editor text. */
|
|
9
|
+
export declare function conflictLineRanges(text: string, blocks: ConflictBlock[]): {
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
}[];
|
|
13
|
+
/** Keep byte-for-byte text boundaries, including CRLF and a missing final newline. */
|
|
14
|
+
export declare function parseConflictBlocks(text: string, markerSize?: number): ConflictBlock[];
|
|
15
|
+
export declare function chooseConflictBlock(text: string, block: ConflictBlock, choice: 'ours' | 'theirs' | 'both'): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EasyGitAction, EasyGitRequest, EasyGitResponse } from '../shared/contracts';
|
|
2
|
+
interface Props {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
revision: number;
|
|
5
|
+
rpc<A extends EasyGitAction>(request: EasyGitRequest<A>, signal?: AbortSignal): Promise<EasyGitResponse<A>>;
|
|
6
|
+
onChanged(): void;
|
|
7
|
+
onDirty(dirty: boolean): void;
|
|
8
|
+
onCommand(label: string, command: string): (success: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function GitConflictsTab(props: Props): import("react").DetailedReactHTMLElement<{
|
|
11
|
+
className: string;
|
|
12
|
+
'aria-label': string;
|
|
13
|
+
}, HTMLElement>;
|
|
14
|
+
export {};
|
|
@@ -1,22 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { GitConflictsTab } from './conflict-tab';
|
|
2
|
+
import { GitStashesTab } from './stash-tab';
|
|
3
|
+
import { GitMergeTab } from './merge-tab';
|
|
4
|
+
import { GitCommitActions } from './commit-actions';
|
|
5
|
+
import { parseConflictBlocks, chooseConflictBlock, conflictLineRanges } from './conflict-model';
|
|
6
|
+
import { registerWorkbench, requestAgentAnalysis, type Dispose } from './panel-controller';
|
|
7
|
+
import { appendCommandLog, analysisProposalId, beginTrackedRequest, buildAgentRepairPrompt, canDismissFailedProposal, buildFileTree, cancelTrackedRequest, commitFileTone, deriveCommitGraph, filterLocalBranches, failureContext, isCurrentCommitRequest, isLatestRequest, isTrackedRequestCurrent, mutationCommand, nextCommitSelection, openRecoveryProposal, parseReviewRows, pendingProposalTransition, recoveryProposalId, repositoryName, shouldShowAnalysisBanner, type AnyRecord } from './view-model';
|
|
8
|
+
type TimerFn = (callback: () => void, delayMs: number) => Dispose | void;
|
|
9
|
+
interface RepositoryTabProps {
|
|
10
|
+
onConflicts(): void;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
intervalFn?: TimerFn | null;
|
|
13
|
+
revision: number;
|
|
14
|
+
onChanged: Dispose;
|
|
15
|
+
onCommand: CommandReporter;
|
|
16
|
+
onFailure: FailureHandler;
|
|
17
|
+
}
|
|
18
|
+
type CommandReporter = (label: string, command: string) => (succeeded: boolean) => void;
|
|
19
|
+
type FailureHandler = (response: AnyRecord) => void;
|
|
3
20
|
type RefreshState = 'idle' | 'loading' | 'succeeded' | 'failed';
|
|
4
21
|
declare function injectStyles(): () => void;
|
|
5
22
|
declare function refreshButtonLabel(state: RefreshState): string;
|
|
6
23
|
declare function renderRawDiffSurface(diff: string): any;
|
|
7
24
|
declare function renderReviewSurface(diff: string): any;
|
|
25
|
+
declare function GitChangesTab(props: RepositoryTabProps): any;
|
|
8
26
|
declare const plugin: {
|
|
9
27
|
inject: string[];
|
|
10
28
|
apply(ctx: AnyRecord): void;
|
|
11
29
|
__testing: {
|
|
12
|
-
|
|
30
|
+
GitChangesTab: typeof GitChangesTab;
|
|
31
|
+
GitCommitActions: typeof GitCommitActions;
|
|
32
|
+
GitMergeTab: typeof GitMergeTab;
|
|
33
|
+
GitStashesTab: typeof GitStashesTab;
|
|
34
|
+
GitConflictsTab: typeof GitConflictsTab;
|
|
35
|
+
parseConflictBlocks: typeof parseConflictBlocks;
|
|
36
|
+
chooseConflictBlock: typeof chooseConflictBlock;
|
|
37
|
+
conflictLineRanges: typeof conflictLineRanges;
|
|
38
|
+
registerWorkbench: typeof registerWorkbench;
|
|
39
|
+
requestAgentAnalysis: typeof requestAgentAnalysis;
|
|
13
40
|
buildFileTree: typeof buildFileTree;
|
|
14
41
|
parseReviewRows: typeof parseReviewRows;
|
|
15
42
|
renderRawDiffSurface: typeof renderRawDiffSurface;
|
|
16
43
|
renderReviewSurface: typeof renderReviewSurface;
|
|
17
44
|
injectStyles: typeof injectStyles;
|
|
18
45
|
filterLocalBranches: typeof filterLocalBranches;
|
|
19
|
-
clampWorkbenchRatio: typeof clampWorkbenchRatio;
|
|
20
46
|
deriveCommitGraph: typeof deriveCommitGraph;
|
|
21
47
|
repositoryName: typeof repositoryName;
|
|
22
48
|
mutationCommand: typeof mutationCommand;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EasyGitAction, EasyGitRequest, EasyGitResponse } from '../shared/contracts';
|
|
2
|
+
interface Props {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
revision: number;
|
|
5
|
+
rpc<A extends EasyGitAction>(request: EasyGitRequest<A>, signal?: AbortSignal): Promise<EasyGitResponse<A>>;
|
|
6
|
+
onChanged(): void;
|
|
7
|
+
onConflicts(): void;
|
|
8
|
+
onCommand(label: string, command: string): (success: boolean) => void;
|
|
9
|
+
renderReview(diff: string): React.ReactNode;
|
|
10
|
+
renderRawDiff(diff: string): React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function GitMergeTab(props: Props): import("react").DetailedReactHTMLElement<{
|
|
13
|
+
className: string;
|
|
14
|
+
'aria-label': string;
|
|
15
|
+
}, HTMLElement>;
|
|
16
|
+
export {};
|
|
@@ -1,38 +1,10 @@
|
|
|
1
|
+
import type { AnyRecord } from './view-model';
|
|
1
2
|
export type Dispose = () => void;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
open(sessionId: unknown): boolean;
|
|
11
|
-
close(sessionId?: unknown): boolean;
|
|
12
|
-
toggle(sessionId: unknown): boolean;
|
|
13
|
-
isOpen(sessionId: unknown): boolean;
|
|
14
|
-
subscribe(listener: (state: PanelSnapshot) => void): Dispose;
|
|
15
|
-
snapshot(): PanelSnapshot;
|
|
16
|
-
}
|
|
17
|
-
interface SlotsLike {
|
|
18
|
-
register(definition: Record<string, unknown>, renderer: (props: Record<string, unknown>) => unknown): unknown;
|
|
19
|
-
}
|
|
20
|
-
interface LayoutLike {
|
|
21
|
-
openDetails(): void;
|
|
22
|
-
closeDetails(): void;
|
|
23
|
-
}
|
|
24
|
-
export interface PanelControllerOptions {
|
|
25
|
-
slots?: SlotsLike | null;
|
|
26
|
-
layout?: LayoutLike | null;
|
|
27
|
-
renderPanel: (props: {
|
|
28
|
-
sessionId: string;
|
|
29
|
-
close: Dispose;
|
|
30
|
-
}) => unknown;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Mount the workbench only while it is open. Harness's built-in DetailsPanel
|
|
34
|
-
* uses priority 0, so the workbench temporarily overrides it at -10 and
|
|
35
|
-
* immediately releases the registration when closed.
|
|
36
|
-
*/
|
|
37
|
-
export declare function createPanelController(options: PanelControllerOptions): PanelController;
|
|
38
|
-
export {};
|
|
3
|
+
/** Use the session-scoped conversation service; Connection no longer owns domain APIs. */
|
|
4
|
+
export declare function requestAgentAnalysis(sessions: AnyRecord, sessionId: string, text: string): Promise<void>;
|
|
5
|
+
/** Register a native tab without taking over the host's layout or other tabs. */
|
|
6
|
+
export declare function registerWorkbench(ctx: AnyRecord, renderPanel: (props: {
|
|
7
|
+
sessionId: string;
|
|
8
|
+
close: Dispose;
|
|
9
|
+
sendPrompt(text: string): Promise<void>;
|
|
10
|
+
}) => unknown): (sessionId: string) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EasyGitAction, EasyGitRequest, EasyGitResponse } from '../shared/contracts';
|
|
2
|
+
interface Props {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
revision: number;
|
|
5
|
+
rpc<A extends EasyGitAction>(request: EasyGitRequest<A>, signal?: AbortSignal): Promise<EasyGitResponse<A>>;
|
|
6
|
+
onChanged(): void;
|
|
7
|
+
onConflicts(): void;
|
|
8
|
+
onCommand(label: string, command: string): (success: boolean) => void;
|
|
9
|
+
renderReview(diff: string): React.ReactNode;
|
|
10
|
+
renderRawDiff(diff: string): React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function GitStashesTab(props: Props): import("react").DetailedReactHTMLElement<{
|
|
13
|
+
className: string;
|
|
14
|
+
}, HTMLElement>;
|
|
15
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BranchSummary, CommitSummary, GitFailureContext, RepositoryFile } from '../shared/contracts';
|
|
2
2
|
export type AnyRecord = Record<string, any>;
|
|
3
|
-
export type RepositoryMutationAction = 'stage-paths' | 'unstage-paths' | 'stage-all' | 'unstage-all' | 'commit' | 'create-branch' | 'switch-branch' | 'delete-branch';
|
|
3
|
+
export type RepositoryMutationAction = 'stage-paths' | 'unstage-paths' | 'stage-all' | 'unstage-all' | 'commit' | 'create-branch' | 'switch-branch' | 'delete-branch' | 'create-stash' | 'apply-stash' | 'pop-stash' | 'drop-stash' | 'branch-stash';
|
|
4
4
|
export interface CommandLogEntry {
|
|
5
5
|
id: number;
|
|
6
6
|
label: string;
|
|
@@ -38,33 +38,6 @@ export interface CommitGraphRow {
|
|
|
38
38
|
laneCount: number;
|
|
39
39
|
edges: CommitGraphEdge[];
|
|
40
40
|
}
|
|
41
|
-
export interface HostSplitLayout {
|
|
42
|
-
frame: HTMLElement;
|
|
43
|
-
sidebar: HTMLElement;
|
|
44
|
-
center: HTMLElement;
|
|
45
|
-
details: HTMLElement;
|
|
46
|
-
}
|
|
47
|
-
export interface ActiveHostSplit {
|
|
48
|
-
layout: HostSplitLayout;
|
|
49
|
-
splitColumns: string;
|
|
50
|
-
previousGridTemplateColumns: string;
|
|
51
|
-
previousTrack: string;
|
|
52
|
-
previousDetailsWidth: string;
|
|
53
|
-
previousDetailsMinWidth: string;
|
|
54
|
-
previousDetailsMaxWidth: string;
|
|
55
|
-
previousDetailsBorderLeft: string;
|
|
56
|
-
}
|
|
57
|
-
export interface ResizeDrag {
|
|
58
|
-
pointerId: number;
|
|
59
|
-
startX: number;
|
|
60
|
-
startWidth: number;
|
|
61
|
-
currentRatio: number;
|
|
62
|
-
}
|
|
63
|
-
export declare const WORKBENCH_RATIO_KEY = "dsh-easygit-plugin:workbench-ratio";
|
|
64
|
-
export declare const WORKBENCH_TRACK = "--dsh-easygit-plugin-workbench-width";
|
|
65
|
-
export declare const WORKBENCH_DEFAULT_RATIO = 0.36;
|
|
66
|
-
export declare const WORKBENCH_MIN_RATIO = 0.24;
|
|
67
|
-
export declare const WORKBENCH_MAX_RATIO = 0.75;
|
|
68
41
|
export declare function appendCommandLog(current: CommandLogEntry[], entry: CommandLogEntry): CommandLogEntry[];
|
|
69
42
|
export declare function filterLocalBranches(branches: BranchSummary[], query: string): BranchSummary[];
|
|
70
43
|
export declare function isCurrentCommitRequest(selectedHash: string, requestedHash: string, currentSequence: number, requestSequence: number): boolean;
|
|
@@ -82,10 +55,6 @@ export declare function isTrackedRequestCurrent(ref: {
|
|
|
82
55
|
}, request: TrackedRequest): boolean;
|
|
83
56
|
export declare function isAbortError(error: unknown): boolean;
|
|
84
57
|
export declare function deriveCommitGraph(commits: CommitSummary[]): CommitGraphRow[];
|
|
85
|
-
export declare function clampWorkbenchRatio(value: number): number;
|
|
86
|
-
export declare function readWorkbenchRatio(): number;
|
|
87
|
-
export declare function persistWorkbenchRatio(value: number | null): void;
|
|
88
|
-
export declare function workbenchTrackForRatio(ratio: number): string;
|
|
89
58
|
export declare function repositoryName(topLevel: unknown): string;
|
|
90
59
|
export declare function mutationCommand(action: string, payload?: AnyRecord): {
|
|
91
60
|
label: string;
|
|
@@ -102,9 +71,6 @@ export declare function pendingProposalTransition(previousProposalId: string | n
|
|
|
102
71
|
shouldOpen: boolean;
|
|
103
72
|
};
|
|
104
73
|
export declare function openRecoveryProposal(response: unknown, open: () => void, schedule?: (callback: () => void, delayMs: number) => unknown): boolean;
|
|
105
|
-
export declare function viewportWidth(): number;
|
|
106
|
-
export declare function sidebarTrackWidth(layout: HostSplitLayout): number;
|
|
107
|
-
export declare function findWorkbenchHostSplit(anchor: HTMLElement): HostSplitLayout | null;
|
|
108
74
|
export declare function buildFileTree(files: RepositoryFile[]): FileTreeNode;
|
|
109
75
|
export declare function parseReviewRows(diff: string): ReviewRow[];
|
|
110
76
|
export declare function diffLineClass(line: string): string;
|
|
@@ -11,6 +11,9 @@ export interface WebServerService {
|
|
|
11
11
|
handler(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
12
12
|
}): unknown;
|
|
13
13
|
}
|
|
14
|
+
export interface ConnectionService {
|
|
15
|
+
requestRejection(request: IncomingMessage): 401 | 403 | undefined;
|
|
16
|
+
}
|
|
14
17
|
interface ProposalVerification {
|
|
15
18
|
changed: boolean;
|
|
16
19
|
verified: boolean;
|
|
@@ -26,7 +29,7 @@ interface EasyGitActionDependencies {
|
|
|
26
29
|
repository: GitRepositoryService;
|
|
27
30
|
proposalStorageReady: Promise<void>;
|
|
28
31
|
shell: ShellService | null;
|
|
29
|
-
repositoryContext(sessionId: string): RepositoryContext | null
|
|
32
|
+
repositoryContext(sessionId: string): Promise<RepositoryContext | null>;
|
|
30
33
|
latestPending(sessionId: string): StoredProposal | null;
|
|
31
34
|
findProposal(sessionId: string, proposalId: unknown): StoredProposal | undefined;
|
|
32
35
|
proposalView(proposal: StoredProposal): ProposalView;
|
|
@@ -36,8 +39,8 @@ interface EasyGitActionDependencies {
|
|
|
36
39
|
verifyProposal(shell: ShellService | null, proposal: StoredProposal): Promise<ProposalVerification>;
|
|
37
40
|
executeProposal(shell: ShellService | null, proposal: StoredProposal, policy: unknown, persist: () => Promise<void>): Promise<UnknownRecord>;
|
|
38
41
|
recoverFailedCommand(sessionId: string, workdir: string, operationId: string, action: string, command: string, message: string, errorOutput: string, errorCode: string, reason: string): Promise<UnknownRecord | null>;
|
|
39
|
-
resolveExecutionPolicy(sessionId: string): unknown
|
|
42
|
+
resolveExecutionPolicy(sessionId: string): Promise<unknown>;
|
|
40
43
|
}
|
|
41
44
|
/** Register the Client-to-Host POST dispatcher with a 1 MiB body limit. */
|
|
42
|
-
export declare function registerEasyGitActions(webServer: WebServerService | null, dependencies: EasyGitActionDependencies): unknown;
|
|
45
|
+
export declare function registerEasyGitActions(webServer: WebServerService | null, dependencies: EasyGitActionDependencies, connection: ConnectionService | null): unknown;
|
|
43
46
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function conflictWorkerCommand(action: string, payload: Record<string, unknown>): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionResult, CommitDetail, CommitDiffResult, CommitSummary, DiffResult, RepositoryReferences, RepositorySummary, StashSummary, SyncState } from '../shared/contracts';
|
|
1
|
+
import type { ActionResult, CommitDetail, CommitDiffResult, CommitSummary, DiffResult, RepositoryReferences, RepositorySummary, StashSummary, StashDetail, SyncState } from '../shared/contracts';
|
|
2
2
|
export type { BranchSummary, CommitDetail, CommitDiffResult, CommitFileChange, CommitRefSummary, CommitSummary, DiffResult, ReferenceSummary, RepositoryFile, RepositoryReferences, RepositorySummary, StashSummary, SyncState, } from '../shared/contracts';
|
|
3
3
|
export interface GitRunResult {
|
|
4
4
|
exitCode: number | null;
|
|
@@ -14,8 +14,12 @@ export interface GitRunResult {
|
|
|
14
14
|
}
|
|
15
15
|
export interface ShellService {
|
|
16
16
|
resolve(request: Record<string, unknown>): unknown;
|
|
17
|
-
run(specification: unknown): Promise<GitRunResult>;
|
|
17
|
+
run?(specification: unknown): Promise<GitRunResult>;
|
|
18
|
+
execute?(specification: unknown): Promise<{
|
|
19
|
+
result(): Promise<GitRunResult>;
|
|
20
|
+
}>;
|
|
18
21
|
}
|
|
22
|
+
export declare function runShell(shell: ShellService, specification: unknown): Promise<GitRunResult>;
|
|
19
23
|
interface MutationRequest {
|
|
20
24
|
sessionId: string;
|
|
21
25
|
workdir: string;
|
|
@@ -39,6 +43,11 @@ export declare class GitRepositoryService {
|
|
|
39
43
|
getCommitDetail(workdir: string, hash: unknown, signal?: AbortSignal, sandboxPolicy?: unknown): Promise<ActionResult<CommitDetail>>;
|
|
40
44
|
getCommitDiff(workdir: string, hash: unknown, signal?: AbortSignal, sandboxPolicy?: unknown): Promise<ActionResult<CommitDiffResult>>;
|
|
41
45
|
getStashes(workdir: string, signal?: AbortSignal, sandboxPolicy?: unknown): Promise<ActionResult<StashSummary[]>>;
|
|
46
|
+
private resolveStash;
|
|
47
|
+
getStashDetail(workdir: string, selector: unknown, hash: unknown, signal?: AbortSignal, sandboxPolicy?: unknown): Promise<ActionResult<StashDetail>>;
|
|
48
|
+
getStashDiff(workdir: string, selector: unknown, hash: unknown, path: unknown, untracked: boolean, signal?: AbortSignal, sandboxPolicy?: unknown): Promise<ActionResult<DiffResult>>;
|
|
49
|
+
createStash(request: MutationRequest, message: unknown, paths: unknown, includeUntracked: boolean): Promise<ActionResult<RepositorySummary>>;
|
|
50
|
+
mutateStash(request: MutationRequest, action: 'apply-stash' | 'pop-stash' | 'drop-stash' | 'branch-stash', selector: unknown, hash: unknown, name?: unknown, confirmRisk?: boolean): Promise<ActionResult<RepositorySummary>>;
|
|
42
51
|
getSyncState(workdir: string, signal?: AbortSignal, sandboxPolicy?: unknown): Promise<ActionResult<SyncState>>;
|
|
43
52
|
fetchRemote(request: MutationRequest, remote: unknown): Promise<ActionResult<SyncState>>;
|
|
44
53
|
pullFfOnly(request: MutationRequest): Promise<ActionResult<SyncState>>;
|
|
@@ -58,5 +67,7 @@ export declare class GitRepositoryService {
|
|
|
58
67
|
private mutate;
|
|
59
68
|
private mutateSync;
|
|
60
69
|
private mutateAndRead;
|
|
70
|
+
conflictAction(action: string, workdir: string, payload: Record<string, unknown>, request?: MutationRequest, sandboxPolicy?: unknown): Promise<ActionResult<unknown>>;
|
|
71
|
+
private withMutation;
|
|
61
72
|
private pruneOperations;
|
|
62
73
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createStashCommand(message: string, paths: string[] | undefined, includeUntracked: boolean): string;
|
|
@@ -65,6 +65,76 @@ export interface SyncState {
|
|
|
65
65
|
rebaseInProgress: boolean;
|
|
66
66
|
files: RepositoryFile[];
|
|
67
67
|
}
|
|
68
|
+
export type ConflictOperation = 'merge' | 'rebase' | 'cherry-pick' | 'revert';
|
|
69
|
+
export type CommitEditAction = 'amend-message' | 'amend-commit' | 'undo-commit' | 'revert-commit';
|
|
70
|
+
export interface CommitEditState {
|
|
71
|
+
head: string;
|
|
72
|
+
branch: string;
|
|
73
|
+
message: string;
|
|
74
|
+
parents: string[];
|
|
75
|
+
staged: boolean;
|
|
76
|
+
dirty: boolean;
|
|
77
|
+
blocked: boolean;
|
|
78
|
+
token: string;
|
|
79
|
+
}
|
|
80
|
+
interface CommitEditRequest {
|
|
81
|
+
sessionId: string;
|
|
82
|
+
operationId: string;
|
|
83
|
+
token: string;
|
|
84
|
+
confirmRisk: boolean;
|
|
85
|
+
}
|
|
86
|
+
export type MergeMode = 'normal' | 'ff-only' | 'squash';
|
|
87
|
+
export interface MergePreview {
|
|
88
|
+
branch: string;
|
|
89
|
+
target: string;
|
|
90
|
+
head: string;
|
|
91
|
+
sourceHead: string;
|
|
92
|
+
base: string;
|
|
93
|
+
token: string;
|
|
94
|
+
canFastForward: boolean;
|
|
95
|
+
alreadyMerged: boolean;
|
|
96
|
+
commits: Array<{
|
|
97
|
+
hash: string;
|
|
98
|
+
subject: string;
|
|
99
|
+
author: string;
|
|
100
|
+
date: string;
|
|
101
|
+
}>;
|
|
102
|
+
commitsTruncated: boolean;
|
|
103
|
+
files: string[];
|
|
104
|
+
filesTruncated: boolean;
|
|
105
|
+
diff: string;
|
|
106
|
+
diffTruncated: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface ConflictFile {
|
|
109
|
+
path: string;
|
|
110
|
+
kind: string;
|
|
111
|
+
stages: number[];
|
|
112
|
+
}
|
|
113
|
+
export interface ConflictState {
|
|
114
|
+
operation: ConflictOperation | null;
|
|
115
|
+
mergeMode?: 'squash';
|
|
116
|
+
operationToken: string;
|
|
117
|
+
files: ConflictFile[];
|
|
118
|
+
}
|
|
119
|
+
export interface ConflictVersion {
|
|
120
|
+
exists: boolean;
|
|
121
|
+
text: string | null;
|
|
122
|
+
mode: string | null;
|
|
123
|
+
reason: string | null;
|
|
124
|
+
source?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface ConflictDetail {
|
|
127
|
+
path: string;
|
|
128
|
+
operation: ConflictOperation | null;
|
|
129
|
+
token: string;
|
|
130
|
+
base: ConflictVersion;
|
|
131
|
+
ours: ConflictVersion;
|
|
132
|
+
theirs: ConflictVersion;
|
|
133
|
+
result: ConflictVersion;
|
|
134
|
+
editable: boolean;
|
|
135
|
+
special: boolean;
|
|
136
|
+
markerSize: number;
|
|
137
|
+
}
|
|
68
138
|
export interface BranchSummary {
|
|
69
139
|
name: string;
|
|
70
140
|
current: boolean;
|
|
@@ -134,6 +204,20 @@ export interface StashSummary {
|
|
|
134
204
|
author: string;
|
|
135
205
|
date: string;
|
|
136
206
|
}
|
|
207
|
+
export interface StashFile {
|
|
208
|
+
path: string;
|
|
209
|
+
status: string;
|
|
210
|
+
untracked: boolean;
|
|
211
|
+
}
|
|
212
|
+
export interface StashDetail {
|
|
213
|
+
hash: string;
|
|
214
|
+
files: StashFile[];
|
|
215
|
+
filesTruncated: boolean;
|
|
216
|
+
}
|
|
217
|
+
export interface StashTarget {
|
|
218
|
+
selector: string;
|
|
219
|
+
hash: string;
|
|
220
|
+
}
|
|
137
221
|
export interface DiffResult {
|
|
138
222
|
path: string | null;
|
|
139
223
|
staged: boolean;
|
|
@@ -203,6 +287,65 @@ export interface ProposalExecutionResponse extends ProposalCommandResponse {
|
|
|
203
287
|
analysis?: AgentAnalysisRequest;
|
|
204
288
|
}
|
|
205
289
|
export interface EasyGitRequestMap {
|
|
290
|
+
'get-commit-edit-state': {
|
|
291
|
+
sessionId: string;
|
|
292
|
+
};
|
|
293
|
+
'amend-message': CommitEditRequest & {
|
|
294
|
+
message: string;
|
|
295
|
+
};
|
|
296
|
+
'amend-commit': CommitEditRequest;
|
|
297
|
+
'undo-commit': CommitEditRequest;
|
|
298
|
+
'revert-commit': CommitEditRequest & {
|
|
299
|
+
hash: string;
|
|
300
|
+
mainline?: number;
|
|
301
|
+
};
|
|
302
|
+
'get-merge-preview': {
|
|
303
|
+
sessionId: string;
|
|
304
|
+
target: string;
|
|
305
|
+
};
|
|
306
|
+
'merge-branch': {
|
|
307
|
+
sessionId: string;
|
|
308
|
+
operationId: string;
|
|
309
|
+
target: string;
|
|
310
|
+
token: string;
|
|
311
|
+
mode: MergeMode;
|
|
312
|
+
};
|
|
313
|
+
'get-conflicts': {
|
|
314
|
+
sessionId: string;
|
|
315
|
+
};
|
|
316
|
+
'get-conflict': {
|
|
317
|
+
sessionId: string;
|
|
318
|
+
path: string;
|
|
319
|
+
};
|
|
320
|
+
'save-conflict': {
|
|
321
|
+
sessionId: string;
|
|
322
|
+
operationId: string;
|
|
323
|
+
path: string;
|
|
324
|
+
token: string;
|
|
325
|
+
content: string;
|
|
326
|
+
};
|
|
327
|
+
'resolve-conflict': {
|
|
328
|
+
sessionId: string;
|
|
329
|
+
operationId: string;
|
|
330
|
+
path: string;
|
|
331
|
+
token: string;
|
|
332
|
+
choice: 'result' | 'ours' | 'theirs' | 'delete';
|
|
333
|
+
};
|
|
334
|
+
'start-operation': {
|
|
335
|
+
sessionId: string;
|
|
336
|
+
operationId: string;
|
|
337
|
+
kind: ConflictOperation;
|
|
338
|
+
target: string;
|
|
339
|
+
confirmRisk: boolean;
|
|
340
|
+
};
|
|
341
|
+
'finish-operation': {
|
|
342
|
+
sessionId: string;
|
|
343
|
+
operationId: string;
|
|
344
|
+
kind: ConflictOperation;
|
|
345
|
+
token: string;
|
|
346
|
+
mode: 'continue' | 'abort' | 'skip';
|
|
347
|
+
confirmRisk: boolean;
|
|
348
|
+
};
|
|
206
349
|
'get-summary': {
|
|
207
350
|
sessionId: string;
|
|
208
351
|
};
|
|
@@ -229,6 +372,39 @@ export interface EasyGitRequestMap {
|
|
|
229
372
|
'get-stashes': {
|
|
230
373
|
sessionId: string;
|
|
231
374
|
};
|
|
375
|
+
'get-stash-detail': {
|
|
376
|
+
sessionId: string;
|
|
377
|
+
} & StashTarget;
|
|
378
|
+
'get-stash-diff': {
|
|
379
|
+
sessionId: string;
|
|
380
|
+
path: string;
|
|
381
|
+
untracked: boolean;
|
|
382
|
+
} & StashTarget;
|
|
383
|
+
'create-stash': {
|
|
384
|
+
sessionId: string;
|
|
385
|
+
operationId: string;
|
|
386
|
+
message: string;
|
|
387
|
+
paths?: string[];
|
|
388
|
+
includeUntracked: boolean;
|
|
389
|
+
};
|
|
390
|
+
'apply-stash': {
|
|
391
|
+
sessionId: string;
|
|
392
|
+
operationId: string;
|
|
393
|
+
} & StashTarget;
|
|
394
|
+
'pop-stash': {
|
|
395
|
+
sessionId: string;
|
|
396
|
+
operationId: string;
|
|
397
|
+
} & StashTarget;
|
|
398
|
+
'drop-stash': {
|
|
399
|
+
sessionId: string;
|
|
400
|
+
operationId: string;
|
|
401
|
+
confirmRisk: boolean;
|
|
402
|
+
} & StashTarget;
|
|
403
|
+
'branch-stash': {
|
|
404
|
+
sessionId: string;
|
|
405
|
+
operationId: string;
|
|
406
|
+
name: string;
|
|
407
|
+
} & StashTarget;
|
|
232
408
|
'get-sync-state': {
|
|
233
409
|
sessionId: string;
|
|
234
410
|
};
|
|
@@ -333,6 +509,19 @@ export interface EasyGitRequestMap {
|
|
|
333
509
|
};
|
|
334
510
|
}
|
|
335
511
|
export interface EasyGitResponseMap {
|
|
512
|
+
'get-commit-edit-state': ActionResult<CommitEditState>;
|
|
513
|
+
'amend-message': ActionResult<ConflictState>;
|
|
514
|
+
'amend-commit': ActionResult<ConflictState>;
|
|
515
|
+
'undo-commit': ActionResult<ConflictState>;
|
|
516
|
+
'revert-commit': ActionResult<ConflictState>;
|
|
517
|
+
'get-merge-preview': ActionResult<MergePreview>;
|
|
518
|
+
'merge-branch': ActionResult<ConflictState>;
|
|
519
|
+
'get-conflicts': ActionResult<ConflictState>;
|
|
520
|
+
'get-conflict': ActionResult<ConflictDetail>;
|
|
521
|
+
'save-conflict': ActionResult<ConflictDetail>;
|
|
522
|
+
'resolve-conflict': ActionResult<ConflictState>;
|
|
523
|
+
'start-operation': ActionResult<ConflictState>;
|
|
524
|
+
'finish-operation': ActionResult<ConflictState>;
|
|
336
525
|
'get-summary': ActionResult<RepositorySummary>;
|
|
337
526
|
'get-diff': ActionResult<DiffResult>;
|
|
338
527
|
'get-branches': ActionResult<RepositoryReferences>;
|
|
@@ -340,6 +529,13 @@ export interface EasyGitResponseMap {
|
|
|
340
529
|
'get-commit-detail': ActionResult<CommitDetail>;
|
|
341
530
|
'get-commit-diff': ActionResult<CommitDiffResult>;
|
|
342
531
|
'get-stashes': ActionResult<StashSummary[]>;
|
|
532
|
+
'get-stash-detail': ActionResult<StashDetail>;
|
|
533
|
+
'get-stash-diff': ActionResult<DiffResult>;
|
|
534
|
+
'create-stash': ActionResult<RepositorySummary>;
|
|
535
|
+
'apply-stash': ActionResult<RepositorySummary>;
|
|
536
|
+
'pop-stash': ActionResult<RepositorySummary>;
|
|
537
|
+
'drop-stash': ActionResult<RepositorySummary>;
|
|
538
|
+
'branch-stash': ActionResult<RepositorySummary>;
|
|
343
539
|
'get-sync-state': ActionResult<SyncState>;
|
|
344
540
|
'stage-paths': ActionResult<RepositorySummary>;
|
|
345
541
|
'unstage-paths': ActionResult<RepositorySummary>;
|
|
@@ -367,3 +563,4 @@ export type EasyGitRequest<A extends EasyGitAction = EasyGitAction> = {
|
|
|
367
563
|
action: A;
|
|
368
564
|
} & EasyGitRequestMap[A];
|
|
369
565
|
export type EasyGitResponse<A extends EasyGitAction> = EasyGitResponseMap[A];
|
|
566
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-easygit-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "面向 DeepSeek Harness Web 的可视化 Git 工作台,支持查看仓库状态与提交记录、快捷执行常用 Git 操作,以及安全运行自然语言生成的分步骤命令提议。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,10 +23,9 @@
|
|
|
23
23
|
"client": {
|
|
24
24
|
"platform": "web",
|
|
25
25
|
"inject": [
|
|
26
|
-
"@deepseek-ai/dsh-
|
|
27
|
-
"@deepseek-ai/dsh-client-connection",
|
|
26
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
28
27
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
29
|
-
"@deepseek-ai/dsh-client-ui-
|
|
28
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right"
|
|
30
29
|
]
|
|
31
30
|
}
|
|
32
31
|
},
|