Skip to content

feat: add 5 end-to-end SDK examples#21

Closed
khaliqgant wants to merge 1 commit intomainfrom
feat/examples
Closed

feat: add 5 end-to-end SDK examples#21
khaliqgant wants to merge 1 commit intomainfrom
feat/examples

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Mar 29, 2026

Examples

  1. Agent reads files — listTree, readFile, queryFiles
  2. Agent writes files — writeFile, bulkWrite, optimistic locking
  3. Webhook to VFS — ingestWebhook, computeCanonicalPath
  4. Realtime events — getEvents polling with cursors
  5. Relayauth scoped agent — scoped tokens, 403 on unauthorized access

Each example is runnable with npx tsx and has its own README.


Open with Devin

Five runnable TypeScript examples covering the core relayfile SDK:
- 01: read files (listTree, readFile, queryFiles)
- 02: write files (writeFile, bulkWrite, optimistic locking)
- 03: webhook ingestion (ingestWebhook, computeCanonicalPath)
- 04: realtime events (getEvents polling with cursors)
- 05: scoped agent permissions (path-restricted tokens, 403 handling)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

function printEvent(evt: FilesystemEvent) {
const ts = new Date(evt.timestamp).toLocaleTimeString();
console.log(
` ${ts} ${padRight(evt.type, 14)} ${evt.path} (${evt.origin})`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 evt.origin is optional and will display as (undefined) in event output

The printEvent helper interpolates evt.origin directly into the output string, but FilesystemEvent.origin is typed as origin?: EventOrigin (packages/sdk/typescript/src/types.ts:125). When the server omits the origin field, the output will render as e.g. 10:00:00 file.created /github/pulls/42.json (undefined) instead of showing a meaningful fallback.

Suggested change
` ${ts} ${padRight(evt.type, 14)} ${evt.path} (${evt.origin})`
` ${ts} ${padRight(evt.type, 14)} ${evt.path} (${evt.origin ?? "unknown"})`
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@khaliqgant
Copy link
Copy Markdown
Member Author

Superseded by #25 which includes all examples + docker quickstart

@khaliqgant khaliqgant closed this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant