mirror of
https://github.com/benjitaylor/agentation.git
synced 2026-09-14 20:06:45 +08:00
2.0 KiB
2.0 KiB
Agentation Package
This is the publishable npm package. Changes here affect everyone who installs agentation.
Critical Rules
- NEVER run
npm publish- Only publish when explicitly instructed - NEVER bump version in package.json without explicit instruction
- NEVER modify exports in index.ts without discussing breaking changes
What Gets Published
dist/folder (compiled fromsrc/)package.json,README.md,LICENSE
Before Modifying src/
- Consider: Is this a breaking change?
- Consider: Does this affect the API surface?
- Consider: Will existing users' code still work?
Main Export
import { Agentation } from 'agentation';
No external runtime dependencies beyond React.
Programmatic API
The component exposes these callback props (added in 1.2.0):
onAnnotationAdd(annotation)- when annotation createdonAnnotationDelete(annotation)- when annotation deletedonAnnotationUpdate(annotation)- when annotation editedonAnnotationsClear(annotations[])- when all clearedonCopy(markdown)- when copy button clickedcopyToClipboard(boolean, default: true)
API stability: These are public contracts. Changing signatures or removing callbacks is a breaking change requiring a major version bump.
Expansion ideas (for future consideration):
onActivate/onDeactivate- toolbar state changesgetAnnotations()ref method - programmatic accessonExportwith format options
Testing Changes
- Run
pnpm buildto ensure it compiles - Check the example app still works:
pnpm dev - Verify no TypeScript errors in consumers
Publishing
When instructed to publish a new npm version:
- Bump version in
package.json - Run
pnpm build - Commit the version bump
- Run
npm publish --access public(will prompt for OTP) - Push to main
- Update changelog in
example/src/app/changelog/page.tsx(add new entry toreleasesarray) - Commit and push the changelog update
Always analyze what changed since the last version to write accurate changelog entries.