Skip to content

feat: the document API limited alpha#2087

Merged
harbournick merged 27 commits intomainfrom
nick/sd-1937-contract-first-document-api-alpha
Feb 18, 2026
Merged

feat: the document API limited alpha#2087
harbournick merged 27 commits intomainfrom
nick/sd-1937-contract-first-document-api-alpha

Conversation

@harbournick
Copy link
Collaborator

Summary

This PR establishes a contract-first Document API alpha baseline with working Super Editor adapters, generated contract/docs outputs, and conformance coverage.

Included

  • @superdoc/document-api contract + typed API surface (read + mutation operations).
  • Super Editor adapter implementation for the alpha operation set.
  • Capability model + consistent mutation semantics: typed pre-apply throws, structured non-applied failures, and no post-apply throws.
  • Contract parity/generation/check tooling.
  • Generated artifacts committed (packages/document-api/generated/** + docs reference outputs), with explicit generated-vs-manual ownership docs.
  • Conformance test suite for mutating operations.

Alpha Operation Scope

  • Core: find, getNode, getNodeById, getText, info, insert, replace, delete
  • Capabilities: capabilities.get
  • Comments: comments.add, comments.edit, comments.reply, comments.move, comments.resolve, comments.remove, comments.setInternal, comments.setActive,
    comments.goTo, comments.get, comments.list
  • Track changes: trackChanges.list, trackChanges.get, trackChanges.accept, trackChanges.reject, trackChanges.acceptAll, trackChanges.rejectAll
  • Additional alpha ops: format.bold, create.paragraph, lists.list, lists.get, lists.insert, lists.setType, lists.indent, lists.outdent, lists.restart,
    lists.exit

Validation

  • pnpm exec vitest run packages/super-editor/src/document-api-adapters/__conformance__/contract-conformance.test.ts
  • pnpm exec tsx packages/document-api/scripts/check-contract-parity.ts
  • pnpm exec tsx packages/document-api/scripts/check-contract-outputs.ts

Out of Scope

  • New operation domains beyond the alpha surface above.

@harbournick harbournick self-assigned this Feb 17, 2026
@linear
Copy link

linear bot commented Feb 17, 2026

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Visual diffs detected

Pixel differences were found in visual tests. This is not blocking — reproduce locally with cd tests/visual && pnpm docs:download && pnpm test to review diffs.

…registry

Adds `api.invoke({ operationId, input, options })` for dynamic/AI callers
alongside type-safe overloads for TypeScript consumers. Includes:

- OperationRegistry with bidirectional compile-time completeness checks
- Runtime dispatch table mapping all 36 operations to direct API methods
- DynamicInvokeRequest overload accepting unknown input
- hasOwnProperty guard with clear error for unknown operation IDs
- Contract parity check extended to verify dispatch table keys
- 13 new tests covering completeness, parity, error handling, and dynamic dispatch
@harbournick harbournick merged commit 091c24c into main Feb 18, 2026
9 checks passed
@harbournick harbournick deleted the nick/sd-1937-contract-first-document-api-alpha branch February 18, 2026 02:45
@superdoc-bot
Copy link
Contributor

superdoc-bot bot commented Feb 18, 2026

🎉 This PR is included in superdoc v1.15.0-next.5

The release is available on GitHub release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant