Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@
* First-use application code should open a named worldline with
* `openWarpWorldline()`. `WarpApp`, `WarpCore`, and `openWarpGraph()` remain
* supported compatibility and diagnostic surfaces for graph-first code.
*
* @example
* ```typescript
* import { GitGraphAdapter, openWarpWorldline } from '@git-stunts/git-warp';
* import GitPlumbing from '@git-stunts/plumbing';
*
* const persistence = new GitGraphAdapter({
* plumbing: new GitPlumbing({ cwd: '.' }),
* });
*
* const events = await openWarpWorldline({
* persistence,
* worldlineName: 'events',
* writerId: 'agent-1',
* });
*
* await events.commit((patch) => {
* patch.addNode('user:alice');
* });
*
* const props = await events.live().getNodeProps('user:alice');
* ```
*/

import GitGraphAdapter from './src/infrastructure/adapters/GitGraphAdapter.ts';
Expand Down
20 changes: 20 additions & 0 deletions test/unit/scripts/v18-package-surface-audit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const packageJson = readText('package.json');
const jsrJson = readText('jsr.json');
const indexSource = readText('index.ts');

function packageModuleDoc(): string {
const terminator = indexSource.indexOf('*/');
if (terminator === -1) {
throw new Error('index.ts is missing its package module JSDoc block');
}
return indexSource.slice(0, terminator + '*/'.length);
}

const moduleDoc = packageModuleDoc();

describe('v18 package surface audit', () => {
it('positions the registry package around the Worldline-first API', () => {
expect(packageJson).toContain(
Expand All @@ -38,6 +48,16 @@ describe('v18 package surface audit', () => {
expect(indexSource).toContain('WarpWorldlinePatchBuild,');
});

it('keeps package hover docs on the Worldline-first example', () => {
expect(moduleDoc).toContain('@example');
expect(moduleDoc).toContain('openWarpWorldline');
expect(moduleDoc).toContain("events.commit((patch) =>");
expect(moduleDoc).toContain('events.live().getNodeProps');
expect(moduleDoc).not.toContain('WarpApp.open(');
expect(moduleDoc).not.toContain('app.createPatch(');
expect(moduleDoc).not.toContain('app.materialize(');
});

it('keeps default export compatibility explicit', () => {
expect(indexSource).toContain('export default WarpApp;');
expect(indexSource).toContain('WarpApp remains the compatibility default export');
Expand Down
Loading