@civilization/dsh-experimental-git 0.0.0-stage → 0.2.1-rc.2
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/LICENSE +21 -0
- package/README.i18n.yaml +13 -0
- package/README.md +22 -2
- package/README.zh.md +23 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +26 -0
- package/lib/client.js +2836 -0
- package/lib/index.js +7623 -0
- package/lib/types/client/GitBody.d.ts +66 -0
- package/lib/types/client/GitBranchPill.d.ts +27 -0
- package/lib/types/client/GitTitle.d.ts +12 -0
- package/lib/types/client/definition.d.ts +19 -0
- package/lib/types/client/git-helpers.d.ts +65 -0
- package/lib/types/client/index.d.ts +16 -0
- package/lib/types/client/locales.d.ts +185 -0
- package/lib/types/git-executor.d.ts +151 -0
- package/lib/types/index.d.ts +17 -0
- package/lib/types/tool.d.ts +11 -0
- package/lib/types/types.d.ts +175 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +75 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IntelliJ IDEA-Grade Git Tool Window Component.
|
|
3
|
+
* Supports DAG commit topology graph visualization, working tree staging, commit console,
|
|
4
|
+
* branch switcher, and unified diff inspector.
|
|
5
|
+
*/
|
|
6
|
+
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
7
|
+
import type { GitBranchesSummary, GitCommitDetail, GitCommitItem, GitDiffSummary, GitStatusSummary, GitTagItem } from '../types.ts';
|
|
8
|
+
/** Injected Git RPC methods */
|
|
9
|
+
export interface GitInjected {
|
|
10
|
+
readonly getStatus: (sessionId?: string) => Promise<GitStatusSummary>;
|
|
11
|
+
readonly getLog: (sessionId?: string, maxCount?: number) => Promise<readonly GitCommitItem[]>;
|
|
12
|
+
readonly getCommitDetails: (sessionId?: string, commit?: string) => Promise<GitCommitDetail | undefined>;
|
|
13
|
+
readonly getDiff: (sessionId?: string, options?: {
|
|
14
|
+
filePath?: string;
|
|
15
|
+
staged?: boolean;
|
|
16
|
+
commit?: string;
|
|
17
|
+
}) => Promise<GitDiffSummary>;
|
|
18
|
+
readonly getBranches: (sessionId?: string) => Promise<GitBranchesSummary>;
|
|
19
|
+
readonly checkout: (sessionId?: string, branch?: string, create?: boolean) => Promise<{
|
|
20
|
+
success: boolean;
|
|
21
|
+
message?: string;
|
|
22
|
+
}>;
|
|
23
|
+
readonly stage: (sessionId?: string, paths?: string[] | 'all') => Promise<{
|
|
24
|
+
success: boolean;
|
|
25
|
+
message?: string;
|
|
26
|
+
}>;
|
|
27
|
+
readonly unstage: (sessionId?: string, paths?: string[] | 'all') => Promise<{
|
|
28
|
+
success: boolean;
|
|
29
|
+
message?: string;
|
|
30
|
+
}>;
|
|
31
|
+
readonly discard: (sessionId?: string, paths?: string[]) => Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
message?: string;
|
|
34
|
+
}>;
|
|
35
|
+
readonly commit: (sessionId?: string, message?: string) => Promise<{
|
|
36
|
+
success: boolean;
|
|
37
|
+
message?: string;
|
|
38
|
+
}>;
|
|
39
|
+
readonly fetch: (sessionId?: string) => Promise<{
|
|
40
|
+
success: boolean;
|
|
41
|
+
message?: string;
|
|
42
|
+
}>;
|
|
43
|
+
readonly pull: (sessionId?: string) => Promise<{
|
|
44
|
+
success: boolean;
|
|
45
|
+
message?: string;
|
|
46
|
+
}>;
|
|
47
|
+
readonly push: (sessionId?: string) => Promise<{
|
|
48
|
+
success: boolean;
|
|
49
|
+
message?: string;
|
|
50
|
+
}>;
|
|
51
|
+
readonly getTags: (sessionId?: string) => Promise<readonly GitTagItem[]>;
|
|
52
|
+
readonly createTag: (sessionId?: string, name?: string, commit?: string, message?: string) => Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
message?: string;
|
|
55
|
+
}>;
|
|
56
|
+
readonly deleteTag: (sessionId?: string, name?: string) => Promise<{
|
|
57
|
+
success: boolean;
|
|
58
|
+
message?: string;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
export type GitBodyProps = PropsRuntime<'sidebar.right.pane.tab'> & PropsLocale<'gitView'> & GitInjected;
|
|
62
|
+
/**
|
|
63
|
+
* Main Git Body Component.
|
|
64
|
+
*/
|
|
65
|
+
export declare const GitBody: import("react").MemoExoticComponent<(props: GitBodyProps) => import("react").JSX.Element>;
|
|
66
|
+
//# sourceMappingURL=GitBody.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status bar Git branch pill and popover branch switcher (IDEA / VS Code style).
|
|
3
|
+
* Injected into the 'conversation.composer.dock' slot at order: -1.
|
|
4
|
+
*/
|
|
5
|
+
import type { GitBranchesSummary, GitStatusSummary } from '../types.ts';
|
|
6
|
+
export interface GitBranchPillProps {
|
|
7
|
+
getStatus?: ((sessionId?: string) => Promise<GitStatusSummary>) | undefined;
|
|
8
|
+
getBranches?: ((sessionId?: string) => Promise<GitBranchesSummary>) | undefined;
|
|
9
|
+
checkout?: ((sessionId: string | undefined, branch: string, create?: boolean) => Promise<{
|
|
10
|
+
success: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
}>) | undefined;
|
|
13
|
+
pull?: ((sessionId?: string) => Promise<{
|
|
14
|
+
success: boolean;
|
|
15
|
+
message?: string;
|
|
16
|
+
}>) | undefined;
|
|
17
|
+
push?: ((sessionId?: string) => Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
message?: string;
|
|
20
|
+
}>) | undefined;
|
|
21
|
+
sessionId?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Git Branch Pill rendered in the Composer Dock.
|
|
25
|
+
*/
|
|
26
|
+
export declare const GitBranchPill: import("react").MemoExoticComponent<({ getStatus, getBranches, checkout, pull, push, sessionId, }: GitBranchPillProps) => import("react").JSX.Element | null>;
|
|
27
|
+
//# sourceMappingURL=GitBranchPill.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Git tab's chip title in the right-sidebar header.
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
6
|
+
/**
|
|
7
|
+
* Git chip title component with branch glyph and title text.
|
|
8
|
+
* @param props - Slot props including tab info hook.
|
|
9
|
+
* @returns React node for tab chip.
|
|
10
|
+
*/
|
|
11
|
+
export declare function GitTitle({ useTabInfo }: PropsRuntime<'sidebar.right.pane.tab.title'>): ReactNode;
|
|
12
|
+
//# sourceMappingURL=GitTitle.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Definition of the `git` tab type for the right Sidebar.
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { SidebarRightTabDefinition } from '@deepseek-ai/dsh-client-ui-sidebar-right/client';
|
|
6
|
+
import type { TranslateNS } from '@deepseek-ai/dsh-client-locale/client';
|
|
7
|
+
/** The tab kind this package owns */
|
|
8
|
+
export declare const GIT_KIND = "git";
|
|
9
|
+
/** Implementation identity in the tab system */
|
|
10
|
+
export declare const GIT_ID = "@deepseek-ai/dsh-experimental-git";
|
|
11
|
+
/** Git artwork for the Sidebar Guide */
|
|
12
|
+
export declare function GuideArtworkGit(): React.ReactElement;
|
|
13
|
+
/**
|
|
14
|
+
* Tab definition for the Git right-sidebar viewer.
|
|
15
|
+
* @param t - namespace-bound translation function.
|
|
16
|
+
* @returns Complete sidebar tab definition.
|
|
17
|
+
*/
|
|
18
|
+
export declare function gitDefinition(t: TranslateNS<'gitView'>): SidebarRightTabDefinition;
|
|
19
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conventional Commits and presentation helpers for Git commits and avatars.
|
|
3
|
+
*/
|
|
4
|
+
export type ConventionalType = 'feat' | 'fix' | 'style' | 'refactor' | 'docs' | 'test' | 'chore' | 'release' | 'merge' | 'revert';
|
|
5
|
+
export interface ParsedCommitSubject {
|
|
6
|
+
readonly type?: ConventionalType;
|
|
7
|
+
readonly scope?: string;
|
|
8
|
+
readonly cleanSubject: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Parse conventional commit prefix from a commit subject.
|
|
12
|
+
* @param subject - Raw first line of commit message.
|
|
13
|
+
* @returns Parsed type, scope, and clean subject.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseConventionalCommit(subject: string): ParsedCommitSubject;
|
|
16
|
+
/**
|
|
17
|
+
* Deterministically compute avatar initial and background color for an author name.
|
|
18
|
+
* @param author - Author name or email.
|
|
19
|
+
* @returns Initial letter and hex color code.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getAuthorAvatar(author: string): {
|
|
22
|
+
initial: string;
|
|
23
|
+
color: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Format date string into YYYY-MM-DD HH:mm:ss.
|
|
27
|
+
* @param dateStr - ISO or Git date string.
|
|
28
|
+
* @returns Clean formatted local date and time string.
|
|
29
|
+
*/
|
|
30
|
+
export declare function formatFullDate(dateStr: string): string;
|
|
31
|
+
export declare const GRAPH_LANE_PALETTE: readonly ["#388bfd", "#3fb950", "#f0883e", "#a371f7", "#58a6ff", "#bc8cff", "#db61a2", "#2ea043"];
|
|
32
|
+
export interface DagNode {
|
|
33
|
+
readonly hash: string;
|
|
34
|
+
readonly lane: number;
|
|
35
|
+
readonly color: string;
|
|
36
|
+
readonly x: number;
|
|
37
|
+
readonly y: number;
|
|
38
|
+
readonly isHead: boolean;
|
|
39
|
+
readonly hasTag: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface DagEdge {
|
|
42
|
+
readonly key: string;
|
|
43
|
+
readonly fromHash: string;
|
|
44
|
+
readonly toHash?: string;
|
|
45
|
+
readonly color: string;
|
|
46
|
+
readonly d: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DagGraphModel {
|
|
49
|
+
readonly nodes: readonly DagNode[];
|
|
50
|
+
readonly edges: readonly DagEdge[];
|
|
51
|
+
readonly maxLane: number;
|
|
52
|
+
readonly graphWidth: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Compute global continuous SVG DAG topology graph for commit items (IntelliJ IDEA grade).
|
|
56
|
+
* Eliminates per-row segmentation gaps, floating nodes, and misaligned curves.
|
|
57
|
+
* @param commits - Ordered commit items.
|
|
58
|
+
* @returns Fully computed nodes, edges, maxLane, and width.
|
|
59
|
+
*/
|
|
60
|
+
export declare function computeDagGraph(commits: readonly {
|
|
61
|
+
hash: string;
|
|
62
|
+
parents?: readonly string[];
|
|
63
|
+
refs?: readonly string[];
|
|
64
|
+
}[]): DagGraphModel;
|
|
65
|
+
//# sourceMappingURL=git-helpers.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser entry for the experimental Git right-sidebar plugin.
|
|
3
|
+
*/
|
|
4
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
5
|
+
export type { GitBodyProps, GitInjected } from './GitBody.tsx';
|
|
6
|
+
export type { GitViewKey } from './locales.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Required browser services.
|
|
9
|
+
*/
|
|
10
|
+
export declare const inject: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Client plugin body: registers Git tab definition, locales, shortcut, and components.
|
|
13
|
+
* @param ctx - Client context carrying slots and connection services.
|
|
14
|
+
*/
|
|
15
|
+
export declare function apply(ctx: ClientContext): void;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Localized copy for the Git right-sidebar viewer and commands.
|
|
3
|
+
*/
|
|
4
|
+
export declare const NS = "gitView";
|
|
5
|
+
export declare const zh: {
|
|
6
|
+
'type.label': string;
|
|
7
|
+
'guide.title': string;
|
|
8
|
+
'guide.description': string;
|
|
9
|
+
'shortcut.noSession': string;
|
|
10
|
+
'tabs.changes': string;
|
|
11
|
+
'tabs.history': string;
|
|
12
|
+
'tabs.tree': string;
|
|
13
|
+
'tabs.branches': string;
|
|
14
|
+
'tabs.tags': string;
|
|
15
|
+
'actions.refresh': string;
|
|
16
|
+
'actions.viewDiff': string;
|
|
17
|
+
'actions.closeDiff': string;
|
|
18
|
+
'actions.stage': string;
|
|
19
|
+
'actions.unstage': string;
|
|
20
|
+
'actions.stageAll': string;
|
|
21
|
+
'actions.unstageAll': string;
|
|
22
|
+
'actions.discard': string;
|
|
23
|
+
'actions.commit': string;
|
|
24
|
+
'actions.commitAndPush': string;
|
|
25
|
+
'actions.checkout': string;
|
|
26
|
+
'actions.newBranch': string;
|
|
27
|
+
'actions.fetch': string;
|
|
28
|
+
'actions.pull': string;
|
|
29
|
+
'actions.push': string;
|
|
30
|
+
'commit.placeholder': string;
|
|
31
|
+
'commit.emptyWarning': string;
|
|
32
|
+
'commit.success': string;
|
|
33
|
+
'branch.filter': string;
|
|
34
|
+
'branch.local': string;
|
|
35
|
+
'branch.remote': string;
|
|
36
|
+
'branch.current': string;
|
|
37
|
+
'branch.newPrompt': string;
|
|
38
|
+
'branch.createAndCheckout': string;
|
|
39
|
+
'tree.author': string;
|
|
40
|
+
'tree.date': string;
|
|
41
|
+
'tree.hash': string;
|
|
42
|
+
'tree.changedFiles': string;
|
|
43
|
+
'tree.selectCommit': string;
|
|
44
|
+
'status.clean': string;
|
|
45
|
+
'status.notRepo': string;
|
|
46
|
+
'status.staged': string;
|
|
47
|
+
'status.unstaged': string;
|
|
48
|
+
'status.untracked': string;
|
|
49
|
+
'status.ahead': string;
|
|
50
|
+
'status.behind': string;
|
|
51
|
+
'diff.additions': string;
|
|
52
|
+
'diff.deletions': string;
|
|
53
|
+
'diff.empty': string;
|
|
54
|
+
'tag.filter': string;
|
|
55
|
+
'tag.newPrompt': string;
|
|
56
|
+
'tag.nameLabel': string;
|
|
57
|
+
'tag.namePlaceholder': string;
|
|
58
|
+
'tag.targetCommitLabel': string;
|
|
59
|
+
'tag.messageLabel': string;
|
|
60
|
+
'tag.messagePrompt': string;
|
|
61
|
+
'tag.createBtn': string;
|
|
62
|
+
'tag.cancelBtn': string;
|
|
63
|
+
'tag.locateBtn': string;
|
|
64
|
+
'tag.copyName': string;
|
|
65
|
+
'tag.deleteBtn': string;
|
|
66
|
+
'tag.deleteConfirm': string;
|
|
67
|
+
'tag.empty': string;
|
|
68
|
+
'tag.annotated': string;
|
|
69
|
+
'tag.locatedNotice': string;
|
|
70
|
+
'actions.locate': string;
|
|
71
|
+
'tree.colGraph': string;
|
|
72
|
+
'tree.colSubject': string;
|
|
73
|
+
'tree.colAuthor': string;
|
|
74
|
+
'tree.colTime': string;
|
|
75
|
+
'tree.colSha': string;
|
|
76
|
+
'tree.searchPlaceholder': string;
|
|
77
|
+
'tree.filterAll': string;
|
|
78
|
+
'tree.filterMainline': string;
|
|
79
|
+
'detail.title': string;
|
|
80
|
+
'detail.references': string;
|
|
81
|
+
'detail.author': string;
|
|
82
|
+
'detail.date': string;
|
|
83
|
+
'detail.parent': string;
|
|
84
|
+
'detail.checkout': string;
|
|
85
|
+
'detail.createBranchOrTag': string;
|
|
86
|
+
'footer.showingCount': string;
|
|
87
|
+
'footer.loadMore': string;
|
|
88
|
+
'footer.syncNormal': string;
|
|
89
|
+
'footer.ahead': string;
|
|
90
|
+
'footer.behind': string;
|
|
91
|
+
};
|
|
92
|
+
export type GitViewKey = keyof typeof zh;
|
|
93
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
94
|
+
interface LocaleNamespaceMap {
|
|
95
|
+
gitView: GitViewKey;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export declare const en: {
|
|
99
|
+
'type.label': string;
|
|
100
|
+
'guide.title': string;
|
|
101
|
+
'guide.description': string;
|
|
102
|
+
'shortcut.noSession': string;
|
|
103
|
+
'tabs.changes': string;
|
|
104
|
+
'tabs.history': string;
|
|
105
|
+
'tabs.tree': string;
|
|
106
|
+
'tabs.branches': string;
|
|
107
|
+
'tabs.tags': string;
|
|
108
|
+
'actions.refresh': string;
|
|
109
|
+
'actions.viewDiff': string;
|
|
110
|
+
'actions.closeDiff': string;
|
|
111
|
+
'actions.stage': string;
|
|
112
|
+
'actions.unstage': string;
|
|
113
|
+
'actions.stageAll': string;
|
|
114
|
+
'actions.unstageAll': string;
|
|
115
|
+
'actions.discard': string;
|
|
116
|
+
'actions.commit': string;
|
|
117
|
+
'actions.commitAndPush': string;
|
|
118
|
+
'actions.checkout': string;
|
|
119
|
+
'actions.newBranch': string;
|
|
120
|
+
'actions.fetch': string;
|
|
121
|
+
'actions.pull': string;
|
|
122
|
+
'actions.push': string;
|
|
123
|
+
'commit.placeholder': string;
|
|
124
|
+
'commit.emptyWarning': string;
|
|
125
|
+
'commit.success': string;
|
|
126
|
+
'branch.filter': string;
|
|
127
|
+
'branch.local': string;
|
|
128
|
+
'branch.remote': string;
|
|
129
|
+
'branch.current': string;
|
|
130
|
+
'branch.newPrompt': string;
|
|
131
|
+
'branch.createAndCheckout': string;
|
|
132
|
+
'tree.author': string;
|
|
133
|
+
'tree.date': string;
|
|
134
|
+
'tree.hash': string;
|
|
135
|
+
'tree.changedFiles': string;
|
|
136
|
+
'tree.selectCommit': string;
|
|
137
|
+
'status.clean': string;
|
|
138
|
+
'status.notRepo': string;
|
|
139
|
+
'status.staged': string;
|
|
140
|
+
'status.unstaged': string;
|
|
141
|
+
'status.untracked': string;
|
|
142
|
+
'status.ahead': string;
|
|
143
|
+
'status.behind': string;
|
|
144
|
+
'diff.additions': string;
|
|
145
|
+
'diff.deletions': string;
|
|
146
|
+
'diff.empty': string;
|
|
147
|
+
'tag.filter': string;
|
|
148
|
+
'tag.newPrompt': string;
|
|
149
|
+
'tag.nameLabel': string;
|
|
150
|
+
'tag.namePlaceholder': string;
|
|
151
|
+
'tag.targetCommitLabel': string;
|
|
152
|
+
'tag.messageLabel': string;
|
|
153
|
+
'tag.messagePrompt': string;
|
|
154
|
+
'tag.createBtn': string;
|
|
155
|
+
'tag.cancelBtn': string;
|
|
156
|
+
'tag.locateBtn': string;
|
|
157
|
+
'tag.copyName': string;
|
|
158
|
+
'tag.deleteBtn': string;
|
|
159
|
+
'tag.deleteConfirm': string;
|
|
160
|
+
'tag.empty': string;
|
|
161
|
+
'tag.annotated': string;
|
|
162
|
+
'tag.locatedNotice': string;
|
|
163
|
+
'actions.locate': string;
|
|
164
|
+
'tree.colGraph': string;
|
|
165
|
+
'tree.colSubject': string;
|
|
166
|
+
'tree.colAuthor': string;
|
|
167
|
+
'tree.colTime': string;
|
|
168
|
+
'tree.colSha': string;
|
|
169
|
+
'tree.searchPlaceholder': string;
|
|
170
|
+
'tree.filterAll': string;
|
|
171
|
+
'tree.filterMainline': string;
|
|
172
|
+
'detail.title': string;
|
|
173
|
+
'detail.references': string;
|
|
174
|
+
'detail.author': string;
|
|
175
|
+
'detail.date': string;
|
|
176
|
+
'detail.parent': string;
|
|
177
|
+
'detail.checkout': string;
|
|
178
|
+
'detail.createBranchOrTag': string;
|
|
179
|
+
'footer.showingCount': string;
|
|
180
|
+
'footer.loadMore': string;
|
|
181
|
+
'footer.syncNormal': string;
|
|
182
|
+
'footer.ahead': string;
|
|
183
|
+
'footer.behind': string;
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { GitBranchInfo, GitBranchesSummary, GitCommitDetail, GitCommitItem, GitDiffSummary, GitOperationResult, GitStatusSummary, GitTagItem } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Execute a git command in the target directory safely.
|
|
4
|
+
* @param cwd - Working directory for the git execution.
|
|
5
|
+
* @param args - Subcommand and arguments to pass to git.
|
|
6
|
+
* @returns Raw stdout trimmed, or undefined if the execution failed.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runGit(cwd: string, args: readonly string[]): Promise<string | undefined>;
|
|
9
|
+
/**
|
|
10
|
+
* Detailed execution result returning stdout, stderr, and success code.
|
|
11
|
+
* @param cwd - Working directory.
|
|
12
|
+
* @param args - Arguments.
|
|
13
|
+
* @returns Standard execution details.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runGitDetailed(cwd: string, args: readonly string[]): Promise<{
|
|
16
|
+
ok: boolean;
|
|
17
|
+
stdout: string;
|
|
18
|
+
stderr: string;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Check if the target directory is inside a valid git repository worktree.
|
|
22
|
+
* @param cwd - Target directory.
|
|
23
|
+
* @returns Whether cwd is a git repository.
|
|
24
|
+
*/
|
|
25
|
+
export declare function checkIsGitRepo(cwd: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the absolute top-level directory of the git repository.
|
|
28
|
+
* @param cwd - Target directory.
|
|
29
|
+
* @returns Top-level directory path, or undefined.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getGitRoot(cwd: string): Promise<string | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* Query full git repository status for the given directory.
|
|
34
|
+
* @param cwd - Target directory.
|
|
35
|
+
* @returns Complete status summary.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getGitStatus(cwd: string): Promise<GitStatusSummary>;
|
|
38
|
+
/**
|
|
39
|
+
* Query recent git commit history with DAG graph topology for the given directory.
|
|
40
|
+
* @param cwd - Target directory.
|
|
41
|
+
* @param maxCount - Maximum number of commits to retrieve (defaults to 50).
|
|
42
|
+
* @returns Ordered list of recent commits with topology paths.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getGitLog(cwd: string, maxCount?: number): Promise<readonly GitCommitItem[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Query details and changed files for a specific commit.
|
|
47
|
+
* @param cwd - Working directory.
|
|
48
|
+
* @param commitHash - Full or abbreviated commit hash.
|
|
49
|
+
* @returns Detailed commit information.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getGitCommitDetails(cwd: string, commitHash: string): Promise<GitCommitDetail | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Query git diff for specified file or current directory.
|
|
54
|
+
* @param cwd - Target directory.
|
|
55
|
+
* @param options - Diff parameters.
|
|
56
|
+
* @returns Complete diff text and per-file parsed statistics.
|
|
57
|
+
*/
|
|
58
|
+
export declare function getGitDiff(cwd: string, options?: {
|
|
59
|
+
path?: string;
|
|
60
|
+
staged?: boolean;
|
|
61
|
+
commit?: string;
|
|
62
|
+
}): Promise<GitDiffSummary>;
|
|
63
|
+
/**
|
|
64
|
+
* Query local and remote branches.
|
|
65
|
+
* @param cwd - Target directory.
|
|
66
|
+
* @returns Aggregated branch summary.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getGitAllBranches(cwd: string): Promise<GitBranchesSummary>;
|
|
69
|
+
/**
|
|
70
|
+
* Query git local branches (legacy helper).
|
|
71
|
+
* @param cwd - Target directory.
|
|
72
|
+
* @returns List of branch information.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getGitBranches(cwd: string): Promise<readonly GitBranchInfo[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Checkout an existing branch or create a new branch.
|
|
77
|
+
* @param cwd - Target directory.
|
|
78
|
+
* @param branch - Branch name to switch to.
|
|
79
|
+
* @param createNew - Whether to create a new branch (-b).
|
|
80
|
+
* @returns Operation result.
|
|
81
|
+
*/
|
|
82
|
+
export declare function gitCheckout(cwd: string, branch: string, createNew?: boolean): Promise<GitOperationResult>;
|
|
83
|
+
/**
|
|
84
|
+
* Stage files to index.
|
|
85
|
+
* @param cwd - Target directory.
|
|
86
|
+
* @param paths - Specific file paths or 'all'.
|
|
87
|
+
* @returns Operation result.
|
|
88
|
+
*/
|
|
89
|
+
export declare function gitStage(cwd: string, paths: readonly string[] | 'all'): Promise<GitOperationResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Unstage files from index.
|
|
92
|
+
* @param cwd - Target directory.
|
|
93
|
+
* @param paths - Specific file paths or 'all'.
|
|
94
|
+
* @returns Operation result.
|
|
95
|
+
*/
|
|
96
|
+
export declare function gitUnstage(cwd: string, paths: readonly string[] | 'all'): Promise<GitOperationResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Discard working tree changes for specified files.
|
|
99
|
+
* @param cwd - Target directory.
|
|
100
|
+
* @param paths - Specific file paths to discard.
|
|
101
|
+
* @returns Operation result.
|
|
102
|
+
*/
|
|
103
|
+
export declare function gitDiscard(cwd: string, paths: readonly string[]): Promise<GitOperationResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Commit staged changes with message.
|
|
106
|
+
* @param cwd - Target directory.
|
|
107
|
+
* @param message - Commit message.
|
|
108
|
+
* @returns Operation result.
|
|
109
|
+
*/
|
|
110
|
+
export declare function gitCommit(cwd: string, message: string): Promise<GitOperationResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Fetch updates from remotes.
|
|
113
|
+
* @param cwd - Target directory.
|
|
114
|
+
* @returns Operation result.
|
|
115
|
+
*/
|
|
116
|
+
export declare function gitFetch(cwd: string): Promise<GitOperationResult>;
|
|
117
|
+
/**
|
|
118
|
+
* Pull remote changes into current branch.
|
|
119
|
+
* @param cwd - Target directory.
|
|
120
|
+
* @returns Operation result.
|
|
121
|
+
*/
|
|
122
|
+
export declare function gitPull(cwd: string): Promise<GitOperationResult>;
|
|
123
|
+
/**
|
|
124
|
+
* Push local commits to remote upstream.
|
|
125
|
+
* @param cwd - Target directory.
|
|
126
|
+
* @returns Operation result.
|
|
127
|
+
*/
|
|
128
|
+
export declare function gitPush(cwd: string): Promise<GitOperationResult>;
|
|
129
|
+
/**
|
|
130
|
+
* Query all git tags in the repository sorted by creation date descending.
|
|
131
|
+
* @param cwd - Target directory.
|
|
132
|
+
* @returns Ordered list of Git tags with commit hashes and metadata.
|
|
133
|
+
*/
|
|
134
|
+
export declare function getGitTags(cwd: string): Promise<readonly GitTagItem[]>;
|
|
135
|
+
/**
|
|
136
|
+
* Create a new git tag at the specified commit or HEAD.
|
|
137
|
+
* @param cwd - Target directory.
|
|
138
|
+
* @param name - Tag name (e.g. 'v1.0.0').
|
|
139
|
+
* @param targetCommit - Optional commit hash (defaults to HEAD).
|
|
140
|
+
* @param message - Optional annotation message. If provided, creates an annotated tag (-a).
|
|
141
|
+
* @returns Operation result.
|
|
142
|
+
*/
|
|
143
|
+
export declare function gitCreateTag(cwd: string, name: string, targetCommit?: string, message?: string): Promise<GitOperationResult>;
|
|
144
|
+
/**
|
|
145
|
+
* Delete a git tag.
|
|
146
|
+
* @param cwd - Target directory.
|
|
147
|
+
* @param name - Tag name to delete.
|
|
148
|
+
* @returns Operation result.
|
|
149
|
+
*/
|
|
150
|
+
export declare function gitDeleteTag(cwd: string, name: string): Promise<GitOperationResult>;
|
|
151
|
+
//# sourceMappingURL=git-executor.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host entry for the experimental Git plugin.
|
|
3
|
+
* Provides RPC endpoints for the Client right-sidebar viewer and the model tool for Agents.
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
export type * from './types.ts';
|
|
7
|
+
/** Cordis plugin name */
|
|
8
|
+
export declare const name = "experimental-git";
|
|
9
|
+
/** Required host services */
|
|
10
|
+
export declare const inject: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Apply the Git host plugin.
|
|
13
|
+
* Sets up authenticated RPC handlers under `/git/*` and registers the model tool.
|
|
14
|
+
* @param ctx - Context carrying the connection and optional session services.
|
|
15
|
+
*/
|
|
16
|
+
export declare function apply(ctx: Context): void;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent model tool for inspecting Git repository status, commits, and diffs.
|
|
3
|
+
*/
|
|
4
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
5
|
+
/**
|
|
6
|
+
* Register git model tools (git_view and git_checkout) in the tools service.
|
|
7
|
+
* @param ctx - Context carrying the tools service.
|
|
8
|
+
* @param resolveDir - Resolver for the current agent or session working directory.
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerGitTool(ctx: Context, resolveDir: (sessionId?: string) => string): void;
|
|
11
|
+
//# sourceMappingURL=tool.d.ts.map
|