Official Codebase of 3DCodeVerse
Python
Plugin: skills state the real 3dcode flags, scene.js marks zone roots itself, validate-plan writes scene_blender's src/scene.py, init names the hyphenated skill
gaoypeng82c2f179330e
diff --git a/harness/CLAUDE.md b/harness/CLAUDE.mdindex a7e0dc2a..24a82c55 100644--- a/harness/CLAUDE.md+++ b/harness/CLAUDE.md@@ -64,7 +64,7 @@ There is no CI: run `ruff check codeverse3d` and the smoke scripts under```bash setup.sh # python package + runtime_js + chrome + doctorpython -m codeverse3d.doctor [--json]-3dcode init --workspace W --track static_object --language blender --prompt "a dining chair" [--must ...] [--dim height=0.45] [--reference img.png]+3dcode init --workspace W --track static_object --language blender --prompt "a dining chair" [--must-have ...] [--dims height=0.45] [--references img.png]3dcode validate-plan --workspace W3dcode build | check | judge-pack --round N | score --round N (always --workspace W; --json for JSON)3dcode measure | check-contract | check-connectivity | cross-section | render-views | render-sheet | isolate | compare-reference | joint-sweepdiff --git a/harness/codeverse3d/workflow.py b/harness/codeverse3d/workflow.pyindex 22f305ae..aebcbb89 100644--- a/harness/codeverse3d/workflow.py+++ b/harness/codeverse3d/workflow.py@@ -19,8 +19,9 @@ from pydantic import BaseModel, Field, ValidationErrorfrom codeverse3d.config import get_settingsfrom codeverse3d.contracts.artifacts import GateReport, Judgment, RenderSet, Severityfrom codeverse3d.contracts.common import ENTRY_FILE, TRACK_LANGUAGES, TRACK_RUBRIC, Language, Track+from codeverse3d.contracts.plan import ScenePlanfrom codeverse3d.contracts.spec import Constraints, ReferenceImage, Spec-from codeverse3d.conventions import LANGUAGE_FRAME, frame_doc+from codeverse3d.conventions import LANGUAGE_FRAME, frame_doc, to_snakefrom codeverse3d.gates import PLAN_MODELS, CheckResult, render_for_judge, run_checkfrom codeverse3d.jsonparse import JsonParseError, parse_json_lenientfrom codeverse3d.judges import prompt_builder as pb@@ -134,7 +135,7 @@ def init(ctx: ToolContext, args: InitArgs) -> Observation:lib = getattr(rt, "lib_interface", None)if callable(lib) and (surface := lib(ws)):lines.append("library surface (src/lib):\n" + surface)- lines.append(f"next: read the skill 3d-lang-{language.value}, write plan.json, run `3dcode validate-plan`")+ lines.append(f"next: read the skill 3d-lang-{language.value.replace("_", "-")}, write plan.json, run `3dcode validate-plan`")return text_observation(lines, numbers={"track": track.value, "language": language.value, "workspace": str(ws.root),"entry": ENTRY_FILE[language], "owned_files": [rel_path(p, ws.root) for p in owned]},limit=6000)@@ -197,6 +198,16 @@ def validate_plan(ctx: ToolContext, args: NoArgs) -> Observation:hard, soft = plan_quality_complaints(plan, budget, unit=unit) if unit != "zones" else ([], [])notes = normalise_plan(plan, spec)ws.write_json(ws.plan_path, plan)+ if spec.language is Language.SCENE_BLENDER and isinstance(plan, ScenePlan):+ # src/scene.py is data the build reads (ZONES / ASSETS / HEROES / CAMERAS), so it follows the plan+ from codeverse3d.languages.scene_blender import render_scene_py++ (ws.src / "scene.py").write_text(render_scene_py(+ [to_snake(z.name) for z in plan.zones],+ [to_snake(a.name) for a in plan.assets if a.kind != "blender_glb"],+ [to_snake(a.name) for a in plan.assets if a.kind == "blender_glb"],+ list(plan.cameras[:6]), title=plan.title, summary=plan.summary))+ notes.append("src/scene.py written from the plan")rt = get_runtime(spec.language)files = rt.expected_files(plan)units = list(getattr(plan, unit, None) or [])diff --git a/harness/docs/ARCHITECTURE.md b/harness/docs/ARCHITECTURE.mdindex 8e151a6b..3ed634a4 100644--- a/harness/docs/ARCHITECTURE.md+++ b/harness/docs/ARCHITECTURE.md@@ -90,7 +90,7 @@ python function + argparse subcommand (kebab-case; a list argument is a repeated| subcommand | tracks | does ||---|---|---|-| `init --track --language --prompt [--must]* [--must-not]* [--dim k=v]* [--reference path]*` | all | writes `spec.json`, the layout and the language's starter files; prints the entry files and the skill to read |+| `init --track --language --prompt [--must-have]* [--must-not]* [--dims k=v]* [--references path]*` | all | writes `spec.json`, the layout and the language's starter files; prints the entry files and the skill to read || `validate-plan` | all | validates `plan.json` against the track's plan model + the deterministic plan checks (placeholder echo, hard quality complaints, acceptance present, fixed-part clash); writes the normalised plan back; FAIL lists each error with its JSON path || `build` | all | lint + build with the language runtime, export, measure; `artifacts/build.json` || `check` | all | build + measure + every gate of the track → `artifacts/gates.json`; the round's verdict |diff --git a/harness/skills/3d-director/SKILL.md b/harness/skills/3d-director/SKILL.mdindex 37eb3d23..b2a44eb2 100644--- a/harness/skills/3d-director/SKILL.md+++ b/harness/skills/3d-director/SKILL.md@@ -68,8 +68,8 @@ read one when its description matches your plan or a finding.## The loop1. **Init.** `3dcode init --workspace W --track T --language L --prompt "..."` with- `--must "..."` / `--must-not "..."` per hard requirement, `--dim height=0.45` per stated- dimension, `--reference img.png` per reference image. It prints the entry files and the+ `--must-have "..."` / `--must-not "..."` per hard requirement, `--dims height=0.45` per stated+ dimension, `--references img.png` per reference image. It prints the entry files and theskill to read. Then `git -C W init` if the workspace is not a repository.2. **Plan.** Write `plan.json` by `references/plan-<track>.md` (exact numbers, acceptancechecklist), then `3dcode validate-plan --workspace W` until it prints PASS; FAIL lists eachdiff --git a/harness/skills/3d-lang-scene-blender/SKILL.md b/harness/skills/3d-lang-scene-blender/SKILL.mdindex 9dbe6250..a7cf83d8 100644--- a/harness/skills/3d-lang-scene-blender/SKILL.md+++ b/harness/skills/3d-lang-scene-blender/SKILL.md@@ -15,7 +15,7 @@ into the Collection you are handed.## Files (Z up, −Y front, metres)```-src/scene.py ASSEMBLED BY THE BUILD from plan.json — data only (ZONES / ASSETS / HEROES / CAMERAS); never edit it+src/scene.py written by `3dcode validate-plan` from plan.json — data only (ZONES / ASSETS / HEROES / CAMERAS); never edit it, re-run validate-plan after a plan changesrc/env.py def height_at(x, y) -> z def build_env(ctx) -> dict (world, light, ground, atmosphere; an interior's shell)src/zones/<snake>.py def build(ctx) -> bpy.types.Collection (everything linked into ctx.collection, the zone's own)src/assets/<snake>.py def build_<snake>(ctx, variant=0) -> bpy.types.Collection (ONCE at the origin, base on z = 0, front −Y)diff --git a/harness/skills/3d-lang-scene-threejs/references/interface.md b/harness/skills/3d-lang-scene-threejs/references/interface.mdindex 2d811ada..bdc02351 100644--- a/harness/skills/3d-lang-scene-threejs/references/interface.md+++ b/harness/skills/3d-lang-scene-threejs/references/interface.md@@ -1,7 +1,7 @@# The wiring (the interface, nothing else)-`src/scene.js` is the only caller of your modules; `3dcode init` copies a starter with this-shape — keep it and fill the camera list from the plan:+`src/scene.js` is the only caller of your modules; write it in this shape, the camera list from the+plan, and mark every zone root with `userData.c3d_zone` (placement and the judge find zones by it):```jsimport * as THREE from 'three';import { buildEnv, heightAt } from './env.js';@@ -11,7 +11,7 @@ export async function createScene({ THREE, renderer, loaders }) {const assets = {}; // ctx.assets['<snake>'] ← each public/assets/<snake>.glb via loaders.gltfconst ctx = { THREE, scene, renderer, loaders, heightAt, assets };const env = (await buildEnv(ctx)) || {}; ctx.env = env; // ONE argument: ctx- const zones = [await buildQuay(ctx)]; for (const g of zones) scene.add(g); // each a Group / Object3D+ const zones = [await buildQuay(ctx)]; for (const g of zones) { g.userData.c3d_zone = g.name; scene.add(g); }const cameras = [{ name: 'Establishing', position: [0, 1.7, 30], lookAt: [0, 2, 0], fov: 50 }]; // the plan's listfunction update(t, dt) { if (env.update) env.update(t, dt); for (const z of zones) if (z.userData.update) z.userData.update(t, dt); }return { scene, cameras, update };@@ -26,7 +26,7 @@ export function heightAt(x, z) { return 0; } // the brief's surface — any fuexport function buildEnv({ THREE, scene }) {// the brief's sky, light, ground (a mesh named 'Ground…' sampled from heightAt) and atmosphere:// scene.fog + scene.background set (no_fog / no_background), scene.environment an env texture- return { update(t, dt) {} }; // the ONLY env hook the assembler calls+ return { update(t, dt) {} }; // the ONLY env hook scene.js calls}```