AgentSkillsCN

build

构建命令、CI/CD 工作流、分支策略以及 npm 发布流程

SKILL.md
--- frontmatter
name: build
description: Build commands, CI/CD workflows, branching strategy, npm publishing

Build

How to build, deploy, and publish in this monorepo.

Local Build

bash
npm run build                              # Build all packages (core deps first)
npm run build -w packages/<name>           # Build a specific package
npm run build -w workspaces/<name>         # Build a specific workspace
npm run build:core-deps                    # Build types, errors, fabric (dependency order)
npm run clean                              # Remove all dist/ directories

Build order matters: types -> errors -> fabric -> everything else. The top-level npm run build handles this automatically via build:core-deps.

Typecheck and Lint

bash
npm run typecheck                          # Typecheck all workspaces
npm run typecheck -w packages/<name>       # Typecheck a specific package
npm run lint                               # Lint everything (quiet mode)
npm run format                             # Auto-fix lint + sort package.json

CI/CD Workflows

NPM Check (npm-check.yml)

Runs on pushes to feature branches. Validates code quality before merge.

TriggerBranches/Tags
Pushbranch/*, claude/*, codex/*, devin/*, fix/*, feat/*
Tagcheck-*

Jobs (all parallel):

  • Lint: Node 24, npm run lint
  • Typecheck: Node 24, npm run typecheck (continue-on-error)
  • Unit Test: Matrix [Node 22, 24, 25], npm test with optional Datadog tracing
  • LLM Client Test: Conditional, only when packages/llm/** changes

NPM Deploy (npm-deploy.yml)

Publishes packages to npm. Skips already-published versions automatically.

TriggerEffect
Push to mainPublish stable versions
Tag deploy-*Publish stable versions
Tag dev-*Publish with --tag dev (only -dev.N versions)
Tag rc-*Publish with --tag rc (only -rc.N versions)

Stack Deployments

CDK infrastructure deploys via separate workflows:

WorkflowTriggerEnvironment
deploy-env-sandbox.ymlbranch/*, claude/*, feat/*, fix/*, sandbox/* branches; sandbox-* tags; only workspaces/** path changessandbox
deploy-env-development.ymlmain branch, development/* branches, development-* tags; only workspaces/** path changesdevelopment
deploy-env-production.ymlproduction-* tags, v0.*/v1.* tagsproduction
deploy-stacks.ymlManual (workflow_dispatch)sandbox/development/production
deploy-stack-documentation.ymlmain/feat/*/sandbox/* branches when workspaces/documentation/** changes; stack-documentation-*/sandbox-* tags; manualsandbox/development/production

Branching Strategy

Branch PatternPurposeTriggers
mainStable releasesnpm-deploy, stack deploy to development
feat/*Feature developmentnpm-check, stack deploy to sandbox
fix/*Bug fixesnpm-check, stack deploy to sandbox
branch/*General worknpm-check, stack deploy to sandbox
claude/*AI agent worknpm-check, stack deploy to sandbox
codex/*AI agent worknpm-check
devin/*AI agent worknpm-check
sandbox/*Sandbox testingstack deploy to sandbox
development/*Development testingstack deploy to development

Tags

Tag PatternPurpose
check-*Trigger npm-check manually
deploy-*Trigger npm publish (stable)
dev-*Publish with dev dist-tag
rc-*Publish with rc dist-tag
sandbox-*Deploy stacks to sandbox
development-*Deploy stacks to development
production-*Deploy stacks to production
v0.*, v1.*Deploy stacks to production
stack-documentation-*Deploy documentation stack only

Publishing Packages

Packages publish automatically when merged to main. The workflow:

  1. Iterates over all packages/*/
  2. Skips private: true packages
  3. Compares local version to npm registry
  4. Publishes only if version is new (with --provenance)

To publish a pre-release:

  1. Bump version to include -rc.0 or -dev.0 suffix
  2. Run npm i --package-lock-only
  3. Push a tag: git tag rc-description && git push origin rc-description

Completion Criteria

See .claude/skills/green/SKILL.md.