@xbzbing/dsh-git-panel 1.2.0 → 1.4.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 +9 -2
- package/README_EN.md +9 -2
- package/lib/client.js +164 -15
- package/lib/host/actions.d.ts +19 -0
- package/lib/host/core.d.ts +24 -1
- package/lib/host/index.d.ts +10 -4
- package/lib/host/index.js +393 -27
- package/lib/host/llm-face.d.ts +27 -0
- package/lib/host/parser.d.ts +9 -1
- package/lib/host/suggest.d.ts +4 -0
- package/lib/host/types.d.ts +95 -1
- package/package.json +2 -2
package/lib/host/actions.d.ts
CHANGED
|
@@ -11,5 +11,24 @@ type PlanResult = CommandPlan | {
|
|
|
11
11
|
};
|
|
12
12
|
/** Build the git command sequence for an action. */
|
|
13
13
|
export declare function planAction(action: GitAction, unborn: boolean): PlanResult;
|
|
14
|
+
/**
|
|
15
|
+
* Classify a non-zero git exit into a wire error code + message. Order is
|
|
16
|
+
* semantic and must not be reshuffled:
|
|
17
|
+
* - conflict first — a stash apply/pop conflict prints both "CONFLICT …" and
|
|
18
|
+
* "no changes added to commit", so it must win over the nothing-to-commit
|
|
19
|
+
* rule below (git keeps the stash entry on conflict → recoverable).
|
|
20
|
+
* - index.lock busy (another process holds the lock).
|
|
21
|
+
* - nothing-to-commit / no changes added (a real commit no-op).
|
|
22
|
+
* - not-found (missing ref / tag / stash).
|
|
23
|
+
* - local-changes-block (a dirty-worktree refusal; neutral wording covers both
|
|
24
|
+
* `git checkout` and `git stash apply`).
|
|
25
|
+
* - revert-merge (reverting a merge commit without a mainline parent — git
|
|
26
|
+
* refuses before touching the work tree, so it is a plain refusal).
|
|
27
|
+
* - git-error fallback (surface the repo's own stderr).
|
|
28
|
+
*/
|
|
29
|
+
export declare function classifyActionFailure(stdout: string, stderr: string, exitCode: number): {
|
|
30
|
+
code: GitErrorCode;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
14
33
|
/** Execute a management action, returning the fresh snapshot on success. */
|
|
15
34
|
export declare function runAction(deps: SnapshotDeps, config: GitPanelConfig, request: GitActionRequest): Promise<GitActionResult>;
|
package/lib/host/core.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { GitRunner } from './git.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AgentDefaultModelFace, LlmFace } from './llm-face.ts';
|
|
3
|
+
import type { DiffViewMode, GraphStyle, GitChange, GitErrorCode, GitSnapshotResult } from './types.ts';
|
|
3
4
|
export interface GitPanelConfig {
|
|
4
5
|
readonly timeoutMs: number;
|
|
5
6
|
/** Per-command stdout cap; also the per-side image-diff payload cap. */
|
|
@@ -10,11 +11,24 @@ export interface GitPanelConfig {
|
|
|
10
11
|
readonly showInputPill: boolean;
|
|
11
12
|
/** Default diff layout the views open with (user can switch per-diff). */
|
|
12
13
|
readonly defaultDiffView: DiffViewMode;
|
|
14
|
+
/** Commit-graph line style (parallel = VSCode-like, compact = git log). */
|
|
15
|
+
readonly graphStyle: GraphStyle;
|
|
16
|
+
/** Whether the "AI suggest" button shows in the commit box. */
|
|
17
|
+
readonly suggestEnabled: boolean;
|
|
18
|
+
/** Max diff bytes sent to the model; beyond this the diff is truncated. */
|
|
19
|
+
readonly suggestMaxBytes: number;
|
|
20
|
+
readonly suggestMaxOutputTokens: number;
|
|
21
|
+
readonly suggestTimeoutMs: number;
|
|
22
|
+
/** Optional provider/model route override; absent → the agent default. */
|
|
23
|
+
readonly suggestProvider?: string;
|
|
24
|
+
readonly suggestModel?: string;
|
|
13
25
|
}
|
|
14
26
|
export declare const DEFAULT_CONFIG: GitPanelConfig;
|
|
15
27
|
export declare function normalizeConfig(raw: unknown): GitPanelConfig;
|
|
16
28
|
/** Read the default-diff-view field, unwrapping a schemastery volatile ref. */
|
|
17
29
|
export declare function readDiffView(value: unknown, fallback: DiffViewMode): DiffViewMode;
|
|
30
|
+
/** Read the commit-graph style field, unwrapping a schemastery volatile ref. */
|
|
31
|
+
export declare function readGraphStyle(value: unknown, fallback: GraphStyle): GraphStyle;
|
|
18
32
|
/**
|
|
19
33
|
* Read a boolean config field, unwrapping a schemastery volatile reference
|
|
20
34
|
* (`{ get() }`) so a live-editable toggle reflects the latest value. Absent or
|
|
@@ -61,6 +75,15 @@ export interface SnapshotDeps {
|
|
|
61
75
|
* cwd is picked up soon after.
|
|
62
76
|
*/
|
|
63
77
|
readonly rootNegCache?: Map<string, number>;
|
|
78
|
+
/**
|
|
79
|
+
* Optional per-request resolvers for the host `llm` and `agentDefaultModel`
|
|
80
|
+
* services (see llm-face.ts). Resolved on every suggest call — never frozen
|
|
81
|
+
* at construction — so a provider fiber that activates late or restarts is
|
|
82
|
+
* picked up. Absent in deployments without a model backend; the suggest
|
|
83
|
+
* endpoint then reports `llm-unavailable` instead of failing activation.
|
|
84
|
+
*/
|
|
85
|
+
readonly getLlm?: () => LlmFace | undefined;
|
|
86
|
+
readonly getAgentDefaultModel?: () => AgentDefaultModelFace | undefined;
|
|
64
87
|
}
|
|
65
88
|
export type WorkspaceResolution = {
|
|
66
89
|
readonly ok: true;
|
package/lib/host/index.d.ts
CHANGED
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
10
10
|
import type { Context } from '@deepseek-ai/cordis';
|
|
11
11
|
import Schema from '@deepseek-ai/schemastery';
|
|
12
|
-
import type { GitActionRequest, GitActionResult, GitQueryRequest, GitQueryResponse, GitSnapshotRequest, GitSnapshotResult, GitVersionInfo, GitVersionRequest } from './types.ts';
|
|
13
|
-
export type { GitSnapshot, GitSnapshotResult, GitSnapshotRequest, GitFailure, GitCommit, GraphCommit, GitRef, GitChange, GitChangeStatus, GitAction, GitActionRequest, GitActionResult, GitErrorCode, GitQuery, GitQueryRequest, GitQueryResponse, GitQueryResult, GitBranch, GitFileStat, WorktreeStats, GitVersionRequest, GitVersionInfo, DiffViewMode, DirEntry, } from './types.ts';
|
|
12
|
+
import type { GitActionRequest, GitActionResult, GitQueryRequest, GitQueryResponse, GitSnapshotRequest, GitSnapshotResult, GitSuggestRequest, GitSuggestResult, GitVersionInfo, GitVersionRequest } from './types.ts';
|
|
13
|
+
export type { GitSnapshot, GitSnapshotResult, GitSnapshotRequest, GitFailure, GitCommit, GraphCommit, GitRef, GitChange, GitChangeStatus, GitAction, GitActionRequest, GitActionResult, GitErrorCode, GitQuery, GitQueryRequest, GitQueryResponse, GitQueryResult, GitBranch, GitFileStat, WorktreeStats, StashEntry, GitVersionRequest, GitVersionInfo, DiffViewMode, GraphStyle, DirEntry, ResetMode, GitSuggestRequest, GitSuggestResult, } from './types.ts';
|
|
14
14
|
export { normalizeConfig, DEFAULT_CONFIG, snapshotForSession, resolveWorkspace } from './core.ts';
|
|
15
15
|
export { createGitRunner } from './git.ts';
|
|
16
|
-
export { parseStatus, parseGraphLog, parseBranches, parseNameStatus, sumNumstat } from './parser.ts';
|
|
17
|
-
export { isSafePath, planAction, runAction } from './actions.ts';
|
|
16
|
+
export { parseStatus, parseGraphLog, parseBranches, parseNameStatus, parseStashList, parseTags, sumNumstat } from './parser.ts';
|
|
17
|
+
export { isSafePath, planAction, runAction, classifyActionFailure } from './actions.ts';
|
|
18
18
|
export { runQuery } from './queries.ts';
|
|
19
|
+
export { runSuggest } from './suggest.ts';
|
|
19
20
|
export { readVersionInfo, checkLatestVersion, compareVersions, parseRepository } from './version.ts';
|
|
20
21
|
export declare class GitPanelService extends TypertRemoteService {
|
|
21
22
|
static inject: string[];
|
|
@@ -28,9 +29,13 @@ export declare class GitPanelService extends TypertRemoteService {
|
|
|
28
29
|
static Config: Schema<Schemastery.ObjectS<NoInfer<{
|
|
29
30
|
showInputPill: Schema<boolean, boolean, "volatile-defined">;
|
|
30
31
|
defaultDiffView: Schema<"split" | "unified", "split" | "unified", "volatile-defined">;
|
|
32
|
+
graphStyle: Schema<"compact" | "parallel", "compact" | "parallel", "volatile-defined">;
|
|
33
|
+
suggestEnabled: Schema<boolean, boolean, "volatile-defined">;
|
|
31
34
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
32
35
|
showInputPill: Schema<boolean, boolean, "volatile-defined">;
|
|
33
36
|
defaultDiffView: Schema<"split" | "unified", "split" | "unified", "volatile-defined">;
|
|
37
|
+
graphStyle: Schema<"compact" | "parallel", "compact" | "parallel", "volatile-defined">;
|
|
38
|
+
suggestEnabled: Schema<boolean, boolean, "volatile-defined">;
|
|
34
39
|
}>>, "plain">;
|
|
35
40
|
private readonly deps;
|
|
36
41
|
private config;
|
|
@@ -40,6 +45,7 @@ export declare class GitPanelService extends TypertRemoteService {
|
|
|
40
45
|
snapshot(request: GitSnapshotRequest, signal?: AbortSignal): Promise<GitSnapshotResult>;
|
|
41
46
|
run(request: GitActionRequest, signal?: AbortSignal): Promise<GitActionResult>;
|
|
42
47
|
query(request: GitQueryRequest, signal?: AbortSignal): Promise<GitQueryResponse>;
|
|
48
|
+
suggest(request: GitSuggestRequest, signal?: AbortSignal): Promise<GitSuggestResult>;
|
|
43
49
|
version(request: GitVersionRequest): Promise<GitVersionInfo>;
|
|
44
50
|
/** Re-read config so a live-edited volatile field (showInputPill) is current. */
|
|
45
51
|
private liveConfig;
|