dsh-codex-port 0.1.1 → 0.2.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/LICENSE +21 -0
- package/README.en.md +14 -1
- package/README.md +13 -2
- package/lib/discover.js +20 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/port.js +2 -0
- package/lib/tools.js +40 -1
- package/package.json +63 -64
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stardustlc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
CHANGED
|
@@ -8,6 +8,10 @@ Move the whole **official Codex plugin family** into DSH: scan `~/.codex` unpack
|
|
|
8
8
|
|
|
9
9
|
> Measured on a real machine: 186 official Codex plugins, 583 skills — one port run moved 577 successfully, 0 failures.
|
|
10
10
|
|
|
11
|
+
## Compatibility
|
|
12
|
+
|
|
13
|
+
Verified against `@deepseek-ai/dsh@0.1.1-rc.2` on 2026-08-26. Built for the cordis patch-bundle plugin model (`cordis.patch.yml` + `dsh.bundle.patch`). No runtime imports of `@deepseek-ai/*` internals.
|
|
14
|
+
|
|
11
15
|
## Installation
|
|
12
16
|
|
|
13
17
|
```bash
|
|
@@ -16,6 +20,15 @@ dsh plugin --profile web add dsh-codex-port
|
|
|
16
20
|
|
|
17
21
|
Requires the Codex CLI to be installed (the `~/.codex` directory must exist).
|
|
18
22
|
|
|
23
|
+
## Uninstall
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
dsh plugin --profile web remove dsh-codex-port
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then restart the web service. To clean up fully, also remove the plugin entry from your profile `cordis.patch.yml` if you overrode it.
|
|
30
|
+
|
|
31
|
+
|
|
19
32
|
## Configuration
|
|
20
33
|
|
|
21
34
|
Everything is optional; defaults just work:
|
|
@@ -67,4 +80,4 @@ pnpm test # build + 33 tests
|
|
|
67
80
|
|
|
68
81
|
## License
|
|
69
82
|
|
|
70
|
-
MIT
|
|
83
|
+
MIT
|
package/README.md
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
> 本机实测:186 个 Codex 官方插件、583 个技能,一次移植 577 个成功、0 失败。
|
|
15
15
|
|
|
16
|
+
## 兼容性
|
|
17
|
+
|
|
18
|
+
在 `@deepseek-ai/dsh@0.1.1-rc.2` 上验证(2026-08-26)。遵循 cordis 组合包补丁模型(`cordis.patch.yml` + `dsh.bundle.patch`),运行时不 import 任何 `@deepseek-ai/*` 内部模块。
|
|
19
|
+
|
|
16
20
|
## 安装
|
|
17
21
|
|
|
18
22
|
```bash
|
|
@@ -21,6 +25,15 @@ dsh plugin --profile web add dsh-codex-port
|
|
|
21
25
|
|
|
22
26
|
需要本机装有 Codex CLI(`~/.codex` 目录存在即可)。
|
|
23
27
|
|
|
28
|
+
## 卸载
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
dsh plugin --profile web remove dsh-codex-port
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
卸载后重启 Web 服务。如需彻底清理,可再手动删除自己 profile `cordis.patch.yml` 中覆盖的插件行。
|
|
35
|
+
|
|
36
|
+
|
|
24
37
|
## 配置
|
|
25
38
|
|
|
26
39
|
全部可选,默认即可用:
|
|
@@ -89,5 +102,3 @@ pnpm test # 构建 + 33 个测试
|
|
|
89
102
|
## License
|
|
90
103
|
|
|
91
104
|
MIT
|
|
92
|
-
|
|
93
|
-
|
package/lib/discover.js
CHANGED
|
@@ -17,6 +17,25 @@ function isDir(path) {
|
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
/** 语义化版本比较:按数字段逐段比较,忽略 v 前缀与 pre-release 后缀。 */
|
|
21
|
+
function isNewerVersion(a, b) {
|
|
22
|
+
const parse = (v) => {
|
|
23
|
+
const match = /v?(\d+(?:\.\d+)*)/.exec(v);
|
|
24
|
+
if (match === null)
|
|
25
|
+
return [];
|
|
26
|
+
return match[1].split('.').map((n) => Number(n));
|
|
27
|
+
};
|
|
28
|
+
const pa = parse(a);
|
|
29
|
+
const pb = parse(b);
|
|
30
|
+
const len = Math.max(pa.length, pb.length);
|
|
31
|
+
for (let i = 0; i < len; i += 1) {
|
|
32
|
+
const x = pa[i] ?? 0;
|
|
33
|
+
const y = pb[i] ?? 0;
|
|
34
|
+
if (x !== y)
|
|
35
|
+
return x > y;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
20
39
|
/** 读取 plugin.json;缺失或非法返回 null。 */
|
|
21
40
|
function readPluginManifest(pluginDir) {
|
|
22
41
|
const manifestPath = join(pluginDir, '.codex-plugin', 'plugin.json');
|
|
@@ -124,7 +143,7 @@ export function discoverPlugins(codexHome) {
|
|
|
124
143
|
}
|
|
125
144
|
else {
|
|
126
145
|
const betterPriority = candidate.priority > (candidates.find((c) => c.dir === existing.sourceDir)?.priority ?? -1);
|
|
127
|
-
const newerVersion = manifest.version !== 'unknown' && manifest.version !== existing.version && manifest.version
|
|
146
|
+
const newerVersion = manifest.version !== 'unknown' && manifest.version !== existing.version && isNewerVersion(manifest.version, existing.version);
|
|
128
147
|
if (betterPriority || newerVersion)
|
|
129
148
|
found.set(key, info);
|
|
130
149
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { type CodexPortConfig } from './config.js';
|
|
11
11
|
import { type CodexPortToolDefinition } from './tools.js';
|
|
12
12
|
/** cordis 服务注入:apply 里要用 ctx.tools,必须显式声明。 */
|
|
13
|
+
export declare const name = "codex-port";
|
|
13
14
|
export declare const inject: string[];
|
|
14
15
|
/** 插件所需的最小 ctx 面。 */
|
|
15
16
|
export interface CodexPortPluginContext {
|
package/lib/index.js
CHANGED
package/lib/port.js
CHANGED
|
@@ -13,6 +13,8 @@ function copyTree(source, target) {
|
|
|
13
13
|
mkdirSync(target, { recursive: true });
|
|
14
14
|
let count = 0;
|
|
15
15
|
for (const entry of readdirSync(source, { withFileTypes: true })) {
|
|
16
|
+
if (entry.isSymbolicLink())
|
|
17
|
+
continue;
|
|
16
18
|
if (entry.isDirectory() && EXCLUDED_DIRS.has(entry.name))
|
|
17
19
|
continue;
|
|
18
20
|
const from = join(source, entry.name);
|
package/lib/tools.js
CHANGED
|
@@ -263,5 +263,44 @@ export function buildCodexPortTools(config) {
|
|
|
263
263
|
};
|
|
264
264
|
},
|
|
265
265
|
};
|
|
266
|
-
|
|
266
|
+
const codexHealth = {
|
|
267
|
+
name: 'codex_health',
|
|
268
|
+
description: 'dsh-codex-port 自检:检查 Codex 主目录(~/.codex 或自定义)是否存在、插件目录是否可见(不执行任何移植)。遇到问题时先运行本工具定位。',
|
|
269
|
+
parameters: compileParameters({
|
|
270
|
+
codexHome: { type: 'string', description: 'Codex 主目录(可选,缺省用配置或 ~/.codex)。' },
|
|
271
|
+
}),
|
|
272
|
+
output: {
|
|
273
|
+
schema: { type: 'object', additionalProperties: true },
|
|
274
|
+
render: (_args, value) => {
|
|
275
|
+
const rec = asRecord(value);
|
|
276
|
+
const checks = Array.isArray(rec.checks) ? rec.checks : [];
|
|
277
|
+
const lines = ['dsh-codex-port 自检' + (rec.ok === true ? ':正常。' : ':发现问题。')];
|
|
278
|
+
for (const item of checks) {
|
|
279
|
+
const c = asRecord(item);
|
|
280
|
+
lines.push('- ' + c.name + ':' + (c.ok === true ? '✅ ' + String(c.detail ?? '') : '❌ ' + String(c.detail ?? '')));
|
|
281
|
+
}
|
|
282
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
async execute(rawArgs) {
|
|
286
|
+
const args = asRecord(rawArgs);
|
|
287
|
+
const home = optionalString(args, 'codexHome') ?? config.codexHome;
|
|
288
|
+
const checks = [];
|
|
289
|
+
try {
|
|
290
|
+
assertCodexHome(home);
|
|
291
|
+
checks.push({ name: 'Codex 主目录', ok: true, detail: home });
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
checks.push({ name: 'Codex 主目录', ok: false, detail: error instanceof Error ? error.message : String(error) });
|
|
295
|
+
return { ok: false, plugin: 'dsh-codex-port', codexHome: home, checks };
|
|
296
|
+
}
|
|
297
|
+
let ok = true;
|
|
298
|
+
const pluginsOk = existsSync(home + '/plugins');
|
|
299
|
+
checks.push({ name: '插件目录', ok: pluginsOk, detail: pluginsOk ? home + '/plugins' : 'plugins/ 不存在(Codex 尚未安装任何插件)' });
|
|
300
|
+
if (!pluginsOk)
|
|
301
|
+
ok = false;
|
|
302
|
+
return { ok, plugin: 'dsh-codex-port', codexHome: home, checks };
|
|
303
|
+
},
|
|
304
|
+
};
|
|
305
|
+
return [codexList, codexPort, codexStatus, codexHealth];
|
|
267
306
|
}
|
package/package.json
CHANGED
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-codex-port",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DSH 技能移植工具插件:把 ~/.codex 里的 Codex 官方插件(170+ 个)一键移植为 DSH 技能(codex_list / codex_port / codex_status),frontmatter 自动转换、名称清洗、幂等跳过。",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./lib/index.d.ts",
|
|
11
|
-
"default": "./lib/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
14
|
-
"./package.json": "./package.json"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"lib",
|
|
18
|
-
"cordis.patch.yml",
|
|
19
|
-
"README.md",
|
|
20
|
-
"README.en.md"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsc -p tsconfig.json",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-codex-port",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "DSH 技能移植工具插件:把 ~/.codex 里的 Codex 官方插件(170+ 个)一键移植为 DSH 技能(codex_list / codex_port / codex_status),frontmatter 自动转换、名称清洗、幂等跳过。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib",
|
|
18
|
+
"cordis.patch.yml",
|
|
19
|
+
"README.md",
|
|
20
|
+
"README.en.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
25
|
+
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
26
|
+
"prepublishOnly": "pnpm run build"
|
|
27
|
+
},
|
|
28
|
+
"dsh": {
|
|
29
|
+
"bundle": {
|
|
30
|
+
"patch": "./cordis.patch.yml"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"dsh",
|
|
35
|
+
"deepseek-harness",
|
|
36
|
+
"plugin",
|
|
37
|
+
"codex",
|
|
38
|
+
"skills",
|
|
39
|
+
"migration",
|
|
40
|
+
"dsh-plugin"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=22"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"yaml": "^2.9.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^24.0.0",
|
|
51
|
+
"typescript": "^5.6.0"
|
|
52
|
+
},
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/STARDUSTLC666/dsh-codex-port.git"
|
|
56
|
+
},
|
|
57
|
+
"bugs": {
|
|
58
|
+
"url": "https://github.com/STARDUSTLC666/dsh-codex-port/issues"
|
|
59
|
+
},
|
|
60
|
+
"homepage": "https://github.com/STARDUSTLC666/dsh-codex-port#readme",
|
|
61
|
+
"author": "stardustlc",
|
|
62
|
+
"packageManager": "pnpm@11.7.0"
|
|
63
|
+
}
|