From 63ef11d3c0200c4bfa8289eafa7ababe72be770e Mon Sep 17 00:00:00 2001 From: Evan <88482418+Li-Evan@users.noreply.github.com> Date: Mon, 16 Nov 2026 21:03:28 +0800 Subject: [PATCH] fix: make the repo root the DSH package so GitHub installs ship the skills What: - Installing the plugin from GitHub source (`dsh plugin add github:Li-Evan/BloomTutor#path:/integrations/deepseek-harness`) reported success but installed a package with no skills/: the skills were only copied in by scripts/pack.mjs. Plugin markets offer exactly that install-from-source command, so listing it would have handed users an empty plugin. - Move the manifest to a root package.json. Its `files` ship the top-level skills/ plus integrations/deepseek-harness/{cordis.patch.yml, icon.svg, locale, docs}, so a GitHub install, a packed tarball and a future npm publish all get the same 21 files, and the patch's `/skills` is the real skills/ folder. pack.mjs is now just `npm pack` at the root. - The root package.json has no "type", scripts or dependencies: it applies to the whole repo, and "type": "module" would turn every .js file outside frontend/ and site/ into ESM. - Author is "Evan" (GitHub handle) rather than a legal name, since plugin markets display it. - meta.detail paths are now relative to the root; README and install docs say `dsh plugin --profile web add github:Li-Evan/BloomTutor`; PACKAGE_README.md folds into integrations/deepseek-harness/README.md. - Add icon-180.png (rendered from icon.svg) for markets that only take raster tile images. acceptance.mjs gains `--source ` to test a GitHub install. How to verify: - node --test integrations/deepseek-harness/test/*.test.mjs -> 6/6 pass. - node integrations/deepseek-harness/scripts/acceptance.mjs -> all 9 steps pass on DSH 0.2.2-rc.1 (Node 24.22.2, macOS arm64); skills load from node_modules/bloomtutor-dsh/skills/. - Same script with `--source github:Li-Evan/BloomTutor#` checks the GitHub install path (result in the PR). - gitleaks dir, trufflehog filesystem and scripts/secret-scan.sh: no findings. How to roll back: - git revert . Nothing is published to npm. If a plugin market already lists the repo, its install command breaks again after a revert, so remove those listings first. Co-Authored-By: Claude Opus 5.5 --- README.md | 8 +- README.zh.md | 8 +- .../deepseek-harness/PACKAGE_README.md | 82 ------------- integrations/deepseek-harness/README.md | 114 +++++++++++++----- integrations/deepseek-harness/icon-180.png | Bin 0 -> 5443 bytes integrations/deepseek-harness/locale/en.json | 2 +- integrations/deepseek-harness/locale/zh.json | 2 +- .../deepseek-harness/scripts/acceptance.mjs | 15 ++- .../deepseek-harness/scripts/pack.mjs | 39 ++---- .../deepseek-harness/test/package.test.mjs | 88 ++++++++------ .../package.json => package.json | 22 ++-- 11 files changed, 176 insertions(+), 204 deletions(-) delete mode 100644 integrations/deepseek-harness/PACKAGE_README.md create mode 100644 integrations/deepseek-harness/icon-180.png rename integrations/deepseek-harness/package.json => package.json (63%) diff --git a/README.md b/README.md index ca6fe66..b06fab6 100644 --- a/README.md +++ b/README.md @@ -73,14 +73,13 @@ Then say: `Create a new folder and help me learn [any topic]` /plugin install bloom@li-evan ``` -**Or use it in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)**: the same skills ship as the `bloomtutor-dsh` plugin. Until it is on npm, build it from this clone: +**Or use it in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)**: this repository is also the `bloomtutor-dsh` plugin, with the same skills: ```bash -node integrations/deepseek-harness/scripts/pack.mjs -dsh plugin --profile web add "$PWD/integrations/deepseek-harness/bloomtutor-dsh-0.1.0.tgz" +dsh plugin --profile web add github:Li-Evan/BloomTutor ``` -Details in [integrations/deepseek-harness](./integrations/deepseek-harness/PACKAGE_README.md). +Details in [integrations/deepseek-harness](./integrations/deepseek-harness/README.md). See [GUIDE.md](./GUIDE.md) for the full walkthrough. @@ -231,6 +230,7 @@ make up / make down # docker compose start / stop ``` ├── GUIDE.md # CLI usage guide +├── package.json # makes the repo the bloomtutor-dsh DeepSeek Harness plugin (no app code) ├── .env.example # configuration template ├── backend/ │ ├── app/ # FastAPI app: courses.py (course engine), knowledge*.py / coordinate.py (knowledge map), diff --git a/README.zh.md b/README.zh.md index 06dfa45..1095ca2 100644 --- a/README.zh.md +++ b/README.zh.md @@ -73,14 +73,13 @@ claude /plugin install bloom@li-evan ``` -**也可以在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 里用**:同一套 skill 打包成了 `bloomtutor-dsh` 插件。发布到 npm 之前,先从这个 clone 打包安装: +**也可以在 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 里用**:这个仓库本身也是 `bloomtutor-dsh` 插件,带同一套 skill: ```bash -node integrations/deepseek-harness/scripts/pack.mjs -dsh plugin --profile web add "$PWD/integrations/deepseek-harness/bloomtutor-dsh-0.1.0.tgz" +dsh plugin --profile web add github:Li-Evan/BloomTutor ``` -详见 [integrations/deepseek-harness](./integrations/deepseek-harness/PACKAGE_README.md#中文)。 +详见 [integrations/deepseek-harness](./integrations/deepseek-harness/README.md#中文)。 详见 [GUIDE.zh.md](./GUIDE.zh.md)。 @@ -230,6 +229,7 @@ make up / make down # docker compose 启动 / 停止 ``` ├── GUIDE.zh.md # CLI 模式使用说明 +├── package.json # 让仓库本身成为 DeepSeek Harness 插件 bloomtutor-dsh(不含应用代码) ├── .env.example # 配置模板 ├── backend/ │ ├── app/ # FastAPI 应用:courses.py(课程引擎)、knowledge*.py / coordinate.py(知识地图)、 diff --git a/integrations/deepseek-harness/PACKAGE_README.md b/integrations/deepseek-harness/PACKAGE_README.md deleted file mode 100644 index 6cab75e..0000000 --- a/integrations/deepseek-harness/PACKAGE_README.md +++ /dev/null @@ -1,82 +0,0 @@ -# bloomtutor-dsh - -[BloomTutor](https://github.com/Li-Evan/BloomTutor) for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness): a one-on-one AI tutor that writes a syllabus, teaches one adaptive lesson at a time, and shapes the next lesson from your notes and feedback. - -This is a community plugin. It is not made or endorsed by DeepSeek. - -[中文说明](#中文) - -## Install - -```bash -dsh plugin --profile web add bloomtutor-dsh@0.1.0 -``` - -Use `npx @deepseek-ai/dsh plugin …` if `dsh` is not on your PATH. Run the command once for each profile you use. Running it again with a newer version upgrades the plugin. - -Tested with DeepSeek Harness `0.2.2-rc.1` on Node 24. DeepSeek Harness is a developer preview; other versions may work but have not been tested. - -## Use - -Say in a chat: - -```text -Create a new folder and help me learn Rust ownership -``` - -Or name a skill: - -```text -Use the learn-feynman skill to check whether I really understand TCP congestion control -``` - -| Skill | What it does | -|-------|-------------| -| `bloom-tutor` | The full tutoring loop: syllabus → one lesson at a time → your `???` marks and feedback → next lesson → review → summary | -| `learn-deep` | Explains a new concept through all five lenses below in one pass | -| `learn-crossover` | Learn something new through what you already know | -| `learn-occam` | Decide whether something is worth learning, and how deep | -| `learn-graph` | Map a field and plan a learning path | -| `learn-prototype` | Learn by building the roughest working version, then improving it | -| `learn-feynman` | Check your understanding by explaining it back | - -The tutor keeps everything as Markdown in your workspace: a folder per topic with `syllabus.md`, `01.md`, `02.md` … and a `learning-log.jsonl` at the workspace root. - -## Which copy loads - -Skills you installed yourself win over this package when they have the same name. DeepSeek Harness looks in `/.dsh/skills`, `/.agents/skills`, `~/.dsh/skills` and `~/.agents/skills` before it looks here. If you copied `bloom-tutor` into one of those folders earlier, that copy is the one that loads. - -## Uninstall - -```bash -dsh plugin --profile web remove bloomtutor-dsh -``` - -## What it changes in DeepSeek Harness - -- `cordis.patch.yml` adds one `@deepseek-ai/dsh-skill-filesystem` provider, named `bloomtutor-plugin`, over the package's `skills/` folder. It keeps your own project and personal skill folders in view. -- Its `bundledSkillDir` value is a `!!js` expression that DeepSeek Harness runs in the host process. It only uses Node's built-in `path` and `module` helpers to find this installed package. -- The package has no tools, dependencies, install scripts, network requests or telemetry. -- The skills read and write Markdown files in your workspace. - -## 中文 - -在 DeepSeek Harness 里用 BloomTutor:一位一对一的 AI 导师,先出学习大纲,每次只讲一篇,下一篇按你的批注和反馈来调整。这是社区插件,不是 DeepSeek 官方出品。 - -安装: - -```bash -dsh plugin --profile web add bloomtutor-dsh@0.1.0 -``` - -`dsh` 不在 PATH 里时,用 `npx @deepseek-ai/dsh plugin …`。每个要用的 profile 各装一次;换成新版本号再运行一次就是升级。已在 DeepSeek Harness `0.2.2-rc.1`、Node 24 上测过。 - -装好后在对话里说「开个文件夹,帮我学 Rust 的所有权」,或者点名某个 Skill,比如「用 learn-feynman 检验一下我是不是真懂了 TCP 拥塞控制」。读课时在没看懂的地方标 `???`,读完在文末写反馈,然后说「我读完了」。 - -你自己装过的同名 Skill(`<项目>/.dsh/skills`、`<项目>/.agents/skills`、`~/.dsh/skills`、`~/.agents/skills`)优先于插件里的版本。 - -卸载:`dsh plugin --profile web remove bloomtutor-dsh`。 - -## License - -MIT diff --git a/integrations/deepseek-harness/README.md b/integrations/deepseek-harness/README.md index 631c907..06ade8d 100644 --- a/integrations/deepseek-harness/README.md +++ b/integrations/deepseek-harness/README.md @@ -1,25 +1,98 @@ -# DeepSeek Harness plugin +# BloomTutor for DeepSeek Harness -This folder builds `bloomtutor-dsh`, the npm package that brings BloomTutor's skills to [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH). Users install it with `dsh plugin --profile web add bloomtutor-dsh`; what they see is in [PACKAGE_README.md](PACKAGE_README.md), which becomes the package's README. +The BloomTutor skills as a [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (DSH) plugin, `bloomtutor-dsh`: a one-on-one AI tutor that writes a syllabus, teaches one adaptive lesson at a time, and shapes the next lesson from your notes and feedback. -## How it works +This is a community plugin. It is not made or endorsed by DeepSeek. -The package is skills only. `package.json` declares `"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }`, and the patch inserts one `@deepseek-ai/dsh-skill-filesystem` provider named `bloomtutor-plugin` whose `bundledSkillDir` is the package's `skills/` folder. DSH then lists those skills in its catalog and loads one when the model calls `skill({ name })`. +[中文说明](#中文) -The skills are not stored here. `scripts/pack.mjs` copies every folder with a `SKILL.md` from the repository's top-level [`skills/`](../../skills/) into the package at pack time, so editing a skill there changes the next release. +## Install + +```bash +dsh plugin --profile web add github:Li-Evan/BloomTutor +``` + +Use `npx @deepseek-ai/dsh plugin …` if `dsh` is not on your PATH. Run the command once for each profile you use; running it again picks up the latest version. + +Tested with DeepSeek Harness `0.2.2-rc.1` and `0.2.2-rc.3` on Node 24. DeepSeek Harness is a developer preview; other versions may work but have not been tested. + +## Use + +Say in a chat: + +```text +Create a new folder and help me learn Rust ownership +``` + +Or name a skill: + +```text +Use the learn-feynman skill to check whether I really understand TCP congestion control +``` + +| Skill | What it does | +|-------|-------------| +| `bloom-tutor` | The full tutoring loop: syllabus → one lesson at a time → your `???` marks and feedback → next lesson → review → summary | +| `learn-deep` | Explains a new concept through all five lenses below in one pass | +| `learn-crossover` | Learn something new through what you already know | +| `learn-occam` | Decide whether something is worth learning, and how deep | +| `learn-graph` | Map a field and plan a learning path | +| `learn-prototype` | Learn by building the roughest working version, then improving it | +| `learn-feynman` | Check your understanding by explaining it back | + +The tutor keeps everything as Markdown in your workspace: a folder per topic with `syllabus.md`, `01.md`, `02.md` … and a `learning-log.jsonl` at the workspace root. + +## Which copy loads + +Skills you installed yourself win over this plugin when they have the same name. DeepSeek Harness looks in `/.dsh/skills`, `/.agents/skills`, `~/.dsh/skills` and `~/.agents/skills` before it looks here. If you copied `bloom-tutor` into one of those folders earlier, that copy is the one that loads. + +## Uninstall + +```bash +dsh plugin --profile web remove bloomtutor-dsh +``` + +## What it changes in DeepSeek Harness + +- [`cordis.patch.yml`](cordis.patch.yml) adds one `@deepseek-ai/dsh-skill-filesystem` provider, named `bloomtutor-plugin`, over the repository's top-level [`skills/`](../../skills/) folder. It keeps your own project and personal skill folders in view. +- Its `bundledSkillDir` value is a `!!js` expression that DeepSeek Harness runs in the host process. It only uses Node's built-in `path` and `module` helpers to find this installed package. +- The plugin has no tools, dependencies, install scripts, network requests or telemetry. +- The skills read and write Markdown files in your workspace. + +## 中文 + +在 DeepSeek Harness 里用 BloomTutor:一位一对一的 AI 导师,先出学习大纲,每次只讲一篇,下一篇按你的批注和反馈来调整。这是社区插件,不是 DeepSeek 官方出品。 + +安装: + +```bash +dsh plugin --profile web add github:Li-Evan/BloomTutor +``` + +`dsh` 不在 PATH 里时,用 `npx @deepseek-ai/dsh plugin …`。每个要用的 profile 各装一次;再运行一次就会更新到最新版。已在 DeepSeek Harness `0.2.2-rc.1` 和 `0.2.2-rc.3`、Node 24 上测过。 + +装好后在对话里说「开个文件夹,帮我学 Rust 的所有权」,或者点名某个 Skill,比如「用 learn-feynman 检验一下我是不是真懂了 TCP 拥塞控制」。读课时在没看懂的地方标 `???`,读完在文末写反馈,然后说「我读完了」。 + +你自己装过的同名 Skill(`<项目>/.dsh/skills`、`<项目>/.agents/skills`、`~/.dsh/skills`、`~/.agents/skills`)优先于插件里的版本。 + +卸载:`dsh plugin --profile web remove bloomtutor-dsh`。 + +## For maintainers + +The package is the repository root. The root [`package.json`](../../package.json) declares `"dsh": { "bundle": { "patch": "./integrations/deepseek-harness/cordis.patch.yml" } }`, and its `files` list ships the top-level `skills/` plus this folder's patch, locale, docs and SVG icon. Installing from GitHub and installing a packed tarball therefore get the same files, and editing a skill in `skills/` changes the plugin directly. + +The root `package.json` deliberately has no `"type"` field, scripts or dependencies: it applies to the whole repository, and a `"type": "module"` there would change how Node treats every `.js` file outside `frontend/` and `site/`. | File | Role | |------|------| -| `package.json` | Package identity, the bundle declaration, display icon | +| `../../package.json` | Package identity, the bundle declaration, display icon, shipped files | | `cordis.patch.yml` | The one provider row DSH adds to a profile | -| `locale/*.json`, `docs/DETAIL*.md`, `icon.svg` | Title, description and detail page in DSH's plugin manager | -| `PACKAGE_README.md` | Published as the package README | -| `scripts/pack.mjs` | Stages the files and skills, runs `npm pack` | +| `locale/*.json`, `docs/DETAIL*.md`, `icon.svg` | Title, description, detail page and icon in DSH's plugin manager | +| `icon-180.png` | Tile image for plugin markets that only take raster icons (not shipped) | +| `scripts/pack.mjs` | Runs `npm pack` at the repository root | | `scripts/acceptance.mjs` | Installs a real DSH and checks install, load, precedence and uninstall | | `test/` | Package contract tests and the probe plugin the acceptance script mounts | -## Check it - Contract tests (no network, run in CI): ```bash @@ -30,24 +103,9 @@ Real host (downloads DSH from npm, never calls a model, needs a Node version DSH ```bash node integrations/deepseek-harness/scripts/acceptance.mjs +node integrations/deepseek-harness/scripts/acceptance.mjs --source github:Li-Evan/BloomTutor # the install-from-GitHub path markets offer ``` It works in a temporary directory with its own `DSH_HOME` and `DSH_AGENTS_HOME`, and prints a JSON receipt. If registry.npmjs.org is slow from your network, set `npm_config_registry=https://registry.npmmirror.com/`. -## Try it before it is on npm - -```bash -node integrations/deepseek-harness/scripts/pack.mjs -dsh plugin --profile web add "$PWD/integrations/deepseek-harness/bloomtutor-dsh-0.1.0.tgz" -``` - -`dsh plugin add` needs an absolute path to the tarball. - -## Release - -1. Bump `version` in `package.json` and the version in `PACKAGE_README.md`'s install commands. -2. Run the contract tests and the acceptance script. Update the tested DSH version in `PACKAGE_README.md` and `TESTED_DSH_VERSION` in `scripts/acceptance.mjs` if you tested a newer host. -3. `node integrations/deepseek-harness/scripts/pack.mjs`, then `npm publish integrations/deepseek-harness/bloomtutor-dsh-.tgz`. -4. Tag the commit `bloomtutor-dsh-v`. - -A published version never changes; ship fixes as a new version. +To release a version: bump `version` in the root `package.json`, run both checks (update `TESTED_DSH_VERSION` in `scripts/acceptance.mjs` and the tested versions above if you tested a newer host), then publish to npm from the repository root if the package is on npm. diff --git a/integrations/deepseek-harness/icon-180.png b/integrations/deepseek-harness/icon-180.png new file mode 100644 index 0000000000000000000000000000000000000000..e27a92614a55adc2e29b9ea13aa39c9b4b1091be GIT binary patch literal 5443 zcma)A_ct6~uwPcNN|22bokWdZqW2y(s|!(M^{BCk-jZk`Se;cOSZj%1VkObrreK97 zqOB+^(fjj#|G<0ao;&ly+%tD(?wq;vnO9~edbCumQ~&^g)<9nya?P9n+mz(jRAro8 z>Y9$*B(}K|091YHiXj!T zAXx$42~z4y(rZ!(+N+{H>FCQQzim5FwB^+~|ACXg_w zOL5=x>yJsFs#kG;cNV!fNX1jB@($X$eja(5<$l_8G>2dOxE*$JQ(dSk8}jh~B(=U9 zYr2(%Y@-~yDiW(V%Q){LJ02``&15U3hnImINXh(o{arhj-%~(#0A356)vhQx=z+WqE8cK zFmZsV+ZTUwI0zZAq-#!2k0p|&NWPE)#x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deepseek-harness/locale/en.json b/integrations/deepseek-harness/locale/en.json index 1dd3506..4f7d423 100644 --- a/integrations/deepseek-harness/locale/en.json +++ b/integrations/deepseek-harness/locale/en.json @@ -2,6 +2,6 @@ "meta": { "title": "BloomTutor", "description": "A personal AI tutor based on Bloom's 2-sigma research: it writes a syllabus, teaches one adaptive lesson at a time, and shapes the next lesson from your notes and feedback.", - "detail": "docs/DETAIL.md" + "detail": "integrations/deepseek-harness/docs/DETAIL.md" } } diff --git a/integrations/deepseek-harness/locale/zh.json b/integrations/deepseek-harness/locale/zh.json index 330012e..fe886d2 100644 --- a/integrations/deepseek-harness/locale/zh.json +++ b/integrations/deepseek-harness/locale/zh.json @@ -2,6 +2,6 @@ "meta": { "title": "BloomTutor", "description": "基于 Bloom 2 Sigma 研究的 AI 私人导师:先给你出学习大纲,每次只讲一篇,下一篇按你的批注和反馈来调整。", - "detail": "docs/DETAIL.zh.md" + "detail": "integrations/deepseek-harness/docs/DETAIL.zh.md" } } diff --git a/integrations/deepseek-harness/scripts/acceptance.mjs b/integrations/deepseek-harness/scripts/acceptance.mjs index 417bdec..c5d820d 100644 --- a/integrations/deepseek-harness/scripts/acceptance.mjs +++ b/integrations/deepseek-harness/scripts/acceptance.mjs @@ -13,6 +13,7 @@ // DSH_VERSION=0.2.2-rc.3 node integrations/deepseek-harness/scripts/acceptance.mjs // node integrations/deepseek-harness/scripts/acceptance.mjs --dsh-runtime /abs/dir # reuse a dir where @deepseek-ai/dsh is installed // node integrations/deepseek-harness/scripts/acceptance.mjs --keep # keep the temporary directory +// node integrations/deepseek-harness/scripts/acceptance.mjs --source github:Li-Evan/BloomTutor # install from GitHub instead of the packed tarball // // Prints a JSON receipt on stdout; progress goes to stderr. @@ -22,14 +23,14 @@ import os from 'node:os'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; -import { integrationRoot, listSkillNames, pack } from './pack.mjs'; +import { integrationRoot, listSkillNames, manifestPath, pack } from './pack.mjs'; export const TESTED_DSH_VERSION = '0.2.2-rc.1'; const DSH_VERSION = process.env.DSH_VERSION || TESTED_DSH_VERSION; const PROFILE = 'bloomtutor-dsh-acceptance'; const PROVIDER = 'bloomtutor-plugin'; const ROW_ID = 'bloomtutor-skill-filesystem'; -const manifest = JSON.parse(fs.readFileSync(path.join(integrationRoot, 'package.json'), 'utf8')); +const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); const PACKAGE_NAME = manifest.name; const SKILLS = listSkillNames(); @@ -39,6 +40,10 @@ const argValue = (flag) => { }; const keep = process.argv.includes('--keep'); const reuseRuntime = argValue('--dsh-runtime'); +// What `dsh plugin add` receives: the freshly packed tarball by default, or a +// spec such as github:Li-Evan/BloomTutor to check the install-from-source path +// that plugin markets offer. +const sourceSpec = argValue('--source'); const steps = []; const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'bloomtutor-dsh-acceptance-')); @@ -166,14 +171,14 @@ const resourceDir = (definition) => { return path.dirname(definition.path); }; -// 3. Install the tarball with the same command users run. -requireOk('plugin-add', dsh(['plugin', '--profile', PROFILE, 'add', tarball]), 'dsh plugin add'); +// 3. Install with the same command users run. +requireOk('plugin-add', dsh(['plugin', '--profile', PROFILE, 'add', sourceSpec || tarball]), 'dsh plugin add'); const profileDir = path.join(dshHome, 'profiles', PROFILE); const profileManifest = JSON.parse(fs.readFileSync(path.join(profileDir, 'package.json'), 'utf8')); if (!profileManifest.dependencies?.[PACKAGE_NAME]) { fail('plugin-add', 'profile does not depend on the package', { dependencies: profileManifest.dependencies }); } -pass('plugin-add', { profile: PROFILE, dependency: profileManifest.dependencies[PACKAGE_NAME] }); +pass('plugin-add', { profile: PROFILE, source: sourceSpec || 'packed tarball', dependency: profileManifest.dependencies[PACKAGE_NAME] }); // 4. The composed profile carries our provider row with the expected config. const dump = dsh(['--profile', PROFILE, '--dump-config']); diff --git a/integrations/deepseek-harness/scripts/pack.mjs b/integrations/deepseek-harness/scripts/pack.mjs index 3eb19d1..3aa366e 100644 --- a/integrations/deepseek-harness/scripts/pack.mjs +++ b/integrations/deepseek-harness/scripts/pack.mjs @@ -1,12 +1,13 @@ #!/usr/bin/env node // Build the bloomtutor-dsh npm tarball. // -// The skills live once, in the repository's top-level skills/ directory. This -// script stages the adapter files plus a copy of those skills in a temporary -// directory and runs `npm pack` there, so the repository never holds a second -// copy that could drift. +// The package is the repository root: its package.json declares the DSH +// bundle, and its `files` list ships the top-level skills/ plus this folder's +// patch, locale, docs and icon. So `npm pack` at the root is the whole build, +// and installing straight from GitHub (`github:Li-Evan/BloomTutor`) gets the +// same files. // -// node integrations/deepseek-harness/scripts/pack.mjs # writes ./bloomtutor-dsh-.tgz next to package.json +// node integrations/deepseek-harness/scripts/pack.mjs # writes bloomtutor-dsh-.tgz in this folder // node integrations/deepseek-harness/scripts/pack.mjs --out /abs/path.tgz --json import { spawnSync } from 'node:child_process'; @@ -18,10 +19,9 @@ import { fileURLToPath } from 'node:url'; export const integrationRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); export const repoRoot = path.resolve(integrationRoot, '..', '..'); export const skillsRoot = path.join(repoRoot, 'skills'); +export const manifestPath = path.join(repoRoot, 'package.json'); -const manifest = JSON.parse(fs.readFileSync(path.join(integrationRoot, 'package.json'), 'utf8')); - -// Every directory under skills/ that holds a SKILL.md ships in the package. +// Every directory under skills/ that holds a SKILL.md is a skill the package ships. export function listSkillNames() { return fs.readdirSync(skillsRoot, { withFileTypes: true }) .filter((entry) => entry.isDirectory() && !entry.name.startsWith('.')) @@ -30,21 +30,6 @@ export function listSkillNames() { .sort(); } -const skipHidden = (source) => !path.basename(source).startsWith('.'); - -function stage(destination) { - for (const file of ['package.json', 'cordis.patch.yml', 'icon.svg']) { - fs.copyFileSync(path.join(integrationRoot, file), path.join(destination, file)); - } - fs.copyFileSync(path.join(integrationRoot, 'PACKAGE_README.md'), path.join(destination, 'README.md')); - fs.copyFileSync(path.join(repoRoot, 'LICENSE'), path.join(destination, 'LICENSE')); - fs.cpSync(path.join(integrationRoot, 'locale'), path.join(destination, 'locale'), { recursive: true, filter: skipHidden }); - fs.cpSync(path.join(integrationRoot, 'docs'), path.join(destination, 'docs'), { recursive: true, filter: skipHidden }); - for (const name of listSkillNames()) { - fs.cpSync(path.join(skillsRoot, name), path.join(destination, 'skills', name), { recursive: true, filter: skipHidden }); - } -} - function parsePackJson(stdout) { const start = stdout.indexOf('['); if (start === -1) throw new Error(`npm pack printed no JSON:\n${stdout}`); @@ -56,11 +41,8 @@ function parsePackJson(stdout) { export function pack({ out } = {}) { const work = fs.mkdtempSync(path.join(os.tmpdir(), 'bloomtutor-dsh-pack-')); try { - const staged = path.join(work, 'package'); - fs.mkdirSync(staged); - stage(staged); const result = spawnSync('npm', ['pack', '--json', '--ignore-scripts', '--pack-destination', work], { - cwd: staged, + cwd: repoRoot, encoding: 'utf8', shell: process.platform === 'win32', }); @@ -86,9 +68,6 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me const outIndex = process.argv.indexOf('--out'); const out = outIndex === -1 ? undefined : process.argv[outIndex + 1]; const packed = pack({ out }); - if (packed.name !== manifest.name || packed.version !== manifest.version) { - throw new Error(`packed ${packed.name}@${packed.version}, expected ${manifest.name}@${manifest.version}`); - } if (process.argv.includes('--json')) process.stdout.write(`${JSON.stringify(packed, null, 2)}\n`); else process.stdout.write(`${packed.destination}\n`); } diff --git a/integrations/deepseek-harness/test/package.test.mjs b/integrations/deepseek-harness/test/package.test.mjs index 13feca4..0b94127 100644 --- a/integrations/deepseek-harness/test/package.test.mjs +++ b/integrations/deepseek-harness/test/package.test.mjs @@ -1,6 +1,9 @@ // Contract tests for the bloomtutor-dsh package. No network, no DSH install: // node --test integrations/deepseek-harness/test/*.test.mjs // scripts/acceptance.mjs covers the real host. +// +// The package is the repository root (package.json there), so installing from +// GitHub source and installing the npm tarball ship the same files. import assert from 'node:assert/strict'; import fs from 'node:fs'; @@ -8,11 +11,11 @@ import os from 'node:os'; import path from 'node:path'; import test from 'node:test'; -import { integrationRoot, listSkillNames, pack, skillsRoot } from '../scripts/pack.mjs'; +import { integrationRoot, listSkillNames, manifestPath, pack, repoRoot, skillsRoot } from '../scripts/pack.mjs'; -const read = (file) => fs.readFileSync(path.join(integrationRoot, file), 'utf8'); -const manifest = JSON.parse(read('package.json')); -const patch = read('cordis.patch.yml'); +const HERE = 'integrations/deepseek-harness'; +const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); +const patch = fs.readFileSync(path.join(integrationRoot, 'cordis.patch.yml'), 'utf8'); // DSH's skill catalog truncates descriptions past this many UTF-16 units (catalogDescriptionMaxLength). const CATALOG_DESCRIPTION_MAX = 500; @@ -29,20 +32,27 @@ function frontmatter(text) { return fields; } -test('manifest declares a DSH bundle and nothing that runs on install', () => { +test('root manifest declares a DSH bundle and nothing that runs on install', () => { assert.equal(manifest.name, 'bloomtutor-dsh'); assert.match(manifest.version, /^\d+\.\d+\.\d+$/); - assert.equal(manifest.type, 'module'); assert.equal(manifest.license, 'MIT'); - assert.equal(manifest.private, undefined, 'a private package cannot be published'); - assert.deepEqual(manifest.dsh, { bundle: { patch: './cordis.patch.yml' } }); + assert.equal(manifest.private, undefined, 'a private package cannot be published or listed'); + // A root "type" would turn every .js file in the repo without a nearer package.json into ESM. + assert.equal(manifest.type, undefined); + assert.deepEqual(manifest.dsh, { bundle: { patch: `./${HERE}/cordis.patch.yml` } }); assert.ok(manifest.keywords.includes('dsh-plugin')); + // Published under the GitHub handle, not a legal name. + assert.equal(manifest.author?.name, 'Evan'); // The patch resolves /package.json; locale lookup needs the locale export. assert.equal(manifest.exports['./package.json'], './package.json'); - assert.equal(manifest.exports['./locale/*.json'], './locale/*.json'); - for (const field of ['scripts', 'dependencies', 'peerDependencies', 'optionalDependencies', 'bin', 'main']) { + assert.equal(manifest.exports['./locale/*.json'], `./${HERE}/locale/*.json`); + for (const field of ['scripts', 'dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies', 'bin', 'main', 'workspaces']) { assert.equal(manifest[field], undefined, `${field} must stay empty`); } + for (const entry of manifest.files) { + const literal = entry.replace(/\/\*\.json$/, ''); + assert.ok(fs.existsSync(path.join(repoRoot, literal)), `files entry ${entry} exists`); + } }); test('patch mounts one filesystem provider over the packaged skills', () => { @@ -56,6 +66,7 @@ test('patch mounts one filesystem provider over the packaged skills', () => { const expression = patch.match(/^\s+bundledSkillDir: !!js (.+)$/m)?.[1]; assert.ok(expression, 'bundledSkillDir is a host-evaluated expression'); assert.ok(expression.includes(`resolve('${manifest.name}/package.json')`), 'resolves this package from the profile baseUrl'); + // /skills is the repository's top-level skills/. assert.ok(expression.endsWith(", 'skills')")); // The expression runs in the host process: only the path and module built-ins are allowed. const builtins = [...expression.matchAll(/getBuiltinModule\('([^']+)'\)/g)].map((m) => m[1]); @@ -77,50 +88,55 @@ test('every skill loads under DSH naming and catalog rules', () => { }); test('locale metadata and detail documents are complete', () => { - for (const [language, detail] of [['en', 'docs/DETAIL.md'], ['zh', 'docs/DETAIL.zh.md']]) { - const { meta } = JSON.parse(read(`locale/${language}.json`)); + for (const [language, detail] of [['en', `${HERE}/docs/DETAIL.md`], ['zh', `${HERE}/docs/DETAIL.zh.md`]]) { + const { meta } = JSON.parse(fs.readFileSync(path.join(integrationRoot, 'locale', `${language}.json`), 'utf8')); assert.equal(meta.title, 'BloomTutor'); assert.ok(meta.description?.trim(), `${language}: description`); assert.match(meta.description, /[.。]$/, `${language}: description ends with punctuation`); + // meta.detail is relative to the package root, which is the repository root. assert.equal(meta.detail, detail); - assert.ok(fs.existsSync(path.join(integrationRoot, detail)), `${detail} exists`); + assert.ok(fs.existsSync(path.join(repoRoot, detail)), `${detail} exists`); } }); -test('icon is a small self-contained SVG', () => { - const icon = read('icon.svg'); - assert.equal(manifest.icon, './icon.svg'); - assert.ok(Buffer.byteLength(icon) < 256 * 1024); - assert.doesNotMatch(icon, / { + assert.equal(manifest.icon, `./${HERE}/icon.svg`); + const svg = fs.readFileSync(path.join(integrationRoot, 'icon.svg'), 'utf8'); + assert.ok(Buffer.byteLength(svg) < 256 * 1024); + assert.doesNotMatch(svg, / { +test('the tarball holds the plugin files and exactly the repository skills', () => { const out = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'bloomtutor-dsh-test-')), 'package.tgz'); const packed = pack({ out }); assert.equal(packed.name, manifest.name); assert.equal(packed.version, manifest.version); const skillFiles = []; - for (const name of listSkillNames()) { - const walk = (dir) => { - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { - if (entry.name.startsWith('.')) continue; - const full = path.join(dir, entry.name); - if (entry.isDirectory()) walk(full); - else skillFiles.push(path.relative(path.join(skillsRoot, '..'), full).split(path.sep).join('/')); - } - }; - walk(path.join(skillsRoot, name)); - } + const walk = (dir) => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + if (entry.name.startsWith('.')) continue; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) walk(full); + else skillFiles.push(path.relative(repoRoot, full).split(path.sep).join('/')); + } + }; + for (const name of listSkillNames()) walk(path.join(skillsRoot, name)); const expected = [ + // npm always adds LICENSE and every README* at the package root. 'LICENSE', 'README.md', - 'cordis.patch.yml', - 'docs/DETAIL.md', - 'docs/DETAIL.zh.md', - 'icon.svg', - 'locale/en.json', - 'locale/zh.json', + 'README.zh.md', 'package.json', + `${HERE}/cordis.patch.yml`, + `${HERE}/docs/DETAIL.md`, + `${HERE}/docs/DETAIL.zh.md`, + `${HERE}/icon.svg`, + `${HERE}/locale/en.json`, + `${HERE}/locale/zh.json`, ...skillFiles, ].sort(); assert.deepEqual(packed.files, expected); diff --git a/integrations/deepseek-harness/package.json b/package.json similarity index 63% rename from integrations/deepseek-harness/package.json rename to package.json index 832afce..c2865ae 100644 --- a/integrations/deepseek-harness/package.json +++ b/package.json @@ -3,20 +3,17 @@ "version": "0.1.0", "description": "BloomTutor's AI tutor skills for DeepSeek Harness: a syllabus, one adaptive lesson at a time, and six learning-method skills.", "license": "MIT", - "type": "module", - "icon": "./icon.svg", + "icon": "./integrations/deepseek-harness/icon.svg", "exports": { "./package.json": "./package.json", - "./locale/*.json": "./locale/*.json" + "./locale/*.json": "./integrations/deepseek-harness/locale/*.json" }, "files": [ - "locale/*.json", - "docs", - "cordis.patch.yml", - "icon.svg", "skills", - "README.md", - "LICENSE" + "integrations/deepseek-harness/cordis.patch.yml", + "integrations/deepseek-harness/icon.svg", + "integrations/deepseek-harness/locale/*.json", + "integrations/deepseek-harness/docs" ], "keywords": [ "dsh-plugin", @@ -28,14 +25,13 @@ "education" ], "author": { - "name": "Li Zhengping", + "name": "Evan", "url": "https://github.com/Li-Evan" }, "homepage": "https://github.com/Li-Evan/BloomTutor/tree/main/integrations/deepseek-harness", "repository": { "type": "git", - "url": "git+https://github.com/Li-Evan/BloomTutor.git", - "directory": "integrations/deepseek-harness" + "url": "git+https://github.com/Li-Evan/BloomTutor.git" }, "bugs": "https://github.com/Li-Evan/BloomTutor/issues", "publishConfig": { @@ -43,7 +39,7 @@ }, "dsh": { "bundle": { - "patch": "./cordis.patch.yml" + "patch": "./integrations/deepseek-harness/cordis.patch.yml" } } }