dsh-easygit-plugin 0.2.0 → 0.2.1
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-easygit-plugin composition mount patch
|
|
2
2
|
#
|
|
3
|
-
# Temporary use: dsh web --patch ./
|
|
3
|
+
# Temporary use: dsh web --patch ./easygit.cordis.yml
|
|
4
4
|
# Persistent use: merge this patch into the profile's cordis.patch.yml, or into
|
|
5
5
|
# $DSH_HOME/cordis.patch.yml for all profiles. Install this package first with
|
|
6
6
|
# dsh plugin --profile <name> add dsh-easygit-plugin (or an equivalent command).
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# package.json's dsh.bundle.patch only applies to packages listed in
|
|
9
9
|
# dsh.profile.bundles. A composition-row installation must use --patch or
|
|
10
10
|
# cordis.patch.yml. New top-level plugin rows must use insert; a direct
|
|
11
|
-
# `- id:
|
|
11
|
+
# `- id: easygit / name: ...` entry only patches an existing id and is skipped.
|
|
12
12
|
- insert:
|
|
13
|
-
- id:
|
|
13
|
+
- id: easygit
|
|
14
14
|
name: dsh-easygit-plugin
|
package/lib/client.js
CHANGED
|
@@ -7,8 +7,8 @@ function errorText(error) {
|
|
|
7
7
|
}
|
|
8
8
|
function markWorkbenchOpen(open) {
|
|
9
9
|
if (typeof document === "undefined" || !document.documentElement) return;
|
|
10
|
-
if (open) document.documentElement.setAttribute("data-
|
|
11
|
-
else document.documentElement.removeAttribute("data-
|
|
10
|
+
if (open) document.documentElement.setAttribute("data-easygit-workbench-open", "");
|
|
11
|
+
else document.documentElement.removeAttribute("data-easygit-workbench-open");
|
|
12
12
|
}
|
|
13
13
|
function createPanelController(options) {
|
|
14
14
|
const slots = options.slots;
|
|
@@ -383,7 +383,7 @@ function diffLineClass(line) {
|
|
|
383
383
|
|
|
384
384
|
// src/client/index.ts
|
|
385
385
|
var React = require("react");
|
|
386
|
-
var RPC_URL = "/
|
|
386
|
+
var RPC_URL = "/easygit";
|
|
387
387
|
function rpc(body, signal) {
|
|
388
388
|
return fetch(RPC_URL, {
|
|
389
389
|
method: "POST",
|
|
@@ -443,13 +443,13 @@ function injectStyles() {
|
|
|
443
443
|
.gg-workbench-action[aria-pressed="true"] { border: 0; background: var(--dsw-alias-button-ghost-active-fill, rgba(127,127,127,.16)); color: var(--dsw-alias-state-business-primary, #3964fe); }
|
|
444
444
|
.gg-workbench-action[aria-pressed="true"]:hover:not(:disabled) { background: var(--dsw-alias-button-ghost-active-hover, rgba(127,127,127,.22)); }
|
|
445
445
|
.gg-workbench-action-dot { width: 6px; height: 6px; border-radius: 50%; background: #e17b00; display: inline-block; }
|
|
446
|
-
html[data-
|
|
446
|
+
html[data-easygit-workbench-open] div[data-side='details'][data-side='details'] { display: none !important; pointer-events: none !important; }
|
|
447
447
|
.gg-workbench { position: fixed; z-index: 1; inset: 0 0 0 auto; box-sizing: border-box; width: var(--dsh-easygit-plugin-workbench-width, 36vw); max-width: 100vw; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid rgba(174,180,184,.75); color: #e9ecef; background: #202224; box-shadow: none; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
|
|
448
448
|
.gg-workbench-resize { position: absolute; z-index: 5; top: 0; bottom: 0; left: -6px; width: 12px; padding: 0; border: 0; background: transparent; cursor: col-resize; touch-action: none; }
|
|
449
449
|
.gg-workbench-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: rgba(127,127,127,.32); transition: background-color .12s ease, box-shadow .12s ease; }
|
|
450
450
|
.gg-workbench-resize:hover::after, .gg-workbench-resize:focus-visible::after, .gg-workbench-resize.dragging::after { background: #00c58b; box-shadow: 0 0 0 1px rgba(0,197,139,.28); }
|
|
451
451
|
.gg-workbench-resize:focus-visible { outline: 2px solid #00c58b; outline-offset: -2px; }
|
|
452
|
-
html[data-
|
|
452
|
+
html[data-easygit-workbench-resizing], html[data-easygit-workbench-resizing] * { cursor: col-resize !important; user-select: none !important; }
|
|
453
453
|
.gg-workbench-head { box-sizing: border-box; display: flex; min-height: 75px; flex: none; align-items: center; gap: 8px; padding: 14px 12px 12px; border-bottom: 1px solid #aeb4b8; }
|
|
454
454
|
.gg-workbench-title { font-size: 14px; line-height: 20px; font-weight: 500; color: #f4f4f4; }
|
|
455
455
|
.gg-workbench-close { display: grid; width: 28px; height: 28px; margin-left: auto; place-items: center; border: 0; border-radius: 999px; padding: 0; background: transparent; color: var(--dsw-alias-label-secondary, inherit); }
|
|
@@ -1616,7 +1616,7 @@ function GitWorkbenchPanel(props) {
|
|
|
1616
1616
|
window.addEventListener("resize", resize);
|
|
1617
1617
|
return () => {
|
|
1618
1618
|
window.removeEventListener("resize", resize);
|
|
1619
|
-
document.documentElement.removeAttribute("data-
|
|
1619
|
+
document.documentElement.removeAttribute("data-easygit-workbench-resizing");
|
|
1620
1620
|
};
|
|
1621
1621
|
}, []);
|
|
1622
1622
|
const setWorkbenchRatio = (nextValue, persist) => {
|
|
@@ -1635,7 +1635,7 @@ function GitWorkbenchPanel(props) {
|
|
|
1635
1635
|
currentRatio: ratio
|
|
1636
1636
|
};
|
|
1637
1637
|
if (event.currentTarget.focus) event.currentTarget.focus();
|
|
1638
|
-
document.documentElement.setAttribute("data-
|
|
1638
|
+
document.documentElement.setAttribute("data-easygit-workbench-resizing", "");
|
|
1639
1639
|
setIsResizing(true);
|
|
1640
1640
|
event.preventDefault();
|
|
1641
1641
|
};
|
|
@@ -1652,7 +1652,7 @@ function GitWorkbenchPanel(props) {
|
|
|
1652
1652
|
const drag = resizeDragRef.current;
|
|
1653
1653
|
if (!drag || drag.pointerId !== event.pointerId) return;
|
|
1654
1654
|
resizeDragRef.current = null;
|
|
1655
|
-
document.documentElement.removeAttribute("data-
|
|
1655
|
+
document.documentElement.removeAttribute("data-easygit-workbench-resizing");
|
|
1656
1656
|
setIsResizing(false);
|
|
1657
1657
|
persistWorkbenchRatio(drag.currentRatio);
|
|
1658
1658
|
};
|
|
@@ -1799,7 +1799,7 @@ function GitDock(props) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
1801
|
}).catch((err) => {
|
|
1802
|
-
console.log("
|
|
1802
|
+
console.log("easygit state \u8C03\u7528\u5931\u8D25", errorText2(err));
|
|
1803
1803
|
});
|
|
1804
1804
|
};
|
|
1805
1805
|
React.useEffect(() => {
|
|
@@ -2013,7 +2013,7 @@ function GitDock(props) {
|
|
|
2013
2013
|
var plugin = {
|
|
2014
2014
|
inject: ["slots", "timer", "layout"],
|
|
2015
2015
|
apply(ctx) {
|
|
2016
|
-
if (typeof ctx.effect === "function") ctx.effect(injectStyles, "
|
|
2016
|
+
if (typeof ctx.effect === "function") ctx.effect(injectStyles, "easygit: styles");
|
|
2017
2017
|
else injectStyles();
|
|
2018
2018
|
const slots = ctx.get("slots");
|
|
2019
2019
|
if (!slots) return;
|
package/lib/index.js
CHANGED
|
@@ -452,16 +452,16 @@ async function dispatchProposalAction(action, sessionId, body, dependencies) {
|
|
|
452
452
|
dependencies.resolveExecutionPolicy(sessionId),
|
|
453
453
|
() => dependencies.flushProposal(sessionId)
|
|
454
454
|
);
|
|
455
|
-
console.log("
|
|
455
|
+
console.log("easygit HTTP execute", proposal.proposalId, "ok=", result.ok);
|
|
456
456
|
return { status: 200, data: result };
|
|
457
457
|
}
|
|
458
458
|
return { status: 400, data: { ok: false, error: "unknown action: " + action } };
|
|
459
459
|
}
|
|
460
|
-
function
|
|
460
|
+
function registerEasyGitActions(webServer, dependencies) {
|
|
461
461
|
if (!webServer) return void 0;
|
|
462
462
|
return webServer.register({
|
|
463
463
|
kind: "prefix",
|
|
464
|
-
path: "/
|
|
464
|
+
path: "/easygit",
|
|
465
465
|
handler: async (req, res) => {
|
|
466
466
|
if (req.method !== "POST") {
|
|
467
467
|
sendJson(res, 405, { ok: false, error: "method not allowed" });
|
|
@@ -1419,7 +1419,7 @@ var require_plugin = __commonJS({
|
|
|
1419
1419
|
};
|
|
1420
1420
|
proposalService.closeOpen(sessionId);
|
|
1421
1421
|
storeProposal(sessionId, proposal);
|
|
1422
|
-
console.log("
|
|
1422
|
+
console.log("easygit \u4FEE\u6B63\u5EFA\u8BAE\u767B\u8BB0", proposal.proposalId, "session=", sessionId, "risk=", risk.level);
|
|
1423
1423
|
return proposal;
|
|
1424
1424
|
}
|
|
1425
1425
|
function storeProposal(sessionId, proposal) {
|
|
@@ -1447,7 +1447,7 @@ var require_plugin = __commonJS({
|
|
|
1447
1447
|
const backend = storage.backend.get("json");
|
|
1448
1448
|
if (!backend || !backend.kv || typeof backend.kv.open !== "function") throw new Error("JSON storage backend does not support key-value units");
|
|
1449
1449
|
unit = await backend.kv.open({
|
|
1450
|
-
name: "
|
|
1450
|
+
name: "easygit_proposals",
|
|
1451
1451
|
version: 1,
|
|
1452
1452
|
tables: ["proposals"],
|
|
1453
1453
|
hasGlobal: false
|
|
@@ -1460,7 +1460,7 @@ var require_plugin = __commonJS({
|
|
|
1460
1460
|
return ready;
|
|
1461
1461
|
}
|
|
1462
1462
|
var plugin2 = {
|
|
1463
|
-
name: "
|
|
1463
|
+
name: "easygit",
|
|
1464
1464
|
inject: ["shell", "tools"],
|
|
1465
1465
|
apply(ctx) {
|
|
1466
1466
|
const shell = ctx.get("shell");
|
|
@@ -1645,7 +1645,7 @@ var require_plugin = __commonJS({
|
|
|
1645
1645
|
}
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
|
-
const registerWebServer = (webServer) =>
|
|
1648
|
+
const registerWebServer = (webServer) => registerEasyGitActions(webServer, {
|
|
1649
1649
|
repository,
|
|
1650
1650
|
proposalStorageReady,
|
|
1651
1651
|
shell,
|
|
@@ -18,7 +18,7 @@ interface ProposalVerification {
|
|
|
18
18
|
message: string;
|
|
19
19
|
changedState: string;
|
|
20
20
|
}
|
|
21
|
-
interface
|
|
21
|
+
interface EasyGitActionDependencies {
|
|
22
22
|
repository: GitRepositoryService;
|
|
23
23
|
proposalStorageReady: Promise<void>;
|
|
24
24
|
shell: ShellService | null;
|
|
@@ -37,5 +37,5 @@ interface GitGuideActionDependencies {
|
|
|
37
37
|
resolveExecutionPolicy(sessionId: string): unknown;
|
|
38
38
|
}
|
|
39
39
|
/** Register the Client-to-Host POST dispatcher with a 1 MiB body limit. */
|
|
40
|
-
export declare function
|
|
40
|
+
export declare function registerEasyGitActions(webServer: WebServerService | null, dependencies: EasyGitActionDependencies): unknown;
|
|
41
41
|
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* It is mounted as one profile composition entry and serves every DeepSeek
|
|
5
5
|
* Harness session. It uses only ctx.tools.register for tools and a
|
|
6
|
-
* ctx.webServer POST /
|
|
6
|
+
* ctx.webServer POST /easygit route for Client-to-Host actions.
|
|
7
7
|
*
|
|
8
8
|
* The exposed model tools are git_propose and git_repo_state. Repository changes
|
|
9
9
|
* are only available through the Client action route.
|
|
@@ -162,7 +162,7 @@ export interface ProposalExecutionResponse extends ProposalCommandResponse {
|
|
|
162
162
|
proposalId: string | null;
|
|
163
163
|
} | null;
|
|
164
164
|
}
|
|
165
|
-
export interface
|
|
165
|
+
export interface EasyGitRequestMap {
|
|
166
166
|
'get-summary': {
|
|
167
167
|
sessionId: string;
|
|
168
168
|
};
|
|
@@ -253,7 +253,7 @@ export interface GitGuideRequestMap {
|
|
|
253
253
|
confirm?: boolean;
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
|
-
export interface
|
|
256
|
+
export interface EasyGitResponseMap {
|
|
257
257
|
'get-summary': ActionResult<RepositorySummary>;
|
|
258
258
|
'get-diff': ActionResult<DiffResult>;
|
|
259
259
|
'get-branches': ActionResult<RepositoryReferences>;
|
|
@@ -275,8 +275,8 @@ export interface GitGuideResponseMap {
|
|
|
275
275
|
verify: ProposalCommandResponse;
|
|
276
276
|
execute: ProposalExecutionResponse;
|
|
277
277
|
}
|
|
278
|
-
export type
|
|
279
|
-
export type
|
|
278
|
+
export type EasyGitAction = keyof EasyGitRequestMap;
|
|
279
|
+
export type EasyGitRequest<A extends EasyGitAction = EasyGitAction> = {
|
|
280
280
|
action: A;
|
|
281
|
-
} &
|
|
282
|
-
export type
|
|
281
|
+
} & EasyGitRequestMap[A];
|
|
282
|
+
export type EasyGitResponse<A extends EasyGitAction> = EasyGitResponseMap[A];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-easygit-plugin",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "面向 DeepSeek Harness Web 的可视化 Git 工作台,支持查看仓库状态与提交记录、快捷执行常用 Git 操作,以及安全运行自然语言生成的分步骤命令提议。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dsh": {
|
|
20
20
|
"bundle": {
|
|
21
|
-
"patch": "./
|
|
21
|
+
"patch": "./easygit.cordis.yml"
|
|
22
22
|
},
|
|
23
23
|
"client": {
|
|
24
24
|
"platform": "web",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"assets/preview.png",
|
|
52
52
|
"lib/*.js",
|
|
53
53
|
"lib/types/**/*.d.ts",
|
|
54
|
-
"
|
|
54
|
+
"easygit.cordis.yml",
|
|
55
55
|
"README.md",
|
|
56
56
|
"README.zh-CN.md",
|
|
57
57
|
"SECURITY.md",
|