prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "rename prototypey to prototypekit across entire project"

This reverts commit 21ba4996abe4b4ee9a3b76f82881f9cc97c13e33.

Tyler 00b8f306 1f280a0d

+45 -45
+2 -2
.github/workflows/ci.yml
··· 6 6 - uses: actions/checkout@v4 7 7 - uses: ./.github/actions/prepare 8 8 - run: pnpm build 9 - - run: node packages/prototypekit/lib/index.js 9 + - run: node packages/prototypey/lib/index.js 10 10 lint: 11 11 name: Lint 12 12 runs-on: ubuntu-latest ··· 44 44 steps: 45 45 - uses: actions/checkout@v4 46 46 - uses: ./.github/actions/prepare 47 - - run: pnpm -F prototypekit test:bench 47 + - run: pnpm -F prototypey test:bench 48 48 49 49 name: CI 50 50
+2 -2
README.md
··· 73 73 --- 74 74 75 75 <p align="center"> 76 - <a href="https://github.com/tylersayshi/prototypekit/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a> 77 - <a href="https://github.com/tylersayshi/prototypekit/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a> 76 + <a href="https://github.com/tylersayshi/prototypey/blob/main/.github/CODE_OF_CONDUCT.md" target="_blank"><img alt="🤝 Code of Conduct: Kept" src="https://img.shields.io/badge/%F0%9F%A4%9D_code_of_conduct-kept-21bb42" /></a> 77 + <a href="https://github.com/tylersayshi/prototypey/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a> 78 78 <img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" /> 79 79 </p> 80 80
+2 -2
package.json
··· 1 1 { 2 - "name": "prototypekit-monorepo", 2 + "name": "prototypey-monorepo", 3 3 "version": "0.0.0", 4 4 "private": true, 5 5 "description": "Type-safe lexicon inference for ATProto schemas", 6 6 "repository": { 7 7 "type": "git", 8 - "url": "git+https://github.com/tylersayshi/prototypekit.git" 8 + "url": "git+https://github.com/tylersayshi/prototypey.git" 9 9 }, 10 10 "license": "MIT", 11 11 "author": {
+10 -10
packages/cli/README.md
··· 1 - # @prototypekit/cli 1 + # @prototypey/cli 2 2 3 3 CLI tool for generating types from ATProto lexicon schemas. 4 4 5 5 ## Installation 6 6 7 7 ```bash 8 - npm install -g @prototypekit/cli 8 + npm install -g @prototypey/cli 9 9 ``` 10 10 11 11 Or use directly with npx: 12 12 13 13 ```bash 14 - npx @prototypekit/cli 14 + npx @prototypey/cli 15 15 ``` 16 16 17 17 ## Commands ··· 23 23 **Usage:** 24 24 25 25 ```bash 26 - prototypekit gen-inferred <outdir> <schemas...> 26 + prototypey gen-inferred <outdir> <schemas...> 27 27 ``` 28 28 29 29 **Arguments:** ··· 34 34 **Example:** 35 35 36 36 ```bash 37 - prototypekit gen-inferred ./generated/inferred ./lexicons/**/*.json 37 + prototypey gen-inferred ./generated/inferred ./lexicons/**/*.json 38 38 ``` 39 39 40 40 **What it does:** ··· 51 51 **Usage:** 52 52 53 53 ```bash 54 - prototypekit gen-emit <outdir> <sources...> 54 + prototypey gen-emit <outdir> <sources...> 55 55 ``` 56 56 57 57 **Arguments:** ··· 62 62 **Example:** 63 63 64 64 ```bash 65 - prototypekit gen-emit ./lexicons ./src/lexicons/**/*.ts 65 + prototypey gen-emit ./lexicons ./src/lexicons/**/*.ts 66 66 ``` 67 67 68 68 **What it does:** ··· 76 76 77 77 The typical workflow combines both commands for bidirectional type safety: 78 78 79 - 1. **Author lexicons in TypeScript** using the `prototypekit` library 79 + 1. **Author lexicons in TypeScript** using the `prototypey` library 80 80 2. **Emit to JSON** with `gen-emit` for runtime validation and API contracts 81 81 3. **Generate inferred types** with `gen-inferred` for consuming code 82 82 ··· 85 85 # src/lexicons/app.bsky.actor.profile.ts 86 86 87 87 # Emit JSON schemas 88 - prototypekit gen-emit ./schemas ./src/lexicons/**/*.ts 88 + prototypey gen-emit ./schemas ./src/lexicons/**/*.ts 89 89 90 90 # Generate TypeScript types from schemas 91 - prototypekit gen-inferred ./generated ./schemas/**/*.json 91 + prototypey gen-inferred ./generated ./schemas/**/*.json 92 92 ``` 93 93 94 94 ## Requirements
+4 -4
packages/cli/package.json
··· 1 1 { 2 - "name": "@prototypekit/cli", 2 + "name": "@prototypey/cli", 3 3 "version": "0.0.0", 4 4 "description": "CLI tool for generating types from ATProto lexicon schemas", 5 5 "repository": { 6 6 "type": "git", 7 - "url": "git+https://github.com/tylersayshi/prototypekit.git", 7 + "url": "git+https://github.com/tylersayshi/prototypey.git", 8 8 "directory": "packages/cli" 9 9 }, 10 10 "license": "MIT", ··· 14 14 }, 15 15 "type": "module", 16 16 "bin": { 17 - "prototypekit": "./lib/index.js" 17 + "prototypey": "./lib/index.js" 18 18 }, 19 19 "files": [ 20 20 "lib/", ··· 26 26 "tsc": "tsc" 27 27 }, 28 28 "dependencies": { 29 - "prototypekit": "workspace:*", 29 + "prototypey": "workspace:*", 30 30 "sade": "^1.8.1", 31 31 "tinyglobby": "^0.2.15" 32 32 },
+1 -1
packages/cli/src/index.ts
··· 7 7 await readFile(new URL("../package.json", import.meta.url), "utf-8"), 8 8 ) as { version: string }; 9 9 10 - const prog = sade("prototypekit"); 10 + const prog = sade("prototypey"); 11 11 12 12 prog 13 13 .version(pkg.version)
+2 -2
packages/cli/src/templates/inferred.ts
··· 22 22 // Generate a clean type name from the NSID 23 23 const typeName = generateTypeName(id); 24 24 25 - return `// Generated by prototypekit - DO NOT EDIT 25 + return `// Generated by prototypey - DO NOT EDIT 26 26 // Source: ${id} 27 - import type { Infer } from "prototypekit"; 27 + import type { Infer } from "prototypey"; 28 28 import schema from "${relativeSchemaPath}" with { type: "json" }; 29 29 30 30 /**
+10 -10
packages/cli/tests/commands/gen-emit.test.ts
··· 10 10 11 11 beforeEach(async () => { 12 12 // Create a temporary directory for test files 13 - testDir = join(tmpdir(), `prototypekit-test-${Date.now()}`); 13 + testDir = join(tmpdir(), `prototypey-test-${Date.now()}`); 14 14 outDir = join(testDir, "output"); 15 15 await mkdir(testDir, { recursive: true }); 16 16 await mkdir(outDir, { recursive: true }); ··· 27 27 await writeFile( 28 28 lexiconFile, 29 29 ` 30 - import { lx } from "prototypekit"; 30 + import { lx } from "prototypey"; 31 31 32 32 export const profileNamespace = lx.namespace("app.bsky.actor.profile", { 33 33 main: lx.record({ ··· 83 83 await writeFile( 84 84 lexiconFile, 85 85 ` 86 - import { lx } from "prototypekit"; 86 + import { lx } from "prototypey"; 87 87 88 88 export const profile = lx.namespace("app.bsky.actor.profile", { 89 89 main: lx.record({ ··· 128 128 await writeFile( 129 129 join(lexicons, "profile.ts"), 130 130 ` 131 - import { lx } from "prototypekit"; 131 + import { lx } from "prototypey"; 132 132 export const schema = lx.namespace("app.bsky.actor.profile", { 133 133 main: lx.record({ key: "self", record: lx.object({}) }), 134 134 }); ··· 138 138 await writeFile( 139 139 join(lexicons, "post.ts"), 140 140 ` 141 - import { lx } from "prototypekit"; 141 + import { lx } from "prototypey"; 142 142 export const schema = lx.namespace("app.bsky.feed.post", { 143 143 main: lx.record({ key: "tid", record: lx.object({}) }), 144 144 }); ··· 167 167 await writeFile( 168 168 lexiconFile, 169 169 ` 170 - import { lx } from "prototypekit"; 170 + import { lx } from "prototypey"; 171 171 172 172 export const searchPosts = lx.namespace("app.bsky.feed.searchPosts", { 173 173 main: lx.query({ ··· 236 236 await writeFile( 237 237 lexiconFile, 238 238 ` 239 - import { lx } from "prototypekit"; 239 + import { lx } from "prototypey"; 240 240 241 241 export const createPost = lx.namespace("com.atproto.repo.createRecord", { 242 242 main: lx.procedure({ ··· 307 307 await writeFile( 308 308 lexiconFile, 309 309 ` 310 - import { lx } from "prototypekit"; 310 + import { lx } from "prototypey"; 311 311 312 312 export const subscribeRepos = lx.namespace("com.atproto.sync.subscribeRepos", { 313 313 main: lx.subscription({ ··· 394 394 await writeFile( 395 395 lexiconFile, 396 396 ` 397 - import { lx } from "prototypekit"; 397 + import { lx } from "prototypey"; 398 398 399 399 export const feedDefs = lx.namespace("app.bsky.feed.defs", { 400 400 postView: lx.object({ ··· 458 458 await writeFile( 459 459 lexiconFile, 460 460 ` 461 - import { lx } from "prototypekit"; 461 + import { lx } from "prototypey"; 462 462 463 463 export const imagePost = lx.namespace("app.example.imagePost", { 464 464 main: lx.record({
+5 -5
packages/cli/tests/commands/gen-inferred.test.ts
··· 11 11 12 12 beforeEach(async () => { 13 13 // Create a temporary directory for test files 14 - testDir = join(tmpdir(), `prototypekit-inferred-test-${Date.now()}`); 14 + testDir = join(tmpdir(), `prototypey-inferred-test-${Date.now()}`); 15 15 outDir = join(testDir, "output"); 16 16 schemasDir = join(testDir, "schemas"); 17 17 await mkdir(testDir, { recursive: true }); ··· 68 68 const content = await readFile(outputFile, "utf-8"); 69 69 70 70 // Verify the generated code structure 71 - expect(content).toContain("// Generated by prototypekit - DO NOT EDIT"); 71 + expect(content).toContain("// Generated by prototypey - DO NOT EDIT"); 72 72 expect(content).toContain("// Source: app.bsky.actor.profile"); 73 - expect(content).toContain('import type { Infer } from "prototypekit"'); 73 + expect(content).toContain('import type { Infer } from "prototypey"'); 74 74 expect(content).toContain('with { type: "json" }'); 75 75 expect(content).toContain("export type Profile = Infer<typeof schema>"); 76 76 expect(content).toContain("export const ProfileSchema = schema"); ··· 321 321 const content = await readFile(outputFile, "utf-8"); 322 322 323 323 // Check all required exports 324 - expect(content).toContain('import type { Infer } from "prototypekit"'); 324 + expect(content).toContain('import type { Infer } from "prototypey"'); 325 325 expect(content).toContain("export type Complete = Infer<typeof schema>"); 326 326 expect(content).toContain("export const CompleteSchema = schema"); 327 327 expect(content).toContain( ··· 335 335 expect(content).toContain('v.$type === "app.test.complete"'); 336 336 337 337 // Check comments 338 - expect(content).toContain("// Generated by prototypekit - DO NOT EDIT"); 338 + expect(content).toContain("// Generated by prototypey - DO NOT EDIT"); 339 339 expect(content).toContain("// Source: app.test.complete"); 340 340 expect(content).toContain( 341 341 "* Type-inferred from lexicon schema: app.test.complete",
+1 -1
packages/cli/tests/fixtures/simple-lexicon.ts
··· 1 - import { lx } from "prototypekit"; 1 + import { lx } from "prototypey"; 2 2 3 3 export const profileNamespace = lx.namespace("app.bsky.actor.profile", { 4 4 main: lx.record({
+3 -3
packages/prototypekit/package.json packages/prototypey/package.json
··· 1 1 { 2 - "name": "prototypekit", 2 + "name": "prototypey", 3 3 "version": "0.0.0", 4 4 "description": "Type-safe lexicon inference for ATProto schemas", 5 5 "repository": { 6 6 "type": "git", 7 - "url": "git+https://github.com/tylersayshi/prototypekit.git", 8 - "directory": "packages/prototypekit" 7 + "url": "git+https://github.com/tylersayshi/prototypey.git", 8 + "directory": "packages/prototypey" 9 9 }, 10 10 "license": "MIT", 11 11 "author": {
packages/prototypekit/setup-vitest.ts packages/prototypey/setup-vitest.ts
packages/prototypekit/src/index.ts packages/prototypey/src/index.ts
packages/prototypekit/src/infer.ts packages/prototypey/src/infer.ts
packages/prototypekit/src/lib.ts packages/prototypey/src/lib.ts
packages/prototypekit/src/type-utils.ts packages/prototypey/src/type-utils.ts
packages/prototypekit/tests/base-case.test.ts packages/prototypey/tests/base-case.test.ts
packages/prototypekit/tests/bsky-actor.test.ts packages/prototypey/tests/bsky-actor.test.ts
packages/prototypekit/tests/bsky-feed.test.ts packages/prototypey/tests/bsky-feed.test.ts
packages/prototypekit/tests/infer.bench.ts packages/prototypey/tests/infer.bench.ts
packages/prototypekit/tests/infer.test.ts packages/prototypey/tests/infer.test.ts
packages/prototypekit/tests/primitives.test.ts packages/prototypey/tests/primitives.test.ts
packages/prototypekit/tsconfig.json packages/prototypey/tsconfig.json
packages/prototypekit/tsdown.config.ts packages/prototypey/tsdown.config.ts
packages/prototypekit/vitest.config.ts packages/prototypey/vitest.config.ts
+3 -3
pnpm-lock.yaml
··· 26 26 27 27 packages/cli: 28 28 dependencies: 29 - prototypekit: 29 + prototypey: 30 30 specifier: workspace:* 31 - version: link:../prototypekit 31 + version: link:../prototypey 32 32 sade: 33 33 specifier: ^1.8.1 34 34 version: 1.8.1 ··· 49 49 specifier: ^3.2.4 50 50 version: 3.2.4(@types/node@24.0.4)(esbuild@0.25.10)(jiti@2.6.1)(jsdom@25.0.1) 51 51 52 - packages/prototypekit: 52 + packages/prototypey: 53 53 devDependencies: 54 54 '@ark/attest': 55 55 specifier: ^0.49.0