mirror of
https://github.com/simstudioai/sim.git
synced 2026-11-22 05:07:51 +08:00
* feat(docs): rebuild documentation with the Paper design system * fix(docs): verify nested tabs and fresh-checkout CI setup * chore(docs): refresh preservation evidence against latest staging * fix(docs): align shared navigation and controls with Paper * fix(docs): share active heading across responsive outlines * fix(docs): track the final section at the end of the page * fix(docs): preserve sidebar scroll in a persistent layout * fix(docs): restore live screenshot backgrounds and framing * fix(docs): finish layout polish and clean implementation references * fix(docs): align shared dark theme and overlay states * fix(docs): remove dark borders from platform screenshots * test(docs): benchmark production navigation and image delivery in CI * fix(docs): preserve machine content and production reading contracts * fix(docs): retain readable tabs without JavaScript and verify current staging * fix(docs): expose root response schemas and generate clean-checkout types * fix(docs): resolve no-script tabs in the preflight cascade layer * perf(docs): import only the search schema constructors * fix(docs): preserve retrieval excerpts and reduce reading overhead * fix(docs): reuse in-flight intent prefetches during navigation * docs: record production readiness evidence and release requirements * docs: clarify optimizer measurement provenance * docs: preserve latest staging Search assets and compatibility evidence * fix(docs): polish responsive controls and keep search indexing current * test(docs): select the visible API example in browser checks * test(docs): execute native examples against streaming and binary responses * fix(docs): stream native API responses without buffering * test(docs): cover review regressions through public interfaces * fix(docs): preserve accessible examples and gate index publication * fix(docs): finish accessible controls and cached content validation * fix(docs): validate integration parents and report partial search failures * fix(docs): refine navigation and compact sample controls * fix(docs): isolate synchronous corpus validation from HTTP readers * fix(docs): restore Paper interaction styling and verify responsive controls * fix(docs): score each search page once per retrieval source * fix(docs): attribute benchmark metrics to their source document --------- Co-authored-by: Waleed Latif <walif6@gmail.com>
69 lines
2.6 KiB
TypeScript
69 lines
2.6 KiB
TypeScript
#!/usr/bin/env bun
|
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
import { OPENAPI_SPEC_FILES } from '../apps/docs/lib/openapi-specs'
|
|
import { billingOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/billing'
|
|
import { filesAuditOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/files-audit'
|
|
import { knowledgeOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/knowledge'
|
|
import { logsOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/logs'
|
|
import { resourcesOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/resources'
|
|
import { tablesOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/tables'
|
|
import { workflowsOpenApiDocument } from '../apps/sim/lib/api/contracts/v2/openapi/workflows'
|
|
import { formatGeneratedSource } from './format-generated-source'
|
|
import { serializeOpenApiDocument } from './openapi/generator'
|
|
|
|
const ROOT = path.resolve(import.meta.dir, '..')
|
|
const DOCUMENTS = [
|
|
workflowsOpenApiDocument,
|
|
logsOpenApiDocument,
|
|
filesAuditOpenApiDocument,
|
|
tablesOpenApiDocument,
|
|
knowledgeOpenApiDocument,
|
|
billingOpenApiDocument,
|
|
resourcesOpenApiDocument,
|
|
] as const
|
|
|
|
const generatedFiles = DOCUMENTS.map((document) => path.basename(document.output))
|
|
if (JSON.stringify(generatedFiles) !== JSON.stringify(OPENAPI_SPEC_FILES)) {
|
|
throw new Error(
|
|
'OpenAPI generator documents do not match the documentation specification manifest'
|
|
)
|
|
}
|
|
|
|
const args = process.argv.slice(2)
|
|
if (args.some((arg) => arg !== '--check') || args.length > 1) {
|
|
throw new Error('Usage: bun run generate:openapi [--check]')
|
|
}
|
|
|
|
const check = args[0] === '--check'
|
|
const stale: string[] = []
|
|
|
|
for (const definition of DOCUMENTS) {
|
|
const outputPath = path.resolve(ROOT, definition.output)
|
|
const relative = path.relative(ROOT, outputPath)
|
|
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
throw new Error(`OpenAPI output escapes the repository: ${definition.output}`)
|
|
}
|
|
|
|
const generated = formatGeneratedSource(serializeOpenApiDocument(definition), outputPath, ROOT)
|
|
if (check) {
|
|
if (!existsSync(outputPath) || readFileSync(outputPath, 'utf8') !== generated) {
|
|
stale.push(definition.output)
|
|
}
|
|
continue
|
|
}
|
|
writeFileSync(outputPath, generated)
|
|
}
|
|
|
|
if (stale.length > 0) {
|
|
throw new Error(
|
|
`Generated OpenAPI output is stale:\n${stale.map((file) => ` - ${file}`).join('\n')}\nRun bun run generate:openapi.`
|
|
)
|
|
}
|
|
|
|
console.log(
|
|
check
|
|
? `Generated OpenAPI output is current (${DOCUMENTS.length} documents).`
|
|
: `Generated ${DOCUMENTS.length} OpenAPI documents.`
|
|
)
|