@klarkxy/dsh-git-commit 0.1.3
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 +42 -0
- package/README.md +38 -0
- package/cordis.patch.yml +5 -0
- package/docs/README.zh-CN.md +30 -0
- package/icon.svg +16 -0
- package/lib/client.inner.cjs +389 -0
- package/lib/client.inner.cjs.map +1 -0
- package/lib/client.js +559 -0
- package/lib/contracts.d.ts +2 -0
- package/lib/contracts.js +24 -0
- package/lib/contracts.js.map +1 -0
- package/lib/contracts2.d.ts +54 -0
- package/lib/index.d.ts +101 -0
- package/lib/index.js +846 -0
- package/lib/index.js.map +1 -0
- package/package.json +108 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { i as CommitRunResult, l as GitCommitStatus } from "./contracts2.js";
|
|
2
|
+
import { AiServices, RpcResult } from "@klarkxy/dsh-ai-services/contracts";
|
|
3
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
//#region src/git.d.ts
|
|
5
|
+
interface GitRunOptions {
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly signal?: AbortSignal;
|
|
8
|
+
readonly timeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
type GitRunner = (args: readonly string[], options: GitRunOptions) => Promise<string>;
|
|
11
|
+
type ChangeStatus = 'modified' | 'added' | 'deleted' | 'renamed' | 'copied' | 'untracked';
|
|
12
|
+
interface ChangedFile {
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly status: ChangeStatus;
|
|
15
|
+
/** Rename source in porcelain -z output; committed with the destination. */
|
|
16
|
+
readonly origin?: string;
|
|
17
|
+
/** True when the index already stages this path. */
|
|
18
|
+
readonly staged: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parse `git status --porcelain=v1 -z --untracked-files=all` output.
|
|
22
|
+
* In -z mode rename/copy entries put the destination path first, then a NUL, then the origin path.
|
|
23
|
+
*/
|
|
24
|
+
declare function parsePorcelain(output: string): ChangedFile[];
|
|
25
|
+
interface UntrackedPreview {
|
|
26
|
+
readonly path: string;
|
|
27
|
+
readonly preview: string;
|
|
28
|
+
readonly binary: boolean;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/service.d.ts
|
|
32
|
+
interface SessionLike {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly header?: {
|
|
35
|
+
readonly cwd?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface SessionStoreLike {
|
|
39
|
+
get(id: string): SessionLike | undefined;
|
|
40
|
+
}
|
|
41
|
+
interface AgentStoreLike {
|
|
42
|
+
get(id: string): {
|
|
43
|
+
readonly status?: string;
|
|
44
|
+
} | undefined;
|
|
45
|
+
}
|
|
46
|
+
interface GitCommitServiceDeps {
|
|
47
|
+
readonly plugin: string;
|
|
48
|
+
readonly ai: AiServices;
|
|
49
|
+
readonly sessions: SessionStoreLike;
|
|
50
|
+
readonly agents?: AgentStoreLike;
|
|
51
|
+
readonly run?: GitRunner;
|
|
52
|
+
readonly preview?: (root: string, path: string) => Promise<UntrackedPreview>;
|
|
53
|
+
}
|
|
54
|
+
declare class GitCommitService {
|
|
55
|
+
private readonly deps;
|
|
56
|
+
private readonly run;
|
|
57
|
+
private readonly preview;
|
|
58
|
+
private scope;
|
|
59
|
+
private disposePurpose;
|
|
60
|
+
private running;
|
|
61
|
+
constructor(deps: GitCommitServiceDeps);
|
|
62
|
+
start(): void;
|
|
63
|
+
dispose(): Promise<void>;
|
|
64
|
+
private resolveRepo;
|
|
65
|
+
status(sessionId: string): Promise<GitCommitStatus>;
|
|
66
|
+
commit(sessionId: string, signal?: AbortSignal): Promise<CommitRunResult>;
|
|
67
|
+
private runCommit;
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/plan.d.ts
|
|
71
|
+
interface PlanGroup {
|
|
72
|
+
readonly message: string;
|
|
73
|
+
readonly files: readonly string[];
|
|
74
|
+
}
|
|
75
|
+
interface PlanInput {
|
|
76
|
+
readonly files: readonly ChangedFile[];
|
|
77
|
+
readonly recentSubjects: readonly string[];
|
|
78
|
+
readonly stat: string;
|
|
79
|
+
readonly diff: string;
|
|
80
|
+
readonly untracked: readonly UntrackedPreview[];
|
|
81
|
+
}
|
|
82
|
+
declare function buildPlanInput(input: PlanInput): string;
|
|
83
|
+
/**
|
|
84
|
+
* Validate the model plan against the exact change set. Returns undefined when
|
|
85
|
+
* the output is malformed, covers the wrong files, or duplicates a file.
|
|
86
|
+
*/
|
|
87
|
+
declare function parsePlan(text: string, files: readonly ChangedFile[]): PlanGroup[] | undefined;
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/index.d.ts
|
|
90
|
+
declare const name = "@klarkxy/dsh-git-commit";
|
|
91
|
+
declare const inject: readonly ["aiServices", "sessions", "agents", "connection", "webServer"];
|
|
92
|
+
declare module '@deepseek-ai/cordis' {
|
|
93
|
+
interface Context {
|
|
94
|
+
gitCommit: GitCommitService;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
declare function handleRpc(service: GitCommitService, endpoint: string, payload: unknown, signal: AbortSignal): Promise<RpcResult>;
|
|
98
|
+
declare function apply(ctx: Context): void;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { GitCommitService, apply, buildPlanInput, handleRpc, inject, name, parsePlan, parsePorcelain };
|
|
101
|
+
//# sourceMappingURL=index.d.ts.map
|