@dsh-xhl/dsh-git-gui 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 +21 -0
- package/README.md +110 -0
- package/cordis.patch.example.yml +6 -0
- package/cordis.patch.yml +10 -0
- package/lib/activity.js +140 -0
- package/lib/client.js +2222 -0
- package/lib/index.js +24 -0
- package/lib/parse.js +298 -0
- package/lib/runner.js +294 -0
- package/lib/service.js +932 -0
- package/package.json +68 -0
- package/scripts/build-client.mjs +110 -0
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-xhl/dsh-git-gui",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Git GUI panel for the DeepSeek Harness web surface: visualize working-tree changes (including every modification the agent makes), stage/commit/branch/merge/log/pull/push/stash/revert — all from the browser.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"default": "./lib/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./client": {
|
|
12
|
+
"default": "./lib/client.js"
|
|
13
|
+
},
|
|
14
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/wojiaoxiaomayun/dsh-git-gui.git"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"lib/index.js",
|
|
23
|
+
"lib/service.js",
|
|
24
|
+
"lib/runner.js",
|
|
25
|
+
"lib/parse.js",
|
|
26
|
+
"lib/activity.js",
|
|
27
|
+
"lib/client.js",
|
|
28
|
+
"scripts/build-client.mjs",
|
|
29
|
+
"package.json",
|
|
30
|
+
"README.md",
|
|
31
|
+
"cordis.patch.yml",
|
|
32
|
+
"cordis.patch.example.yml"
|
|
33
|
+
],
|
|
34
|
+
"dsh": {
|
|
35
|
+
"bundle": {
|
|
36
|
+
"patch": "./cordis.patch.yml"
|
|
37
|
+
},
|
|
38
|
+
"client": {
|
|
39
|
+
"platform": "web",
|
|
40
|
+
"inject": [
|
|
41
|
+
"@deepseek-ai/dsh-client-connection",
|
|
42
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-sidebar"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"build:client": "node scripts/build-client.mjs",
|
|
49
|
+
"watch:client": "node scripts/build-client.mjs --watch",
|
|
50
|
+
"test": "node --test",
|
|
51
|
+
"prepack": "node scripts/build-client.mjs"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
|
|
55
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.6"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
59
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.6",
|
|
60
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.6",
|
|
61
|
+
"react": "^18.3.1",
|
|
62
|
+
"react-dom": "^18.3.1"
|
|
63
|
+
},
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Micro-bundler for the dsh-git-gui client half (zero dependencies).
|
|
3
|
+
*
|
|
4
|
+
* DSH's browser module system loads exactly one classic script per plugin
|
|
5
|
+
* (`/plugins/<id>/client.js`) that must call
|
|
6
|
+
* `window.__ModuleLoader__.load({ id, factory })` with a CommonJS factory.
|
|
7
|
+
* The module id MUST equal the npm package name (it is read from
|
|
8
|
+
* package.json), and a synthetic `./pkg-id.js` module exposes that name to
|
|
9
|
+
* client code. Relative requires resolve inside our own registry; bare
|
|
10
|
+
* specifiers (`react`, `react/jsx-runtime`, `@deepseek-ai/...`) are handed
|
|
11
|
+
* to the runtime `require` provided by the module table.
|
|
12
|
+
*
|
|
13
|
+
* Usage: node scripts/build-client.mjs [--watch]
|
|
14
|
+
*/
|
|
15
|
+
import fs from 'node:fs'
|
|
16
|
+
import path from 'node:path'
|
|
17
|
+
import { fileURLToPath } from 'node:url'
|
|
18
|
+
|
|
19
|
+
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
20
|
+
const SRC = path.join(ROOT, 'client-src')
|
|
21
|
+
const OUT = path.join(ROOT, 'lib', 'client.js')
|
|
22
|
+
const ID = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')).name
|
|
23
|
+
|
|
24
|
+
function collectModules(dir, prefix = '.') {
|
|
25
|
+
const modules = new Map()
|
|
26
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
27
|
+
const full = path.join(dir, entry.name)
|
|
28
|
+
if (entry.isDirectory()) {
|
|
29
|
+
for (const [id, source] of collectModules(full, `${prefix}/${entry.name}`)) modules.set(id, source)
|
|
30
|
+
} else if (entry.isFile() && entry.name.endsWith('.js')) {
|
|
31
|
+
modules.set(`${prefix}/${entry.name}`, fs.readFileSync(full, 'utf8'))
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return modules
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function build() {
|
|
38
|
+
const modules = collectModules(SRC)
|
|
39
|
+
// synthetic module: the npm package name, available to client code
|
|
40
|
+
modules.set('./pkg-id.js', `module.exports = ${JSON.stringify(ID)}\n`)
|
|
41
|
+
const body = []
|
|
42
|
+
for (const [id, source] of modules) {
|
|
43
|
+
body.push(`${JSON.stringify(id)}: function (module, exports, require) {\n${source}\n}`)
|
|
44
|
+
}
|
|
45
|
+
const registry = body.join(',\n')
|
|
46
|
+
|
|
47
|
+
const output = `/* generated by scripts/build-client.mjs — do not edit */\n`
|
|
48
|
+
+ `window.__ModuleLoader__.load({\n`
|
|
49
|
+
+ ` id: ${JSON.stringify(ID)},\n`
|
|
50
|
+
+ ` factory: function (require) {\n`
|
|
51
|
+
+ ` var __modules = {\n${registry}\n };\n`
|
|
52
|
+
+ ` var __cache = {};\n`
|
|
53
|
+
+ ` function __normalize(base, spec) {\n`
|
|
54
|
+
+ ` if (!spec.startsWith('.')) return null;\n`
|
|
55
|
+
+ ` var parts = base.split('/');\n`
|
|
56
|
+
+ ` parts.pop();\n`
|
|
57
|
+
+ ` for (var i = 0; i < spec.length; ) {\n`
|
|
58
|
+
+ ` if (spec.startsWith('./', i)) { i += 2; continue; }\n`
|
|
59
|
+
+ ` if (spec.startsWith('../', i)) { i += 3; parts.pop(); continue; }\n`
|
|
60
|
+
+ ` break;\n`
|
|
61
|
+
+ ` }\n`
|
|
62
|
+
+ ` var rest = spec.slice(i).split('/').filter(Boolean).join('/');\n`
|
|
63
|
+
+ ` var joined = parts.filter(function (p) { return p !== '' && p !== '.'; }).join('/');\n`
|
|
64
|
+
+ ` var id = './' + (joined === '' ? '' : joined + '/') + rest;\n`
|
|
65
|
+
+ ` if (!/\.js$/.test(id)) id += '.js';\n`
|
|
66
|
+
+ ` return id;\n`
|
|
67
|
+
+ ` }\n`
|
|
68
|
+
+ ` function __load(id, base) {\n`
|
|
69
|
+
+ ` var resolved = __normalize(base, id);\n`
|
|
70
|
+
+ ` if (resolved === null) return require(id);\n`
|
|
71
|
+
+ ` if (Object.prototype.hasOwnProperty.call(__cache, resolved)) return __cache[resolved].exports;\n`
|
|
72
|
+
+ ` var mod = { exports: {} };\n`
|
|
73
|
+
+ ` __cache[resolved] = mod;\n`
|
|
74
|
+
+ ` var factory = __modules[resolved];\n`
|
|
75
|
+
+ ` if (factory === undefined) throw new Error(${JSON.stringify(ID)} + ': unknown module ' + resolved);\n`
|
|
76
|
+
+ ` factory(mod, mod.exports, function (spec) { return __load(spec, resolved); });\n`
|
|
77
|
+
+ ` return mod.exports;\n`
|
|
78
|
+
+ ` }\n`
|
|
79
|
+
+ ` return __load('./index.js', './entry.js');\n`
|
|
80
|
+
+ ` }\n`
|
|
81
|
+
+ `});\n`
|
|
82
|
+
|
|
83
|
+
fs.mkdirSync(path.dirname(OUT), { recursive: true })
|
|
84
|
+
fs.writeFileSync(OUT, output)
|
|
85
|
+
const kb = Math.round(output.length / 1024)
|
|
86
|
+
console.log(`built ${OUT} (${modules.size} modules, ${kb} KiB)`)
|
|
87
|
+
return modules.size
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const watch = process.argv.includes('--watch')
|
|
91
|
+
const count = build()
|
|
92
|
+
if (watch) {
|
|
93
|
+
let timer = null
|
|
94
|
+
const rebuild = () => {
|
|
95
|
+
if (timer !== null) return
|
|
96
|
+
timer = setTimeout(() => {
|
|
97
|
+
timer = null
|
|
98
|
+
try {
|
|
99
|
+
build()
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('build failed:', error)
|
|
102
|
+
}
|
|
103
|
+
}, 120)
|
|
104
|
+
}
|
|
105
|
+
fs.watch(SRC, { recursive: true }, rebuild)
|
|
106
|
+
console.log(`watching ${SRC} — rebuilds update lib/client.js (client HMR picks it up while the dsh web watcher runs)`)
|
|
107
|
+
} else if (count === 0) {
|
|
108
|
+
console.error('no client modules found')
|
|
109
|
+
process.exitCode = 1
|
|
110
|
+
}
|