|
| 1 | +# Package README & `package.json` Publishing Checklist (Internal) |
| 2 | + |
| 3 | +> **Audience:** Maintainers of the ObjectStack monorepo. |
| 4 | +> **Purpose:** Guarantee every package published to npm under `@objectstack/*` has consistent, high-quality documentation and publishing metadata. |
| 5 | +> **Status:** Canonical. All PRs that add a new package, or that modify any `README.md` or `package.json` under `packages/**`, must satisfy this checklist. |
| 6 | +
|
| 7 | +--- |
| 8 | + |
| 9 | +## 1. Canonical README Structure |
| 10 | + |
| 11 | +Every package `README.md` MUST follow this section order. Sections that do not apply to a package can be omitted, but the order of remaining sections must not change. |
| 12 | + |
| 13 | +```markdown |
| 14 | +# @objectstack/<package-name> |
| 15 | + |
| 16 | +> One-line pitch: what this package is and what problem it solves. |
| 17 | +
|
| 18 | +[](https://www.npmjs.com/package/@objectstack/<package-name>) |
| 19 | +[](https://opensource.org/licenses/Apache-2.0) |
| 20 | + |
| 21 | +## Overview |
| 22 | + |
| 23 | +2–4 sentences. Where this package sits in the ObjectStack architecture (Core / Adapter / Plugin / Driver / Service). Who should use it. |
| 24 | + |
| 25 | +## Installation |
| 26 | + |
| 27 | +\`\`\`bash |
| 28 | +pnpm add @objectstack/<package-name> |
| 29 | +# or |
| 30 | +npm install @objectstack/<package-name> |
| 31 | +\`\`\` |
| 32 | + |
| 33 | +## Quick Start |
| 34 | + |
| 35 | +Minimum runnable example — imports, construction, usage. Must reference only public exports. |
| 36 | + |
| 37 | +\`\`\`typescript |
| 38 | +import { ... } from '@objectstack/<package-name>'; |
| 39 | +\`\`\` |
| 40 | + |
| 41 | +## Key Exports / API |
| 42 | + |
| 43 | +Brief list of the most important public exports (classes, functions, types). Link to generated API reference in the docs site rather than duplicating full signatures. |
| 44 | + |
| 45 | +## Configuration |
| 46 | + |
| 47 | +Config options (if any) as a table. Use the same key names as the Zod schema (camelCase). |
| 48 | + |
| 49 | +## When to use |
| 50 | + |
| 51 | +- ✅ Good fit for scenario X. |
| 52 | +- ✅ Good fit for scenario Y. |
| 53 | + |
| 54 | +## When not to use |
| 55 | + |
| 56 | +- ❌ Not a good fit for Z — use `@objectstack/other-package` instead. |
| 57 | + |
| 58 | +## Related Packages |
| 59 | + |
| 60 | +- [`@objectstack/spec`](../spec) — protocol schemas. |
| 61 | +- [`@objectstack/core`](../core) — kernel and DI. |
| 62 | +- … package-specific relations. |
| 63 | + |
| 64 | +## Links |
| 65 | + |
| 66 | +- 📖 Docs: <https://objectstack.ai/docs> |
| 67 | +- 📚 API Reference: <https://objectstack.ai/docs/references> |
| 68 | +- 🧭 Protocol: <https://objectstack.ai/docs/protocol> |
| 69 | +- 🧪 Examples: [`examples/`](../../../examples) |
| 70 | +- 🤖 Skill: [`skills/objectstack-<domain>/SKILL.md`](../../../skills) _(if applicable)_ |
| 71 | + |
| 72 | +## License |
| 73 | + |
| 74 | +Apache-2.0 © ObjectStack |
| 75 | +``` |
| 76 | + |
| 77 | +### README conventions |
| 78 | + |
| 79 | +- **Title**: Always `# @objectstack/<package-name>` as the first line. No marketing titles above the scoped name. |
| 80 | +- **Pitch**: Exactly one sentence. Must describe the package, not the ecosystem. |
| 81 | +- **Badges**: npm version + Apache-2.0 license badge. Additional badges (CI, coverage) may be added but must use shields.io and be the last line of the badge block. |
| 82 | +- **Code blocks**: Always tagged with language (`typescript`, `bash`, `json`). Imports must be from the package being documented, not relative paths. |
| 83 | +- **API examples**: Must compile against the current published API. Verify by grepping `src/index.ts` for the symbols used. |
| 84 | +- **Internal terminology**: Use canonical names from `packages/spec/src/kernel/metadata-plugin.zod.ts` (singular: `view`, `flow`, `agent`, `tool`, not plural). |
| 85 | +- **Links**: Prefer absolute URLs to the docs site for user-facing references; repository-relative links are only allowed for cross-package pointers within the monorepo. |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## 2. `package.json` Publishing Checklist |
| 90 | + |
| 91 | +Every publishable package MUST have the following fields. Private packages (`"private": true`) are exempt but apps (under `apps/`) should stay private. |
| 92 | + |
| 93 | +### Required fields |
| 94 | + |
| 95 | +| Field | Requirement | Example | |
| 96 | +|:---|:---|:---| |
| 97 | +| `name` | Scoped `@objectstack/<slug>` | `"@objectstack/core"` | |
| 98 | +| `version` | Aligned with monorepo release train (currently `4.0.4`) | `"4.0.4"` | |
| 99 | +| `description` | One sentence, ≤ 140 chars, starts with product/scope | `"ObjectStack core kernel — DI, plugin lifecycle, EventBus"` | |
| 100 | +| `license` | `Apache-2.0` | `"Apache-2.0"` | |
| 101 | +| `author` | `"ObjectStack"` | `"ObjectStack"` | |
| 102 | +| `keywords` | ≥ 3 tags. First must be `objectstack`. | `["objectstack", "kernel", "di"]` | |
| 103 | +| `repository` | Object form with `directory` | see below | |
| 104 | +| `homepage` | Package landing page on docs site | `"https://objectstack.ai/docs/packages/core"` | |
| 105 | +| `bugs` | Issues URL | `"https://github.com/objectstack-ai/framework/issues"` | |
| 106 | +| `engines.node` | `">=18.0.0"` | `">=18.0.0"` | |
| 107 | +| `main` | CJS entry or `dist/index.js` | `"./dist/index.js"` | |
| 108 | +| `types` | Type declarations entry | `"./dist/index.d.ts"` | |
| 109 | +| `exports` | At minimum `"."`. Subpath exports must mirror `src/*` | see below | |
| 110 | +| `files` | Whitelist: `["dist", "README.md", ...]` — never publish `src/` | `["dist", "README.md"]` | |
| 111 | +| `publishConfig.access` | `"public"` | `"public"` | |
| 112 | + |
| 113 | +### Canonical `repository` block |
| 114 | + |
| 115 | +```json |
| 116 | +"repository": { |
| 117 | + "type": "git", |
| 118 | + "url": "https://github.com/objectstack-ai/framework.git", |
| 119 | + "directory": "packages/<path-to-package>" |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | +### Canonical `exports` block (single entry) |
| 124 | + |
| 125 | +```json |
| 126 | +"exports": { |
| 127 | + ".": { |
| 128 | + "types": "./dist/index.d.ts", |
| 129 | + "import": "./dist/index.mjs", |
| 130 | + "require": "./dist/index.js" |
| 131 | + } |
| 132 | +} |
| 133 | +``` |
| 134 | + |
| 135 | +### Canonical `files` whitelist |
| 136 | + |
| 137 | +```json |
| 138 | +"files": ["dist", "README.md", "LICENSE"] |
| 139 | +``` |
| 140 | + |
| 141 | +Add `json-schema`, `prompts`, `llms.txt`, etc. only when the package actually ships those assets. |
| 142 | + |
| 143 | +### Forbidden in published packages |
| 144 | + |
| 145 | +- `devDependencies` entries that reference deleted packages |
| 146 | +- `main` pointing at `src/` |
| 147 | +- Non-scoped names (`"objectstack-*"` is grandfathered only for the VS Code extension) |
| 148 | +- `"private": true` on a package that needs to be installable from npm |
| 149 | + |
| 150 | +--- |
| 151 | + |
| 152 | +## 3. Pre-release PR Checklist |
| 153 | + |
| 154 | +Every release PR must verify for each package: |
| 155 | + |
| 156 | +- [ ] README exists and matches §1 structure. |
| 157 | +- [ ] Code examples in README reference symbols that exist in `src/index.ts`. |
| 158 | +- [ ] `package.json` has every required field in §2. |
| 159 | +- [ ] `version` is aligned with the release train. |
| 160 | +- [ ] `exports` / `main` / `types` all point at `dist/` artifacts that the build actually produces. |
| 161 | +- [ ] `pnpm build` succeeds and produces the files listed in `files`. |
| 162 | +- [ ] `pnpm test` passes or is `--passWithNoTests` intentionally. |
| 163 | +- [ ] `lychee` link check passes for README. |
| 164 | +- [ ] `CHANGELOG.md` has an entry covering this package's changes. |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## 4. Docs-site Linkage |
| 169 | + |
| 170 | +Each package MUST have a corresponding guide page under `content/docs/guides/packages.mdx` (overview table) and a detailed reference under `content/docs/references/<domain>/<slug>.mdx` (auto-generated from Zod schemas for protocol packages; hand-written for runtime packages). |
| 171 | + |
| 172 | +When introducing a new package: |
| 173 | + |
| 174 | +1. Add a row to the overview table in `content/docs/guides/packages.mdx`. |
| 175 | +2. If the package defines Zod schemas, run `pnpm --filter @objectstack/spec gen:docs`. |
| 176 | +3. If the package is a runtime (plugin/service/driver/adapter), add a hand-written reference page under `content/docs/references/<domain>/`. |
| 177 | +4. Update `ROADMAP.md` Package Status Matrix. |
| 178 | + |
| 179 | +--- |
| 180 | + |
| 181 | +## 5. Deprecation / Removal |
| 182 | + |
| 183 | +To deprecate a package: |
| 184 | + |
| 185 | +1. Add `"deprecated": "<reason + migration hint>"` to `package.json`. |
| 186 | +2. Prefix README with a `> **Deprecated.** Use [`@objectstack/replacement`](…) instead.` callout. |
| 187 | +3. Move its row in `content/docs/guides/packages.mdx` into a "Deprecated" section. |
| 188 | +4. Keep publishing patch releases until downstream migration is complete. |
| 189 | + |
| 190 | +--- |
| 191 | + |
| 192 | +Last updated: 2026-04-17 |
0 commit comments