1.3 KiB
1.3 KiB
Hook Development
When creating a new hook, always complete all of the following:
- Implementation: Create the hook in
@copilotkit/react-core. If backward compatibility shims are needed, add them in the package'sv1/directory. - JSDoc: Add JSDoc on top of the hook implementation, including usage examples.
- Tests: Write extensive tests covering behavior, edge cases, and lifecycle (mount/unmount/re-render).
- API reference: Add a reference page at
showcase/shell-docs/src/content/reference/hooks/<hookName>.mdxwithtitleanddescriptionfrontmatter. The v2 reference navigation is generated automatically by walking thereference/tree and reading frontmatter (seeshowcase/shell-docs/src/lib/reference-items.ts) — there is nometa.jsonto edit for v2 reference; the file and its frontmatter are the metadata. (Only the legacyreference/v1/tree usesmeta.json.) - Conceptual docs (if needed): If the hook needs usage/how-to documentation beyond the API reference, add a guide page under
showcase/shell-docs/src/content/docs/and update that section'smeta.jsonso it appears in navigation.
Never recreate the retired docs/content/docs/ tree. The top-level docs/ path is only
a symlink to shell-docs. See Documentation.