dsh-devdock-github 0.0.0-stage → 3.0.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.
@@ -0,0 +1,11 @@
1
+ # dsh-devdock-github bundle patch.
2
+ #
3
+ # 本行插入 GitHub / Git 平台插件。它在 inject 里声明 `devdock`,所以必须先
4
+ # 安装 dsh-devdock-core;只装本插件时该行保持 INACTIVE(不报错、不崩),
5
+ # 装上内核后自动激活。
6
+ #
7
+ # 与全量包 dsh-devdock 的路径不重叠(那边是 /api/push/repos,这边是
8
+ # /api/push/github/repos),所以两者可以同时安装。
9
+ - insert:
10
+ - id: push-github
11
+ name: dsh-devdock-github
package/icon.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-label="DevDock GitHub">
2
+ <rect width="64" height="64" rx="14" fill="#0F172A"/>
3
+ <!-- GitHub 八爪猫轮廓(简化到 14px 仍可辨) -->
4
+ <path d="M32 13c-10.5 0-19 8.5-19 19 0 8.4 5.4 15.5 13 18 1 .2 1.3-.4 1.3-.9v-3.4c-5.2 1.1-6.3-2.3-6.3-2.3-.9-2.2-2.1-2.8-2.1-2.8-1.7-1.2.1-1.2.1-1.2 1.9.1 2.9 2 2.9 2 1.7 2.9 4.5 2.1 5.6 1.6.2-1.2.7-2.1 1.2-2.6-4.2-.5-8.6-2.1-8.6-9.3 0-2.1.7-3.8 2-5.1-.2-.5-.9-2.4.2-5 0 0 1.6-.5 5.2 2 1.5-.4 3.1-.6 4.7-.6s3.2.2 4.7.6c3.6-2.5 5.2-2 5.2-2 1.1 2.6.4 4.5.2 5 1.2 1.3 2 3 2 5.1 0 7.2-4.4 8.8-8.6 9.3.7.6 1.3 1.8 1.3 3.6v5.3c0 .5.3 1.1 1.3.9 7.6-2.5 13-9.6 13-18 0-10.5-8.5-19-19-19z"
5
+ fill="#F8FAFC"/>
6
+ </svg>
package/index.js ADDED
@@ -0,0 +1,100 @@
1
+ /**
2
+ * DevDock · GitHub / Git 平台插件 · 加载器入口。
3
+ *
4
+ * 与内核同样的字节稳定 shim:本文件不得随版本变化,靠内容哈希导入实现。
5
+ *
6
+ * `inject` 里声明 `devdock` 之后,cordis 会等内核就绪再执行 apply —— 这就是
7
+ * 「先装内核、再装平台」的时序保证。内核不存在时本行保持 INACTIVE,不会让
8
+ * 组合启动失败。
9
+ *
10
+ * 本插件**不依赖**审查插件:推送前审查已独立成 dsh-devdock-review,客户端
11
+ * 用能力表探测它在不在。所以这里没有任何跨平台的 import。
12
+ *
13
+ * ## 与全量包的路径关系
14
+ *
15
+ * 全量包 `dsh-devdock` 直接注册 `/api/push/repos`、`/api/push/local` 等;
16
+ * 本插件经内核挂出来的是 `/api/push/github/repos`。**两套路径不重叠**,
17
+ * 所以和 npm 插件不同,本插件与全量包可以同时安装(只是界面会重复,
18
+ * 见 README 的「两条安装路线」)。
19
+ *
20
+ * @module index.js
21
+ */
22
+
23
+ import { createHash } from 'node:crypto';
24
+ import { readFile } from 'node:fs/promises';
25
+
26
+ /** 实现模块。 */
27
+ const IMPL_URL = new URL('./src/host/platform.js', import.meta.url);
28
+
29
+ /**
30
+ * 按内容哈希导入实现模块。
31
+ * @returns {Promise<typeof import('./src/host/platform.js')>}
32
+ */
33
+ async function loadImpl() {
34
+ let href = IMPL_URL.href;
35
+ try {
36
+ const bytes = await readFile(IMPL_URL);
37
+ const hash = createHash('sha256').update(bytes).digest('hex').slice(0, 16);
38
+ href = `${IMPL_URL.href}?v=${hash}`;
39
+ } catch {
40
+ // 读不到就让 import 报出真正的原因。
41
+ }
42
+ return await import(/* @vite-ignore */ href);
43
+ }
44
+
45
+ /**
46
+ * 必须先就绪的宿主服务:内核 + HTTP 服务器。
47
+ * @type {string[]}
48
+ */
49
+ export const inject = ['webServer', 'devdock'];
50
+
51
+ /**
52
+ * 挂载:向内核注册 github 平台。
53
+ *
54
+ * 与 npm 插件不同,这里**不需要**探测全量包:路径前缀不同(全量包
55
+ * `/api/push/repos`,本插件 `/api/push/github/repos`),不会撞 webServer 的
56
+ * 重复路径检查。但注册失败仍要被包一层可读说明,因为内核的原始错误会建议
57
+ * 「重启 DSH 后重试」,那在这个场景下同样是误导。
58
+ *
59
+ * @param {import('@deepseek-ai/cordis').Context} ctx
60
+ * @returns {Promise<void>}
61
+ */
62
+ export async function apply(ctx) {
63
+ const mod = await loadImpl();
64
+ const core = typeof ctx.get === 'function' ? ctx.get('devdock') : ctx.devdock;
65
+ if (!core || typeof core.registerPlatform !== 'function') {
66
+ throw new Error('dsh-devdock-github: 内核服务不可用,请先安装 dsh-devdock-core。');
67
+ }
68
+
69
+ /* 同名平台已存在(多半是本插件热重载):内核会先卸载旧的再装新的,
70
+ * 所以这里不需要额外处理——但如果是**另一个**插件占了 github 这个 id,
71
+ * 静默覆盖会让人困惑,所以提示一句。 */
72
+ if (typeof core.platforms === 'function') {
73
+ const existing = core.platforms().find((p) => p.id === 'github');
74
+ if (existing) {
75
+ console.warn(
76
+ 'dsh-devdock-github: 已有 github 平台在运行(可能是本插件重载),将替换它。',
77
+ );
78
+ }
79
+ }
80
+
81
+ const definition = mod.githubPlatform(core.platformContext());
82
+ let unregister;
83
+ try {
84
+ unregister = core.registerPlatform(definition);
85
+ } catch (error) {
86
+ const detail = String(error?.message ?? error)
87
+ .replace(/(可能是上一次加载残留的路由;重启 DSH 后重试)/g, '');
88
+ throw new Error(
89
+ 'dsh-devdock-github: 无法注册 github 平台——路由已被占用。'
90
+ + '常见原因是另一个插件也用了 github 这个平台 id;'
91
+ + `卸载它,或重启 DSH 让残留路由释放。(原始错误:${detail})`,
92
+ { cause: error },
93
+ );
94
+ }
95
+ if (typeof ctx.effect === 'function') {
96
+ ctx.effect(() => unregister, 'devdock: github platform');
97
+ } else {
98
+ ctx.on?.('dispose', () => { try { unregister(); } catch { /* 已注销 */ } });
99
+ }
100
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "DevDock · GitHub",
4
+ "description": "Manage GitHub and local Git inside DeepSeek Harness: multiple accounts, repository management, branches and releases, workspace version tree, one-click push, push-target memory, contribution calendar."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "DevDock · GitHub",
4
+ "description": "在 DeepSeek Harness 里管理 GitHub 与本地 Git:多账号、仓库管理、分支与发布、工作区版本树、一键推送、推送目标记忆、贡献日历。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,129 @@
1
1
  {
2
2
  "name": "dsh-devdock-github",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.0.0",
4
+ "description": "DevDock 的 GitHub / Git 平台插件:多账号(PAT 与设备码)、仓库管理、分支与发布、工作区版本树、提交/推送/拉取/撤回、推送目标记忆、仓库语言构成与贡献日历。",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./client": "./client.js",
10
+ "./locale/*.json": "./locale/*.json",
11
+ "./icon": "./icon.svg",
12
+ "./cordis.patch.yml": "./cordis.patch.yml",
13
+ "./package.json": "./package.json",
14
+ "./src/host/platform.js": "./src/host/platform.js",
15
+ "./src/host/github.js": "./src/host/github.js"
16
+ },
17
+ "files": [
18
+ "index.js",
19
+ "client.js",
20
+ "cordis.patch.yml",
21
+ "src",
22
+ "locale/*.json",
23
+ "icon.svg",
24
+ "README.md",
25
+ "CHANGELOG.md",
26
+ "LICENSE"
27
+ ],
28
+ "engines": {
29
+ "node": ">=20"
30
+ },
31
+ "keywords": [
32
+ "dsh",
33
+ "dsh-plugin",
34
+ "deepseek-harness",
35
+ "devdock",
36
+ "github",
37
+ "git",
38
+ "version-control",
39
+ "release"
40
+ ],
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/QingJing5906/dsh-DevDock.git"
44
+ },
45
+ "homepage": "https://github.com/QingJing5906/dsh-DevDock#readme",
46
+ "bugs": {
47
+ "url": "https://github.com/QingJing5906/dsh-DevDock/issues"
48
+ },
49
+ "author": "QingJing5906",
50
+ "license": "MIT",
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "peerDependencies": {
55
+ "dsh-devdock-core": "^3.0.0"
56
+ },
57
+ "scripts": {
58
+ "test": "node tests/verify-platform.mjs && node tests/verify-client.mjs && node tests/verify-externals.mjs && node tests/verify-coexist.mjs && node tests/verify-parity.mjs"
59
+ },
60
+ "dsh": {
61
+ "bundle": {
62
+ "patch": "./cordis.patch.yml"
63
+ },
64
+ "client": {
65
+ "platform": "web",
66
+ "inject": [
67
+ "@deepseek-ai/dsh-client-ui-conversation"
68
+ ],
69
+ "external": [
70
+ "dsh-devdock-core/client"
71
+ ]
72
+ },
73
+ "surfaces": {
74
+ "settings": {
75
+ "id": "push-github",
76
+ "label": "DevDock · GitHub",
77
+ "pages": [
78
+ {
79
+ "platform": "github",
80
+ "title": "GitHub",
81
+ "content": [
82
+ "账号卡片(PAT 与设备码)",
83
+ "贡献日历",
84
+ "最近消息",
85
+ "仓库管理"
86
+ ]
87
+ }
88
+ ]
89
+ },
90
+ "sidebar": {
91
+ "id": "push-github",
92
+ "label": "DevDock · GitHub",
93
+ "icon": "GithubMark",
94
+ "platforms": [
95
+ {
96
+ "id": "github",
97
+ "title": "GitHub 仓库",
98
+ "content": [
99
+ "仓库搜索",
100
+ "列表/卡片视图",
101
+ "仓库管理弹窗",
102
+ "新建仓库"
103
+ ]
104
+ }
105
+ ]
106
+ },
107
+ "workspaceTab": {
108
+ "id": "push-github",
109
+ "label": "DevDock · GitHub",
110
+ "icon": "GithubMark",
111
+ "requires": "betterSidebar",
112
+ "fallback": "conversation.session.header.utilities",
113
+ "platforms": [
114
+ {
115
+ "id": "github",
116
+ "title": "工作区 Git",
117
+ "content": [
118
+ "提交/推送/拉取",
119
+ "推送目标与分支",
120
+ "版本树",
121
+ "Agent 审查",
122
+ "发布 Release"
123
+ ]
124
+ }
125
+ ]
126
+ }
127
+ }
128
+ }
129
+ }