docs: update CLAUDE.md — changesets + npmjs registry

This commit is contained in:
2026-05-13 21:22:15 +08:00
parent 9276689cb6
commit dd3eec7d35
+22 -35
View File
@@ -30,6 +30,7 @@ workflow/
workflow-agent-cursor/ # @uncaged/workflow-agent-cursor workflow-agent-cursor/ # @uncaged/workflow-agent-cursor
workflow-agent-hermes/ # @uncaged/workflow-agent-hermes workflow-agent-hermes/ # @uncaged/workflow-agent-hermes
workflow-agent-llm/ # @uncaged/workflow-agent-llm workflow-agent-llm/ # @uncaged/workflow-agent-llm
workflow-agent-react/ # @uncaged/workflow-agent-react
workflow-util-agent/ # @uncaged/workflow-util-agent — buildAgentPrompt, spawnCli workflow-util-agent/ # @uncaged/workflow-util-agent — buildAgentPrompt, spawnCli
workflow-template-develop/ # @uncaged/workflow-template-develop workflow-template-develop/ # @uncaged/workflow-template-develop
workflow-template-solve-issue/ # @uncaged/workflow-template-solve-issue workflow-template-solve-issue/ # @uncaged/workflow-template-solve-issue
@@ -40,7 +41,7 @@ workflow/
``` ```
- Execution stack layers: `workflow-protocol` → (`workflow-runtime`, `workflow-util`, `workflow-reactor`) → (`workflow-cas`, `workflow-register`) → `workflow-execute``cli-workflow` - Execution stack layers: `workflow-protocol` → (`workflow-runtime`, `workflow-util`, `workflow-reactor`) → (`workflow-cas`, `workflow-register`) → `workflow-execute``cli-workflow`
- Packages use `workspace:*` protocol - Packages use `workspace:^` protocol (resolves to `^x.y.z` on publish)
## Language & Paradigm ## Language & Paradigm
@@ -245,61 +246,47 @@ bun run format # biome format --write
bun test # run tests bun test # run tests
``` ```
### Publishing to Gitea npm Registry ### Version Management & Publishing
All public `@uncaged/*` packages are published to the Gitea npm registry at `git.shazhou.work`. Workflow workspaces consume packages from this registry via `bunfig.toml`. All public `@uncaged/*` packages are published to **npmjs.org** via `@changesets/cli` with **fixed mode** (all packages share the same version number). `workflow-dashboard` is private and excluded.
```bash ```bash
# Publish all packages (bun pm pack resolves workspace:* → actual versions) # 1. After making changes, add a changeset describing the change
bun run publish:gitea bun changeset
# Dry run — see what would be published # 2. Before release, bump all package versions + generate CHANGELOGs
bun run publish:gitea:dry bun version
# 3. Build, test, and publish to npmjs
bun release
``` ```
Prerequisites: `.npmrc` in monorepo root with Gitea auth token (`//git.shazhou.work/api/packages/shazhou/npm/:_authToken=<token>`). - `workspace:^` dependencies resolve to `^x.y.z` on publish
- Changesets config: `.changeset/config.json` (fixed mode, public access)
- Each package has auto-generated `CHANGELOG.md`
### Workflow Workspace Setup ### Consuming @uncaged/* Packages
External workflow repos (e.g. `xingyue-workflows`) use the Gitea registry for `@uncaged/*` packages. Add a `bunfig.toml`: External workflow repos just `bun install` — packages come from npmjs like any other dependency. No special registry config needed.
```toml
[install.scopes]
"@uncaged" = "https://git.shazhou.work/api/packages/shazhou/npm/"
```
Then `bun install` resolves `@uncaged/*` from Gitea, all other packages from npmjs.
### Cross-repo Development (bun link)
Alternative for development against un-published local changes:
```bash
bun run link # Register all packages (from monorepo root)
bun run link:consume # Link into CWD's project (⚠️ don't bun install after)
bun run link:unlink # Restore original deps
```
### End-to-end: Monorepo → Registry → Workspace → Bundle ### End-to-end: Monorepo → Registry → Workspace → Bundle
The recommended development flow for building workflows:
``` ```
workflow/ (monorepo) — engine, runtime, templates, agents workflow/ (monorepo) — engine, runtime, templates, agents
│ bun run publish:giteaauto topo-sort, bun pm pack → npm publish │ bun release build + test + changeset publish
git.shazhou.work npm registry — @uncaged/* scoped packages npmjs.org — @uncaged/* scoped packages (public)
│ bun install — via bunfig.toml scoped registry │ bun install
my-workflows/ (workspace) — bunfig.toml + normal package.json my-workflows/ (workspace) — normal package.json
│ bun run build:develop — bun build → single .esm.js │ bun run build:develop — bun build → single .esm.js
uncaged-workflow workflow add — register bundle locally uncaged-workflow workflow add — register bundle locally
uncaged-workflow run — execute workflow uncaged-workflow run — execute workflow
``` ```
1. **Monorepo changes**`bun run publish:gitea` (packages auto-discovered from `packages/*/`, topologically sorted, `workspace:*` resolved to real versions) 1. **Monorepo changes**`bun changeset` (describe change) → `bun version` (bump) → `bun release` (publish)
2. **Workspace**`bun install` fetches latest from Gitea, `bun install` is safe to run anytime 2. **Workspace**`bun install` fetches latest from npmjs
3. **Build** → produces single-file ESM bundle with `@uncaged/*` as externals 3. **Build** → produces single-file ESM bundle with `@uncaged/*` as externals
4. **Register & Run**`uncaged-workflow workflow add <name> <bundle>` then `uncaged-workflow run <name>` 4. **Register & Run**`uncaged-workflow workflow add <name> <bundle>` then `uncaged-workflow run <name>`