chore: update docs and schemas

This commit is contained in:
Nathan Flurry 2026-01-26 23:20:33 -08:00
parent 4083baa1c1
commit 79bb441287
7 changed files with 720 additions and 919 deletions

File diff suppressed because it is too large Load diff

View file

@ -2099,6 +2099,47 @@
"properties"
]
},
"Event.file.watcher.updated": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "file.watcher.updated"
},
"properties": {
"type": "object",
"properties": {
"file": {
"type": "string"
},
"event": {
"anyOf": [
{
"type": "string",
"const": "add"
},
{
"type": "string",
"const": "change"
},
{
"type": "string",
"const": "unlink"
}
]
}
},
"required": [
"file",
"event"
]
}
},
"required": [
"type",
"properties"
]
},
"Todo": {
"type": "object",
"properties": {
@ -2157,47 +2198,6 @@
"properties"
]
},
"Event.file.watcher.updated": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "file.watcher.updated"
},
"properties": {
"type": "object",
"properties": {
"file": {
"type": "string"
},
"event": {
"anyOf": [
{
"type": "string",
"const": "add"
},
{
"type": "string",
"const": "change"
},
{
"type": "string",
"const": "unlink"
}
]
}
},
"required": [
"file",
"event"
]
}
},
"required": [
"type",
"properties"
]
},
"Event.tui.prompt.append": {
"type": "object",
"properties": {
@ -3006,10 +3006,10 @@
"$ref": "#/definitions/Event.session.compacted"
},
{
"$ref": "#/definitions/Event.todo.updated"
"$ref": "#/definitions/Event.file.watcher.updated"
},
{
"$ref": "#/definitions/Event.file.watcher.updated"
"$ref": "#/definitions/Event.todo.updated"
},
{
"$ref": "#/definitions/Event.tui.prompt.append"

View file

@ -4,6 +4,26 @@ import { join } from "path";
import { createNormalizedSchema, type NormalizedSchema } from "./normalize.js";
import type { JSONSchema7 } from "json-schema";
function normalizeCodexRefs(value: JSONSchema7): JSONSchema7 {
if (Array.isArray(value)) {
return value.map((item) => normalizeCodexRefs(item as JSONSchema7)) as JSONSchema7;
}
if (value && typeof value === "object") {
const next: Record<string, JSONSchema7> = {};
for (const [key, child] of Object.entries(value)) {
if (key === "$ref" && typeof child === "string") {
next[key] = child.replace("#/definitions/v2/", "#/definitions/") as JSONSchema7;
continue;
}
next[key] = normalizeCodexRefs(child as JSONSchema7);
}
return next as JSONSchema7;
}
return value;
}
export async function extractCodexSchema(): Promise<NormalizedSchema> {
console.log("Extracting Codex schema via CLI...");
@ -33,14 +53,14 @@ export async function extractCodexSchema(): Promise<NormalizedSchema> {
if (schema.definitions) {
for (const [defName, def] of Object.entries(schema.definitions)) {
definitions[defName] = def as JSONSchema7;
definitions[defName] = normalizeCodexRefs(def as JSONSchema7);
}
} else if (schema.$defs) {
for (const [defName, def] of Object.entries(schema.$defs)) {
definitions[defName] = def as JSONSchema7;
definitions[defName] = normalizeCodexRefs(def as JSONSchema7);
}
} else {
definitions[name] = schema as JSONSchema7;
definitions[name] = normalizeCodexRefs(schema as JSONSchema7);
}
}