Something went wrong. Try again.
WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage fro
Something went wrong. Try again.
1 folder · 4 files
README.md
# Generated Lexicon Code
This directory contains automatically generated TypeScript code from AT Protocol lexicon definitions for the Tangled.org service.
## ⚠️ Do Not Edit
**IMPORTANT**: All files in this directory are generated by `@atproto/lex-cli` and should not be manually edited. Any changes will be overwritten the next time code generation runs.
## Source
The lexicon definitions are vendored in `/lexicons/` directory from:
- **Source**: `https://tangled.org/tangled.org/core/raw/master/lexicons/`
- **Repository**: `https://tangled.org/tangled.org/core`
## Code Generation
To regenerate this code after updating lexicons:
```bash
npm run codegen
```
This command:
1. Runs `@atproto/lex-cli` to generate TypeScript types from lexicons
2. Automatically fixes ES module imports by adding `.js` extensions
3. Rewrites `multiformats/cid` imports to use the main package export
## Dependencies
The generated code requires:
- `@atproto/api` - AT Protocol client library
- `@atproto/lexicon` - Lexicon validation runtime
- `multiformats` - CID (Content Identifier) support for content addressing
These are already included in `package.json` dependencies.
**Note on multiformats**: The code generator produces `import { CID } from 'multiformats/cid'` which TypeScript NodeNext module resolution cannot find. Our post-processing script (`scripts/fix-lexicon-imports.js`) automatically rewrites this to `import { CID } from 'multiformats'`, which uses the main package export and resolves correctly.
## Using Generated Types
### Recommended Approach
**Define your own interfaces** based on the lexicon schemas rather than importing from generated code. This avoids TypeScript compatibility issues with the generated code.
Example:
```typescript
// src/lib/issues-api.ts
/**
* Issue record type based on sh.tangled.repo.issue lexicon
* @see lexicons/sh/tangled/issue/issue.json
*/
export interface IssueRecord {
$type: 'sh.tangled.repo.issue';
repo: string;
title: string;
body?: string;
createdAt: string;
mentions?…