Tools / code_generate
code_generate
Generate React/Vue file sets or a standalone static HTML document from a validated UiSchema.
Generated from @oods/foundry 0.10.1
One of the 20 tools your assistant sees by default.
Use it when a schema already exists; use design_compose instead to choose a layout or pipeline_run to compose, validate, render and generate together. Returns versioned artifacts, exact dependencies, required domain handlers and validationReceipt. Supply schema or schemaRef before its 30-minute expiry. profile selects draft/build/release; build performs static checks, while release verifies supplied evidence without rerunning it. options.output selects component/application; options.payloadMode:file returns file references, as does oversized output unless inline. Domain actions require consumer handlers. React and Vue shadcn mappings support components, screen apps and workflow apps. Reference: TOOL-REFERENCE.md#code_generate; full schema: oods://schemas/code_generate.input.json.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
schema | object | no | A structurally valid UiSchema tree to generate code from. UiElement.state branches are checked against the canonical workflow-state vocabulary by the state-contract gate. |
schemaRef | string | no | Reference to a cached UiSchema returned by design.compose. |
framework | "react" | "vue" | "html" | yes | Target framework. HTML uses the same record document renderer as repl render; build checks are static and do not execute a browser. |
profile | "draft" | "build" | "release" | no | Validation profile. See full schema for details. |
releaseEvidence | object | no | Evidence for release. See full schema for details. |
options | object | no | Operation options. |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
componentContracts | object[] | no | Advisory shared-scenario component reports. Each declared obligation is met, unmet or not checked with a reason; browser availability never blocks generation. |
status | "ok" | "error" | yes | Whether code generation succeeded. |
framework | "react" | "vue" | "html" | yes | The target framework that was used. |
artifact | generatedArtifact | no | Primary versioned, content-addressed file-set payload. Present when status is ok and options.payloadMode is inline (the default); with payloadMode file it is written to payload.directory as artifact.json instead. |
payload | object | no | payloadMode file: where the large output was written instead of being returned inline; the directory is beside the saved-schema store (<store>/../payloads/<tool>-<digest>). |
code | string | yes | Deprecated v0 compatibility alias for artifact.files[0].contents. Empty string on error. |
fileExtension | string | yes | Deprecated v0 compatibility alias for the primary generated file extension. |
imports | string[] | yes | Deprecated v0 compatibility alias. Use artifact.dependencies for exact versions and dependency kinds. |
warnings | codegenIssue[] | yes | Non-fatal issues encountered during generation. |
validationReceipt | validationReceipt | yes | Mandatory disclosure of the applied profile, independent policy axes, checks performed, and checks not reached. When generation reaches an artifact, the receipt names its content hash; release receipts retain accepted caller-supplied evidence envelopes for auditability. |
errors | codegenIssue[] | no | Fatal issues that prevented code generation. |
install | object | no | Present on success when the generated code imports @oods packages (react and vue), or mapped team packages: the exact versions it needs and the npm commands that install them, run in the app's directory in order. The @oods packages install from npm. An application's package.json pins the @oods packages its code imports at exact versions, and npm install brings the @oods packages those depend on: @oods/tokens arrives through @oods/component-styles. |
meta | object | no |
A real call
Recorded by this site's harbor run, step react, with the published OODS Foundry
0.10.1.
Its input:
{
"schemaRef": "compose-d6072861",
"framework": "react",
"profile": "build",
"options": {
"output": "application",
"brand": "Harbor",
"theme": "light",
"payloadMode": "file"
}
} Its result, first lines:
{
"status": "ok",
"framework": "react",
"payload": {
"mode": "file",
"directory": "~/.oods-foundry/payloads/code.generate-800e792fc696",
"bytes": 134297,
"files": [
{
"path": "README.md",
"bytes": 743,
"sha256": "ff76faf406015d87e3f30252a34b2d91c2d49aeafb7063d91b299f17fe7e8444"
},
{
"path": "index.html",
"bytes": 335,
"sha256": "34921f4f0b77c5c7ee527d247867a8c497fd698481c792bcd00e9c4166ac1099"
},
{
"path": "package.json",
"bytes": 681,
"sha256": "3bd393e41ac70f8607a84edc50ac38206406ff138f6f3048931173d562b76005"
},
{
"path": "src/App.tsx",
"bytes": 1707,
"sha256": "42f6117dcc3f4136a1d1373b3eb2ac50cc8f686e5fc3cb27c209457d27c10601"
},
{
"path": "src/GeneratedUI.tsx",
"bytes": 13842,
"sha256": "e5d9d92afe97133a982a84567d085ba5a16f704942b28118ec3869bfaa7c19aa"
},
{
"path": "src/app.css",
"bytes": 511,
"sha256": "2db3a558b73956ec7d87fc341bca6415d31b6e9f567c9710a90ded0db9a2df68"
},
{
"path": "src/main.tsx",
"bytes": 160,
"sha256": "44f61db45209da70184e2b43272c8825db1152e7d300df266ed4400da939f579"
},
{
"path": "src/oods-brand-harbor.css",
"bytes": 42272,
"sha256": "4c81c59cb58ebee92438ebe3f34319b3c84cba2c012c361fd835119bdb54f16f"
},
{
"path": "tsconfig.json",
"bytes": 333,
"sha256": "a0c6dad213106eebefcf5e817d07e31a8b6666e4bc678a449b7c578f62f6fb3a"
},
{
"path": "vite.config.mjs",
"bytes": 54,
"sha256": "ba9f5d24cd9f7332074aa5d15af690839bd18252ab8a31e4b47c11f5a2c1cd38"
},
{
"path": "artifact.json",