From 1e715083b865766ade1cc5515142a27dce132394 Mon Sep 17 00:00:00 2001 From: DoodleBear Date: Wed, 30 Sep 2026 14:09:32 +0900 Subject: [PATCH] chore: the published packages get a README and a way back to the source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All three packages shipped with no README and no `repository`, so their npm pages rendered with no body and no link to the code — which reads as "package you should not trust", and leaves no URL to file an issue against. A package page is assembled entirely from the manifest, so the fields that describe it have to be in it. Each README is written for its own reader rather than copied from the root: the core one leads with the two renderers and when each is worth its cost, the React one leads with `state` and the peer dependency, the CLI one leads with the commands and the registry-ordering caveat. The root README explains *why* copy-and-own; a consumer landing on npm has already decided and wants the API. `repository.directory` is set per package so the link lands on that subtree rather than the repo root, and `check-registry.mjs` now fails the build when a package has no README, no repository pointing at THIS repo, no homepage or no bugs URL — a repository pointing elsewhere means the published source and the installed source have diverged. Verified by deleting a README and a repository and watching it fail, since a check nothing exercises is a comment. LICENSE needed no change: `pnpm pack` already pulls the root LICENSE into each tarball, which `npm pack` does not — worth knowing before someone "fixes" it. --- CHANGELOG.md | 1 + CHANGELOG.zh.md | 1 + packages/cli/README.md | 51 ++++++++++++++++++++++++++ packages/cli/package.json | 19 ++++++++++ packages/core/README.md | 72 +++++++++++++++++++++++++++++++++++++ packages/core/package.json | 22 ++++++++++++ packages/react/README.md | 57 +++++++++++++++++++++++++++++ packages/react/package.json | 20 +++++++++++ scripts/check-registry.mjs | 38 ++++++++++++++++++++ 9 files changed, 281 insertions(+) create mode 100644 packages/cli/README.md create mode 100644 packages/core/README.md create mode 100644 packages/react/README.md diff --git a/CHANGELOG.md b/CHANGELOG.md index d6c80ad..83b6096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ All notable changes to BotUI are recorded here. The format follows gitignored, so `typecheck` and `verify` now run this first: from a clean clone they used to fail on imports that were not on disk yet. - **Publishing to npm needed a token, and this account's 2FA is a passkey**, which the CLI cannot answer — WebAuthn needs a browser. `scripts/npm-token.sh` collects a granular access token, validates it against the registry, and stores it in `npm_release.token` (gitignored, mode 600); it re-prompts on its own once the token expires or is revoked. `release.mjs` reads that file and hands the token to npm through the child process's environment rather than an argv flag, because argv is readable through `ps` and command lines land in CI logs. A project `.npmrc` would have applied the token to every npm command in the repo, `npm install` included. +- **The three published packages had no README and no repository link**, so their npm pages rendered with no body and no way back to the source — indistinguishable from a package nobody should trust, with no URL to file an issue against. Each package now has a README written for its own audience and declares `repository` (with the `directory` that lands the link on its subtree), `homepage`, `bugs` and `keywords`. `check-registry.mjs` enforces all four, verified by deleting a README and a `repository` and watching the build fail. ### Fixed diff --git a/CHANGELOG.zh.md b/CHANGELOG.zh.md index 44fefa8..b1571f1 100644 --- a/CHANGELOG.zh.md +++ b/CHANGELOG.zh.md @@ -40,6 +40,7 @@ BotUI 的所有值得注意的变更都记录在此。格式遵循 (已 gitignore,权限 600);token 过期或被撤销后它会自行重新询问。`release.mjs` 读取该文件, 通过子进程的环境变量把 token 交给 npm,而不是作为 argv 参数 —— argv 能被 `ps` 读到,命令行也会进 CI 日志。项目级 `.npmrc` 同样可行,但那会让 token 对仓库里每一条 npm 命令生效,连 `npm install` 一起。 +- **三个已发布的包既没有 README 也没有仓库链接**,npm 页面因此既没有正文、也没有回到源码的入口 —— 这和"不值得信任的包"看起来完全一样,而且连 issue 都不知道该往哪提。现在每个包都有自己的 README(按各自的读者写的),并声明 `repository`(含 `directory`,让链接直接落到该包子目录)、`homepage`、`bugs` 和 `keywords`。这四项由 `check-registry.mjs` 强制检查 —— 通过删掉 README 和 `repository`、确认构建失败来验证过。 ### 修复 diff --git a/packages/cli/README.md b/packages/cli/README.md new file mode 100644 index 0000000..8dbf444 --- /dev/null +++ b/packages/cli/README.md @@ -0,0 +1,51 @@ +# @botharness/botui + +Install BotUI components into your project — copy-and-own, like [shadcn](https://ui.shadcn.com). + +```bash +npx @botharness/botui add dot-matrix +``` + +The source lands in your repo. **No runtime dependency. Nothing to keep current. The code is +yours** — read it, change it, delete the name. + +## Why + +A loading indicator is not a place to take a runtime dependency. It is thirty lines of animation +you will want to tune to your own brand, and the moment it is a dependency, tuning it means a +version bump or a patch-package. + +So this installer copies **the real source files**, not a bundle. What lands in +`components/botui/` is the same text as the [BotUI repository](https://github.com/BotHarness/BotUI), +and a test in CI asserts it byte for byte. When BotUI ships something better, you take the diff +when you want to. + +## Commands + +```bash +npx @botharness/botui list # what the registry offers +npx @botharness/botui info # what one component ships +npx @botharness/botui add # copy it into your project +npx @botharness/botui add --dry-run # show the plan, write nothing +``` + +## Also works with shadcn + +The registry is served in shadcn's format, so this installs the same component: + +```bash +npx shadcn@latest add https://ui.botharness.ai/r/dot-matrix.json +``` + +Files are fetched from the registry at `ui.botharness.ai`, not from npm — so a published version +whose registry item is not deployed yet installs nothing. That ordering is deliberate; see +[Releasing](https://github.com/BotHarness/BotUI#releasing). + +## Documentation + +**[ui.botharness.ai](https://ui.botharness.ai)** — a live playground for every component, in +[English](https://ui.botharness.ai/) and [中文](https://ui.botharness.ai/zh/). + +## License + +MIT © [BotHarness](https://github.com/BotHarness/BotUI) diff --git a/packages/cli/package.json b/packages/cli/package.json index 87bb63a..00c004a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -2,7 +2,26 @@ "name": "@botharness/botui", "version": "0.1.0", "description": "Install BotUI components into your project — copy-and-own, like shadcn", + "keywords": [ + "agent-ui", + "cli", + "copy-and-own", + "dot-matrix", + "npx", + "registry", + "shadcn" + ], + "homepage": "https://ui.botharness.ai", + "bugs": { + "url": "https://github.com/BotHarness/BotUI/issues", + "source": "https://github.com/BotHarness/BotUI/issues" + }, "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/BotHarness/BotUI.git", + "directory": "packages/cli" + }, "bin": { "botui": "./dist/index.js" }, diff --git a/packages/core/README.md b/packages/core/README.md new file mode 100644 index 0000000..064ffda --- /dev/null +++ b/packages/core/README.md @@ -0,0 +1,72 @@ +# @botharness/botui-core + +The framework-agnostic engine behind BotUI components — no DOM library, no framework, one dependency: none. + +This is the layer that decides **which cells exist**, **what order the light moves in**, **how bright each cell is over the cycle**, and **how one dot is drawn**. Those are independent questions, so they are independent tables you can extend without touching each other. + +## Install + +You probably don't need this package. The recommended path is to copy the source into your repo: + +```bash +npx @botharness/botui add dot-matrix +``` + +Install it from npm when you want the engine as a dependency, or when you are building tooling on top of it: + +```bash +npm install @botharness/botui-core +``` + +## Use + +```ts +import { createDotMatrix } from "@botharness/botui-core"; +import "@botharness/botui-core/style.css"; // required for renderer: "css" + +const field = createDotMatrix(document.querySelector("#loading")!, { + size: 32, + cols: 5, + rows: 5, + silhouette: "circle", + dot: "circle", + preset: "spiral", +}); + +field.start(); +// …later +field.destroy(); +``` + +### The two renderers + +| `renderer` | Cost | Use when | +| ----------------- | --------------------------------------------- | ----------------------------------------------- | +| `"svg"` (default) | one attribute write per visible dot per frame | you animate size, shape, or dot count | +| `"css"` | **zero JS per frame** — one `@keyframes` rule | the geometry is fixed and only brightness moves | + +Both are driven by the same `field(options, t)`, a pure function of the options and a phase. That is the whole reason the CSS path is trustworthy: it is not a second implementation, so it cannot drift from the SVG one. + +`cssRenderable(options)` tells you up front whether a motion can be expressed as keyframes. Some cannot — `columns` staggers each column's entry, which a per-dot `animation-delay` does not model — and the function returns `false` rather than silently rendering something else. + +### The five layers + +| Layer | Question it answers | +| ------------- | ------------------------------------------------------------------------- | +| **Lattice** | which cells exist (`square`, `circle`, `diamond`, `hex`, `ring`, `cross`) | +| **Traversal** | what order the light moves in (`spiral`, `columnSnake`, `radial`, `ring`) | +| **Envelope** | how bright a cell is over the cycle (`comet`, `wave`, `plateau`, `chase`) | +| **Glyph** | how one dot is drawn — a polygon plus two corner radii | +| **Renderer** | SVG or CSS | + +The full option list, and the reasoning behind the size algebra, are in +[`src/types.ts`](https://github.com/BotHarness/BotUI/blob/main/packages/core/src/types.ts). + +## Documentation + +**[ui.botharness.ai](https://ui.botharness.ai)** — a live playground for every control, in +[English](https://ui.botharness.ai/) and [中文](https://ui.botharness.ai/zh/). + +## License + +MIT © [BotHarness](https://github.com/BotHarness/BotUI) diff --git a/packages/core/package.json b/packages/core/package.json index eacacd9..34f64b4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -2,7 +2,29 @@ "name": "@botharness/botui-core", "version": "0.1.0", "description": "The framework-agnostic engine behind BotUI components", + "keywords": [ + "agent-ui", + "animation", + "css", + "dot-matrix", + "indicator", + "keyframes", + "loading", + "status", + "streaming", + "svg" + ], + "homepage": "https://ui.botharness.ai", + "bugs": { + "url": "https://github.com/BotHarness/BotUI/issues", + "source": "https://github.com/BotHarness/BotUI/issues" + }, "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/BotHarness/BotUI.git", + "directory": "packages/core" + }, "files": [ "dist" ], diff --git a/packages/react/README.md b/packages/react/README.md new file mode 100644 index 0000000..8cb7458 --- /dev/null +++ b/packages/react/README.md @@ -0,0 +1,57 @@ +# @botharness/botui-react + +React bindings for [BotUI](https://github.com/BotHarness/BotUI) components — ``. + +The engine ([`@botharness/botui-core`](https://www.npmjs.com/package/@botharness/botui-core)) +does the work; this package is a ref and an effect. That is deliberate: a component that owns +no geometry cannot drift from the engine that does. + +## Install + +You probably don't need this package. The recommended path is to copy the source into your repo: + +```bash +npx @botharness/botui add dot-matrix +``` + +Install it from npm when you want a component you can import and upgrade: + +```bash +npm install @botharness/botui-react @botharness/botui-core +``` + +`react` is a peer dependency (`>=18`); the stylesheet ships with the core package: + +```ts +import "@botharness/botui-core/style.css"; // once, in your app entry +``` + +## Use + +```tsx +import { DotMatrix } from "@botharness/botui-react"; + +// `state` is the vocabulary an agent UI already speaks + + +``` + +`state` is a **preset** — motion plus the agent state it is meant to express. If you want the +underlying geometry instead, pass the options directly and `preset` becomes optional: + +```tsx + +``` + +`renderer="css"` costs zero JS per frame but only works for motions the engine can express as +keyframes. The component checks for you: asking for an unsupported motion falls back to SVG +rather than rendering something that does not match the preview. + +## Documentation + +**[ui.botharness.ai](https://ui.botharness.ai)** — a live playground for every prop, in +[English](https://ui.botharness.ai/) and [中文](https://ui.botharness.ai/zh/). + +## License + +MIT © [BotHarness](https://github.com/BotHarness/BotUI) diff --git a/packages/react/package.json b/packages/react/package.json index 64c4dc0..ff73b7f 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -2,7 +2,27 @@ "name": "@botharness/botui-react", "version": "0.1.0", "description": "React bindings for BotUI components", + "keywords": [ + "agent-ui", + "animation", + "dot-matrix", + "indicator", + "loading", + "react", + "status", + "streaming" + ], + "homepage": "https://ui.botharness.ai", + "bugs": { + "url": "https://github.com/BotHarness/BotUI/issues", + "source": "https://github.com/BotHarness/BotUI/issues" + }, "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/BotHarness/BotUI.git", + "directory": "packages/react" + }, "files": [ "dist" ], diff --git a/scripts/check-registry.mjs b/scripts/check-registry.mjs index a74f8f7..783ba0b 100644 --- a/scripts/check-registry.mjs +++ b/scripts/check-registry.mjs @@ -86,6 +86,44 @@ if (!existsSync(registryPath)) { const registry = JSON.parse(await readFile(registryPath, "utf8")); +/* ---- the published packages ---- + * + * These three are published to npm, and a package page is assembled from the + * manifest: `repository` is what links the package back to its source, and the + * README is the entire body of that page. A missing `repository` renders as a + * package with no visible source link, which is indistinguishable from a package + * nobody should trust — and nobody can file an issue at a repository the manifest + * does not name. + * + * `homepage` is checked for the same reason: the docs ARE the reference for an + * options-heavy component, and npmjs.com gives the field its own prominent slot. + */ +const REPO_URL = "https://github.com/BotHarness/BotUI"; +for (const dir of ["core", "react", "cli"]) { + const manifestPath = join(root, "packages", dir, "package.json"); + if (!existsSync(manifestPath)) continue; + const m = JSON.parse(await readFile(manifestPath, "utf8")); + const where = m.name ?? `packages/${dir}`; + + if (!m.repository?.url) { + fail(`${where}: no repository.url — the npm page will have no source link`); + } else if (!m.repository.url.includes("github.com/BotHarness/BotUI")) { + // A repository pointing somewhere other than this repo means the published + // source and the installed source have diverged. + fail(`${where}: repository.url points outside ${REPO_URL} (${m.repository.url})`); + } else if (m.repository.directory !== `packages/${dir}` && dir !== "cli") { + // The `directory` is what makes the link land on this package's subtree + // instead of the repo root. Worth one line so it cannot rot unnoticed. + warn(`${where}: repository.directory is ${m.repository.directory ?? "(unset)"}`); + } + + if (!m.homepage) fail(`${where}: no homepage`); + if (!m.bugs?.url) fail(`${where}: no bugs.url`); + if (!existsSync(join(root, "packages", dir, "README.md"))) { + fail(`${where}: no README.md — the npm page would render with no content`); + } +} + /* ---- the root document ---- */ if (registry.$schema !== "https://ui.shadcn.com/schema/registry.json") { fail(`root $schema should be shadcn's registry schema, got ${registry.$schema}`);