dsh-codex-port 0.1.0 → 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 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
@@ -2,10 +2,16 @@
2
2
 
3
3
  # dsh-codex-port
4
4
 
5
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
6
+
5
7
  Move the whole **official Codex plugin family** into DSH: scan `~/.codex` unpacked plugins and plugin caches, then batch-port their skills into DSH skills (automatic frontmatter conversion, codex-only files stripped, name sanitization, idempotent skips).
6
8
 
7
9
  > Measured on a real machine: 186 official Codex plugins, 583 skills — one port run moved 577 successfully, 0 failures.
8
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
+
9
15
  ## Installation
10
16
 
11
17
  ```bash
@@ -14,6 +20,15 @@ dsh plugin --profile web add dsh-codex-port
14
20
 
15
21
  Requires the Codex CLI to be installed (the `~/.codex` directory must exist).
16
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
+
17
32
  ## Configuration
18
33
 
19
34
  Everything is optional; defaults just work:
@@ -65,4 +80,4 @@ pnpm test # build + 33 tests
65
80
 
66
81
  ## License
67
82
 
68
- MIT
83
+ MIT
package/README.md CHANGED
@@ -2,10 +2,21 @@
2
2
 
3
3
  # dsh-codex-port
4
4
 
5
+ > **Codex 全家桶,一条命令进 DSH**:实测 186 插件、583 技能、移植 577 个 0 失败。
6
+
7
+ ![npm version](https://img.shields.io/npm/v/dsh-codex-port?label=npm&color=blue) ![npm downloads](https://img.shields.io/npm/dm/dsh-codex-port) ![license](https://img.shields.io/npm/l/dsh-codex-port) ![stars](https://img.shields.io/github/stars/STARDUSTLC666/dsh-codex-port?style=social)
8
+
9
+ [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
10
+
11
+
5
12
  把 **Codex 官方插件全家桶**一键搬进 DSH:扫描 `~/.codex` 里的解包插件与插件缓存,把它们的技能批量移植为 DSH 技能(frontmatter 自动转换、codex 专属文件剔除、名称清洗、幂等跳过)。
6
13
 
7
14
  > 本机实测:186 个 Codex 官方插件、583 个技能,一次移植 577 个成功、0 失败。
8
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
+
9
20
  ## 安装
10
21
 
11
22
  ```bash
@@ -14,6 +25,15 @@ dsh plugin --profile web add dsh-codex-port
14
25
 
15
26
  需要本机装有 Codex CLI(`~/.codex` 目录存在即可)。
16
27
 
28
+ ## 卸载
29
+
30
+ ```bash
31
+ dsh plugin --profile web remove dsh-codex-port
32
+ ```
33
+
34
+ 卸载后重启 Web 服务。如需彻底清理,可再手动删除自己 profile `cordis.patch.yml` 中覆盖的插件行。
35
+
36
+
17
37
  ## 配置
18
38
 
19
39
  全部可选,默认即可用:
@@ -48,6 +68,22 @@ codex_status {} # 还有多少没移植
48
68
 
49
69
  移植后 DSH 技能目录立即可用,agent 按技能描述自动触发。
50
70
 
71
+ ## 跨平台使用
72
+
73
+ `targetDir` 不限于 DSH:指向任何支持 Agent Skills(SKILL.md)格式的 agent 技能目录,即可把 Codex 全家桶移植给它们:
74
+
75
+ | Agent | 建议 targetDir |
76
+ | :-- | :-- |
77
+ | DSH | `~/.dsh/skills`(默认)|
78
+ | Claude Code | `~/.claude/skills/` |
79
+ | Cursor | `.cursor/skills/` |
80
+ | Gemini CLI | `~/.gemini/skills/` |
81
+
82
+ ```text
83
+ codex_port { targetDir: ~/.claude/skills }
84
+ ```
85
+
86
+
51
87
  ## 移植规则
52
88
 
53
89
  - **frontmatter 转换**:Codex 的 `name/description/metadata` → DSH 的 `name/description/compatibility/allowed-tools`,多行描述完整保留
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 > existing.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
@@ -10,6 +10,7 @@
10
10
  import { resolveConfig } from './config.js';
11
11
  import { buildCodexPortTools } from './tools.js';
12
12
  /** cordis 服务注入:apply 里要用 ctx.tools,必须显式声明。 */
13
+ export const name = 'codex-port';
13
14
  export const inject = ['tools'];
14
15
  /**
15
16
  * 插件入口:解析配置并注册三个移植工具。
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
- return [codexList, codexPort, codexStatus];
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,63 +1,63 @@
1
- {
2
- "name": "dsh-codex-port",
3
- "version": "0.1.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
- "prepare": "tsc -p tsconfig.json",
25
- "typecheck": "tsc -p tsconfig.json --noEmit",
26
- "test": "pnpm run build && node --test \"test/*.test.mjs\"",
27
- "prepublishOnly": "pnpm run build"
28
- },
29
- "dsh": {
30
- "bundle": {
31
- "patch": "./cordis.patch.yml"
32
- }
33
- },
34
- "keywords": [
35
- "dsh",
36
- "deepseek-harness",
37
- "plugin",
38
- "codex",
39
- "skills",
40
- "migration"
41
- ],
42
- "license": "MIT",
43
- "engines": {
44
- "node": ">=20"
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": "https://github.com/STARDUSTLC666/dsh-codex-port"
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
- }
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
+ }