@@ -0,0 +1,79 @@
|
||||
# Skill: Publish @uncaged/nerve packages to npm
|
||||
|
||||
## When to use
|
||||
|
||||
When releasing a new version of any `@uncaged/nerve-*` package to npm.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- npm login with an account that has **owner** access to the `@uncaged` org
|
||||
- All tests pass: `pnpm -r run test`
|
||||
- Clean working tree (no uncommitted changes)
|
||||
|
||||
## Packages
|
||||
|
||||
| Package | Path | npm |
|
||||
|---------|------|-----|
|
||||
| `@uncaged/nerve-core` | `packages/core` | [link](https://www.npmjs.com/package/@uncaged/nerve-core) |
|
||||
| `@uncaged/nerve-daemon` | `packages/daemon` | [link](https://www.npmjs.com/package/@uncaged/nerve-daemon) |
|
||||
| `@uncaged/nerve-cli` | `packages/cli` | [link](https://www.npmjs.com/package/@uncaged/nerve-cli) |
|
||||
|
||||
## Dependency order
|
||||
|
||||
`core` → `daemon` → `cli`
|
||||
|
||||
Always publish in this order. If `core` has changes, bump and publish it first, then update dependents.
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Ensure clean state
|
||||
|
||||
```bash
|
||||
git checkout main && git pull origin main
|
||||
pnpm install
|
||||
pnpm -r run build
|
||||
pnpm -r run test
|
||||
```
|
||||
|
||||
### 2. Bump versions
|
||||
|
||||
Manually update `version` in each changed package's `package.json`.
|
||||
|
||||
Follow semver:
|
||||
- **patch** (0.1.x): bug fixes, refactors
|
||||
- **minor** (0.x.0): new features, non-breaking API additions
|
||||
- **major** (x.0.0): breaking changes
|
||||
|
||||
If bumping `core`, also update the `@uncaged/nerve-core` dependency version in `daemon` and `cli` package.json. Same for `daemon` → `cli`.
|
||||
|
||||
### 3. Build
|
||||
|
||||
```bash
|
||||
pnpm -r run build
|
||||
```
|
||||
|
||||
### 4. Publish (in order)
|
||||
|
||||
```bash
|
||||
# Only publish packages that have version bumps
|
||||
cd packages/core && npm publish --access public
|
||||
cd packages/daemon && npm publish --access public
|
||||
cd packages/cli && npm publish --access public
|
||||
```
|
||||
|
||||
### 5. Commit & tag
|
||||
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "release: @uncaged/nerve-core@X.Y.Z, @uncaged/nerve-daemon@X.Y.Z, @uncaged/nerve-cli@X.Y.Z"
|
||||
git tag -a vX.Y.Z -m "Release vX.Y.Z"
|
||||
git push origin main --tags
|
||||
```
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- **Don't publish without building first** — `tsup` output in `dist/` is what npm ships
|
||||
- **Dependency order matters** — if you publish `daemon` before `core`, npm may resolve the old `core` version
|
||||
- **`--access public`** is required for scoped packages on first publish; safe to always include
|
||||
- **Check `npm whoami`** to confirm you're logged in as the right account
|
||||
- **No changeset tool** — this project uses manual version bumps (no changesets/lerna)
|
||||
@@ -0,0 +1,101 @@
|
||||
# Skill: Setup nerve from scratch
|
||||
|
||||
## When to use
|
||||
|
||||
Setting up the nerve project for local development from a fresh clone.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- **Node.js** ≥ 18
|
||||
- **pnpm** ≥ 9 (`npm install -g pnpm`)
|
||||
- **Git** access to `git.shazhou.work`
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Clone
|
||||
|
||||
```bash
|
||||
git clone https://git.shazhou.work/uncaged/nerve.git
|
||||
cd nerve
|
||||
```
|
||||
|
||||
### 2. Install dependencies
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
This installs all workspace packages and links internal dependencies (`core` → `daemon` → `cli`).
|
||||
|
||||
### 3. Build all packages
|
||||
|
||||
```bash
|
||||
pnpm -r run build
|
||||
```
|
||||
|
||||
Build order is handled automatically by pnpm workspace — `core` builds first, then `daemon`, then `cli`.
|
||||
|
||||
### 4. Run tests
|
||||
|
||||
```bash
|
||||
pnpm -r run test
|
||||
```
|
||||
|
||||
Or test individual packages:
|
||||
|
||||
```bash
|
||||
pnpm --filter @uncaged/nerve-core test
|
||||
pnpm --filter @uncaged/nerve-daemon test
|
||||
pnpm --filter @uncaged/nerve-cli test
|
||||
```
|
||||
|
||||
### 5. Try the CLI
|
||||
|
||||
```bash
|
||||
# Link the CLI globally
|
||||
cd packages/cli && npm link
|
||||
|
||||
# Initialize a workspace
|
||||
mkdir ~/my-nerve-workspace && cd ~/my-nerve-workspace
|
||||
nerve init
|
||||
|
||||
# Edit senses in nerve.yaml, then:
|
||||
nerve start # start the daemon
|
||||
nerve sense list # list registered senses
|
||||
nerve stop # stop the daemon
|
||||
```
|
||||
|
||||
### 6. Lint & format
|
||||
|
||||
```bash
|
||||
pnpm run check # biome lint check
|
||||
pnpm run format # biome auto-format
|
||||
```
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
nerve/
|
||||
├── packages/
|
||||
│ ├── core/ # @uncaged/nerve-core — shared types, log store, blob store
|
||||
│ ├── daemon/ # @uncaged/nerve-daemon — kernel, sense runtime, workflow manager
|
||||
│ └── cli/ # @uncaged/nerve-cli — CLI commands (init, start, stop, sense, etc.)
|
||||
├── docs/ # RFCs, conventions, skills
|
||||
├── pnpm-workspace.yaml
|
||||
└── biome.json # linter/formatter config
|
||||
```
|
||||
|
||||
## Key conventions
|
||||
|
||||
- **Monorepo** with pnpm workspaces
|
||||
- **ESM only** — all packages output ESM (`"type": "module"`)
|
||||
- **tsup** for builds, **vitest** for tests, **biome** for lint/format
|
||||
- **SQLite** (better-sqlite3) for log store and blob store
|
||||
- See `docs/coding-conventions.md` for code style rules
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- **Must build before test** — daemon and cli import compiled output from core
|
||||
- **better-sqlite3** requires native compilation — if `pnpm install` fails, ensure you have build tools (`build-essential` on Linux, Xcode CLI tools on macOS)
|
||||
- **Node 18+** required — uses native `fetch`, `crypto.randomUUID`, etc.
|
||||
- **pnpm only** — don't use npm/yarn, workspace links won't resolve correctly
|
||||
Reference in New Issue
Block a user