dsh-devdock-cloudflare 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,8 @@
1
+ # dsh-devdock-cloudflare bundle patch.
2
+ #
3
+ # 本行插入 Cloudflare 平台插件。它在 inject 里声明 `devdock`,所以必须
4
+ # 先安装 dsh-devdock-core;只装本插件时该行保持 INACTIVE(不报错、不崩),
5
+ # 装上内核后自动激活。
6
+ - insert:
7
+ - id: push-cloudflare
8
+ name: dsh-devdock-cloudflare
package/icon.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" role="img" aria-label="Cloudflare">
2
+ <rect width="24" height="24" rx="5.2" fill="#0D1117"/>
3
+ <path d="M7.4 17.4a3.1 3.1 0 0 1-.5-6.16 4.3 4.3 0 0 1 8.2-.44 3.3 3.3 0 0 1 .7 6.6z"
4
+ fill="none" stroke="#F38020" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </svg>
package/index.js ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Cloudflare 平台插件 · 加载器入口。
3
+ *
4
+ * 与内核同样的字节稳定 shim:本文件不得随版本变化,靠内容哈希导入实现。
5
+ *
6
+ * 与其他 bundle 的关键差异:本插件**依赖内核**。`inject` 里声明 `devdock`
7
+ * 之后,cordis 会等内核就绪再执行 apply —— 这就是「先装内核、再装平台」
8
+ * 的时序保证。内核不存在时本行保持 INACTIVE,不会让组合启动失败。
9
+ *
10
+ * @module index.js
11
+ */
12
+
13
+ import { createHash } from 'node:crypto';
14
+ import { readFile } from 'node:fs/promises';
15
+
16
+ /** 实现模块。 */
17
+ const IMPL_URL = new URL('./src/host/platform.js', import.meta.url);
18
+
19
+ /**
20
+ * 按内容哈希导入实现模块。
21
+ * @returns {Promise<typeof import('./src/host/platform.js')>}
22
+ */
23
+ async function loadImpl() {
24
+ let href = IMPL_URL.href;
25
+ try {
26
+ const bytes = await readFile(IMPL_URL);
27
+ const hash = createHash('sha256').update(bytes).digest('hex').slice(0, 16);
28
+ href = `${IMPL_URL.href}?v=${hash}`;
29
+ } catch {
30
+ // 读不到就让 import 报出真正的原因。
31
+ }
32
+ return await import(/* @vite-ignore */ href);
33
+ }
34
+
35
+ /**
36
+ * 必须先就绪的宿主服务:内核 + HTTP 服务器。
37
+ *
38
+ * 把 `devdock` 写进 inject 是刻意的:没有内核时本插件没有意义,安静的
39
+ * INACTIVE 比「启动了但注册失败」更容易诊断。
40
+ *
41
+ * @type {string[]}
42
+ */
43
+ export const inject = ['webServer', 'devdock'];
44
+
45
+ /**
46
+ * 挂载:向内核注册 Cloudflare 平台。
47
+ * @param {import('@deepseek-ai/cordis').Context} ctx
48
+ * @returns {Promise<void>}
49
+ */
50
+ export async function apply(ctx) {
51
+ const mod = await loadImpl();
52
+ const core = typeof ctx.get === 'function' ? ctx.get('devdock') : ctx.devdock;
53
+ if (!core || typeof core.registerPlatform !== 'function') {
54
+ throw new Error('dsh-devdock-cloudflare: 内核服务不可用,请先安装 dsh-devdock-core。');
55
+ }
56
+ const definition = mod.cloudflarePlatform(core.platformContext());
57
+ const unregister = core.registerPlatform(definition);
58
+ if (typeof ctx.effect === 'function') {
59
+ ctx.effect(() => unregister, 'devdock: cloudflare platform');
60
+ } else {
61
+ ctx.on?.('dispose', () => { try { unregister(); } catch { /* 已注销 */ } });
62
+ }
63
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "DevDock · Cloudflare",
4
+ "description": "Manage Cloudflare inside DeepSeek Harness: Pages projects with deployment rollback, Workers and routes, zone DNS records, pre-deploy review and usage."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "DevDock · Cloudflare",
4
+ "description": "在 DeepSeek Harness 里管理 Cloudflare:Pages 项目与部署回滚、Workers 与路由、域名 DNS 记录、部署前审查与用量统计。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,124 @@
1
1
  {
2
2
  "name": "dsh-devdock-cloudflare",
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 的 Cloudflare 平台插件:API Token / Global API Key 登录、Pages 项目与部署回滚、Workers 与路由、域名 DNS 记录管理、缓存与开发模式、部署前审查、用量统计。",
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
+ },
15
+ "files": [
16
+ "index.js",
17
+ "client.js",
18
+ "cordis.patch.yml",
19
+ "src",
20
+ "locale/*.json",
21
+ "icon.svg",
22
+ "README.md",
23
+ "CHANGELOG.md",
24
+ "LICENSE"
25
+ ],
26
+ "engines": {
27
+ "node": ">=20"
28
+ },
29
+ "keywords": [
30
+ "dsh",
31
+ "dsh-plugin",
32
+ "deepseek-harness",
33
+ "devdock",
34
+ "cloudflare",
35
+ "pages",
36
+ "workers",
37
+ "dns"
38
+ ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "https://github.com/QingJing5906/dsh-DevDock.git"
42
+ },
43
+ "homepage": "https://github.com/QingJing5906/dsh-DevDock#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/QingJing5906/dsh-DevDock/issues"
46
+ },
47
+ "author": "QingJing5906",
48
+ "license": "MIT",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "peerDependencies": {
53
+ "dsh-devdock-core": "^3.0.0"
54
+ },
55
+ "scripts": {
56
+ "test": "node tests/verify-platform.mjs && node tests/verify-client.mjs && node tests/verify-externals.mjs"
57
+ },
58
+ "dsh": {
59
+ "bundle": {
60
+ "patch": "./cordis.patch.yml"
61
+ },
62
+ "client": {
63
+ "platform": "web",
64
+ "inject": [
65
+ "@deepseek-ai/dsh-client-ui-conversation"
66
+ ],
67
+ "external": [
68
+ "dsh-devdock-core/client"
69
+ ]
70
+ },
71
+ "surfaces": {
72
+ "settings": {
73
+ "id": "push-cloudflare",
74
+ "label": "DevDock · Cloudflare",
75
+ "pages": [
76
+ {
77
+ "platform": "cloudflare",
78
+ "title": "Cloudflare",
79
+ "content": [
80
+ "账号卡片(API Token / Global API Key)",
81
+ "资源信息面板"
82
+ ]
83
+ }
84
+ ]
85
+ },
86
+ "sidebar": {
87
+ "id": "push-cloudflare",
88
+ "label": "DevDock · Cloudflare",
89
+ "icon": "CloudflareMark",
90
+ "platforms": [
91
+ {
92
+ "id": "cloudflare",
93
+ "title": "Cloudflare",
94
+ "content": [
95
+ "Pages 项目与部署历史",
96
+ "Workers",
97
+ "域名与 DNS 记录",
98
+ "Worker 路由"
99
+ ]
100
+ }
101
+ ]
102
+ },
103
+ "workspaceTab": {
104
+ "id": "push-cloudflare",
105
+ "label": "DevDock · Cloudflare",
106
+ "icon": "CloudflareMark",
107
+ "requires": "betterSidebar",
108
+ "fallback": "conversation.session.header.utilities",
109
+ "platforms": [
110
+ {
111
+ "id": "cloudflare",
112
+ "title": "工作区 Cloudflare",
113
+ "content": [
114
+ "目录类型探测",
115
+ "Pages / Worker 部署",
116
+ "新建 Worker 项目",
117
+ "部署前审查"
118
+ ]
119
+ }
120
+ ]
121
+ }
122
+ }
123
+ }
124
+ }