···4242## High Value Improvements
43434444### 5. Provide Pre-defined Format Scalars
4545-**Current:** Only `@lexFormat("did")` - not type-safe
4646-**Change:** Add pre-defined scalars in lib/decorators.tsp:
4747-```typespec
4848-scalar did extends string;
4949-scalar handle extends string;
5050-scalar atUri extends string;
5151-scalar datetime extends string;
5252-scalar cid extends string;
5353-scalar tid extends string;
5454-scalar nsid extends string;
5555-scalar recordKey extends string;
5656-scalar uri extends string;
5757-scalar language extends string;
5858-```
4545+**Status:** ✅ DONE
4646+**Implementation:** Pre-defined format scalars added (did, handle, atUri, datetime, cid, cidLink, etc.)
5947**Files:**
6060-- `lib/decorators.tsp` - Add scalar definitions
6161-- `src/emitter.ts` - Detect these scalars and map to format automatically
6262-**Test Impact:** Can start using in new tests
6363-**Note:** Keep `@lexFormat` for backward compatibility and flexibility
4848+- `lib/main.tsp` - Scalar definitions
4949+- `src/emitter.ts` - Detects and maps to format automatically
64506551### 6. Add Const Support for String/Integer
6652**Current:** Only `@lexConst` for boolean
···7561## Nice to Have (Lower Priority)
76627763### 7. Native DateTime Type Mapping
7878-**Current:** `@lexFormat("datetime")` on string
7979-**Enhancement:** Optionally map `utcDateTime` → `format: "datetime"`
8080-**Note:** Lexicon only has one datetime format, TypeSpec has multiple
8181-**Verdict:** Lower priority, explicit `@lexFormat` is clearer
6464+**Status:** ✅ DONE (via `datetime` scalar)
6565+**Implementation:** Use `datetime` scalar instead of `@lexFormat("datetime")`
82668367### 8. Token Type Support
8468**When needed:** Implement token pattern
-27
SYNTAX.md
···427427428428**Valid key types:** `"tid"`, `"self"`, `"nsid"`
429429430430-### Alternative: @lexFormat decorator
431431-432432-**Pattern:** Use `@lexFormat` decorator instead of format scalars
433433-434434-**TypeSpec:**
435435-```typespec
436436-model Example {
437437- @lexFormat("at-uri")
438438- @required
439439- uri: string;
440440-441441- @lexFormat("datetime")
442442- @required
443443- createdAt: string;
444444-}
445445-```
446446-447447-**JSON:**
448448-```json
449449-{
450450- "uri": { "type": "string", "format": "at-uri" },
451451- "createdAt": { "type": "string", "format": "datetime" }
452452-}
453453-```
454454-455455-**Note:** Using predefined format scalars (`atUri`, `datetime`, etc.) is preferred over `@lexFormat` for better type safety and consistency.
456456-457430---
458431459432## Arrays
-17
packages/emitter/lib/decorators.tsp
···11import "../dist/tsp-index.js";
2233/**
44- * Specifies the lexicon format of a string field.
55- *
66- * Common formats:
77- * - "at-uri": AT Protocol URI
88- * - "cid": Content identifier
99- * - "did": Decentralized identifier
1010- * - "datetime": ISO 8601 datetime
1111- * - "handle": AT Protocol handle
1212- * - "uri": Generic URI
1313- * - "language": ISO language code
1414- *
1515- * NOTE: Consider using the predefined format scalars (did, handle, atUri, etc.)
1616- * instead of this decorator for better type safety.
1717- */
1818-extern dec lexFormat(target: unknown, format: valueof string);
1919-2020-/**
214 * Specifies the maximum number of graphemes (user-perceived characters) allowed.
225 * Used alongside maxLength for proper Unicode text handling.
236 */