{"_id":"@4t145/create-dsh-plugin","name":"@4t145/create-dsh-plugin","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@4t145/create-dsh-plugin","version":"0.1.0","description":"Scaffold a new DeepSeek Harness (DSH) plugin project in TypeScript, ready for npx.","type":"module","bin":{"create-dsh-plugin":"bin/index.js"},"scripts":{"test":"node test/e2e.mjs"},"engines":{"node":">=18"},"keywords":["deepseek","harness","dsh","plugin","scaffold","typescript","cordis"],"license":"MIT","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/4t145/dsh-plugin-template.git"},"_id":"@4t145/create-dsh-plugin@0.1.0","gitHead":"739524db7e041c944a02c7f374dd18fd923dfb40","bugs":{"url":"https://github.com/4t145/dsh-plugin-template/issues"},"homepage":"https://github.com/4t145/dsh-plugin-template#readme","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-NYq36MRqKpo6dN1IwvUcYP6H+7KwpM/8QzRLd1NMLkcE7XFsjorc2mhUcwJ1um7iMNunEBbImmVsdW7FykjHBg==","shasum":"0c4a0c90ea9648894fbacea85d3ba14b7b5dd1ed","tarball":"https://registry.npmjs.org/@4t145/create-dsh-plugin/-/create-dsh-plugin-0.1.0.tgz","fileCount":12,"unpackedSize":22461,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDWGJ3Lbng6PQ5h/unAQ134u3KIure74HwfQHkKmbE9gAiBroqqV+tu2k0olXwX/DzXxzG4onGYiGpvR+alRpeiIug=="}]},"_npmUser":{"name":"4t145","email":"u4t145@163.com"},"directories":{},"maintainers":[{"name":"4t145","email":"u4t145@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/create-dsh-plugin_0.1.0_1786722024536_0.02480581926032266"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-14T15:40:24.371Z","0.1.0":"2026-08-14T15:40:24.667Z","modified":"2026-08-14T15:40:24.907Z"},"maintainers":[{"name":"4t145","email":"u4t145@163.com"}],"description":"Scaffold a new DeepSeek Harness (DSH) plugin project in TypeScript, ready for npx.","homepage":"https://github.com/4t145/dsh-plugin-template#readme","keywords":["deepseek","harness","dsh","plugin","scaffold","typescript","cordis"],"repository":{"type":"git","url":"git+https://github.com/4t145/dsh-plugin-template.git"},"bugs":{"url":"https://github.com/4t145/dsh-plugin-template/issues"},"license":"MIT","readme":"# @4t145/create-dsh-plugin\n\n通过 `npx` 一键创建一个可直接使用的 TypeScript 版 DeepSeek Harness（DSH）插件项目。\n\n基于官方文档《[第一个插件](https://deepseek-harness.github.io/deepseek-harness/develop/basic/)》《[开发一个工具](https://deepseek-harness.github.io/deepseek-harness/develop/basic/tool)》《[插件配置](https://deepseek-harness.github.io/deepseek-harness/develop/basic/config)》《[打包与安装插件](https://deepseek-harness.github.io/deepseek-harness/develop/basic/publish)》设计，模板内置：\n\n- 标准插件结构：`name` / `inject` / `Config`（Schemastery schema）/ `apply(ctx, config)`\n- 一个可直接运行的 `greet` 工具示例（`defineTool` + `ctx.tools.register`）\n- 两种加载方式：本地开发覆盖层（绝对路径指向 `src/index.ts`，Node ≥ 22.6 直接加载 TS）与 `dsh.bundle` 组合包（构建后安装进 profile）\n- 零运行时依赖的脚手架（纯 Node 内置模块），生成的插件项目用 `tsc` 构建，无额外打包器\n\n## 使用\n\n```sh\n# 创建项目（默认包名 dsh-<name>）\nnpx @4t145/create-dsh-plugin greet\n\n# 自定义包名 / 描述\nnpx @4t145/create-dsh-plugin greet --package-name my-greet --description \"Greeting tools for DSH\"\n\n# 作用域包名（目录名取 name 部分）\nnpx @4t145/create-dsh-plugin @acme/greet\n\n# 跳过依赖安装 / 覆盖已存在目录\nnpx @4t145/create-dsh-plugin greet --skip-install --force\n```\n\n生成的项目：\n\n```\ngreet/\n├── src/\n│   └── index.ts          # 插件入口（greet 工具示例 + 可配置问候语）\n├── cordis.patch.yml      # dsh.bundle 清单的 patch（按包名解析）\n├── cordis.dev.patch.yml  # 本地开发覆盖层（已写入 src/index.ts 的绝对路径）\n├── tsconfig.json         # 类型检查\n├── tsconfig.build.json   # 构建到 lib/\n└── package.json          # 含 dsh.bundle 清单 + peerDependencies\n```\n\n生成后立即：\n\n```sh\ncd greet\n\n# 1) 本地开发（从 deepseek-harness 源码检出运行）\npnpm dsh web --patch \"$PWD/cordis.dev.patch.yml\"\n\n# 2) 构建\nnpm run build\n\n# 3) 安装进 profile（作为组合包）\ndsh plugin --profile <profile> add .\n```\n\n详见生成项目内的 README.md。\n\n## 本地开发本脚手架\n\n```sh\nnpm pack                # 打出 4t145-create-dsh-plugin-<version>.tgz\nnpm exec --package=./4t145-create-dsh-plugin-0.1.0.tgz -- create-dsh-plugin greet\n# 或直接运行源码\nnode bin/index.js greet\n```\n\n## 发布到 npm（GitHub Actions + Trusted Publishing）\n\n仓库 [4t145/dsh-plugin-template](https://github.com/4t145/dsh-plugin-template) 内置 `.github/workflows/publish.yml`，采用 npm 官方的 **Trusted Publishing（OIDC）**：CI 不需要任何 npm token，GitHub Actions 通过 OIDC 短期凭证自动认证并发布，同时自动生成 provenance（供应链证明）。\n\n- 推送 `v<版本号>` 标签（如 `v0.1.0`）→ CI 先跑 `npm test`，再自动 `npm publish`\n- 标签必须与 `package.json` 的 `version` 一致，否则 CI 报错中止\n- 工作流已声明 `permissions: id-token: write`（OIDC 必需）\n\n### 一次性配置（首次发布前完成）\n\n1. **首次发布**：包必须先存在于 npm 才能配置 trusted publisher。在本机执行（需要 2FA 验证码）：\n\n```sh\ncd /home/atlas/Github/dsh-plugin-template\nnpm login        # 如尚未登录\nnpm publish      # 会要求输入 OTP\n```\n\n2. **添加 trusted publisher**：打开 https://www.npmjs.com/package/@4t145/create-dsh-plugin/settings → **Trusted publishing** 区域：\n\n| 字段 | 值 |\n|---|---|\n| Provider | GitHub Actions |\n| Organization or user | `4t145` |\n| Repository | `dsh-plugin-template` |\n| Workflow filename | `publish.yml`（只填文件名，带扩展名） |\n| Environment name | 留空 |\n| Allowed actions | `npm publish` |\n\n3. 之后每次发版：`npm version patch && git push --follow-tags`（或手动打 `v<版本>` 标签推送），CI 自动发布。\n\n4. （可选，推荐）发布验证通过后，在包设置页把 **Publishing access** 改为 *Require two-factor authentication and disallow tokens*，并删除 npm 账户里旧的 token。\n\n手动触发：Actions 页面的 **publish** workflow → Run workflow（只跑检查，不发布）。\n## 发布到 npm（手动）\n\n```sh\nnpm publish    # 之后即可全局使用 npx @4t145/create-dsh-plugin@latest <name>\n```\n\n> 注：npm 上已存在同名的非官方包 `create-dsh-plugin`，本仓库发布为 `@4t145/create-dsh-plugin`（作用域包）以避免混淆；DeepSeek 官方目前未提供任何脚手架。\n\n## 端到端测试\n\n```sh\nnpm test   # 脚手架 → npm install → typecheck → build\n```\n\n## 验证过的加载路径\n\n仓库开发过程中用 `@deepseek-ai/dsh@0.1.0-rc.6` 实测确认：\n\n1. `--patch` 覆盖层以**绝对路径**引用 `src/index.ts` → Node 类型剥离直接加载（无需构建）\n2. `--patch` 覆盖层引用构建产物 `lib/index.js` → 正常加载\n3. 按**包名**解析（模拟 profile node_modules 布局）→ 正常加载，patch 中 `config` 覆盖经 Schemastery 校验后生效\n\n## License\n\nMIT","readmeFilename":"README.md","_rev":"1-716820e580b5ed010ebbb8347e6bece9"}