6-file-codegen.json 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. {
  2. "version": "3.16",
  3. "name": "VL_FullStack_CodeGen_6Files",
  4. "description": "Full-stack code generation for medium-large projects using 6 auxiliary files, default Theme/Theme.vth, and fully parallel VL file generation.",
  5. "registry": {
  6. "params": [
  7. "userRequest(STRING)",
  8. "targetLang(STRING)"
  9. ],
  10. "services": [],
  11. "apis": [],
  12. "components": [],
  13. "vars": [
  14. "$blueprint(OBJECT)",
  15. "$blueprintStr(STRING)",
  16. "$dataSchema(OBJECT)",
  17. "$dataSchemaStr(STRING)",
  18. "$layoutPlan(OBJECT)",
  19. "$layoutPlanStr(STRING)",
  20. "$fileManifest(OBJECT)",
  21. "$fileManifestStr(STRING)",
  22. "$contractSheet(OBJECT)",
  23. "$contractSheetStr(STRING)",
  24. "$stateBehavior(OBJECT)",
  25. "$stateBehaviorStr(STRING)",
  26. "$vdbCode(STRING)",
  27. "$vthCode(STRING)",
  28. "$specValidation(OBJECT)",
  29. "$codeValidation(OBJECT)",
  30. "$repairPlan(OBJECT)"
  31. ],
  32. "files": {
  33. "inputs": [],
  34. "artifacts": [
  35. "Process/Specs/*",
  36. "Database/*",
  37. "Theme/*",
  38. "Services/*",
  39. "Sections/*",
  40. "ExtComponents/*",
  41. "Apps/*"
  42. ]
  43. },
  44. "docs": {
  45. "1": "VL Syntax Rules",
  46. "61": "Agent-100-Blueprint-Prompt",
  47. "62": "Agent-200-DataSchema-Prompt",
  48. "63": "Agent-250-LayoutPlan-Prompt",
  49. "64": "Agent-300-ContractSheet-Prompt",
  50. "65": "Agent-400-StateBehavior-Prompt",
  51. "66": "Agent-450-FileManifest-Prompt",
  52. "67": "Agent-610-VDB-Prompt",
  53. "68": "Agent-620-VTH-Prompt",
  54. "69": "Agent-630-VS-Prompt",
  55. "70": "Agent-640-CP-Prompt",
  56. "71": "Agent-650-SC-Prompt",
  57. "72": "Agent-660-VX-Prompt",
  58. "79": "VL-Aux-6File-Spec"
  59. }
  60. },
  61. "steps": [
  62. {
  63. "id": "ClearFiles_005_ClearExisting",
  64. "meta": {
  65. "title": "0. Clear existing VL files before regeneration"
  66. },
  67. "in": {},
  68. "out": {},
  69. "next": "LLM_GenBlueprint"
  70. },
  71. {
  72. "id": "LLM_GenBlueprint",
  73. "meta": {
  74. "title": "Phase 0: Generate Blueprint (structured requirements)"
  75. },
  76. "in": {
  77. "stream": true,
  78. "docs": [
  79. "1",
  80. "79",
  81. "61"
  82. ],
  83. "max_tokens": 32768,
  84. "messages": [
  85. {
  86. "role": "user",
  87. "content": "User Requirement:"
  88. },
  89. {
  90. "role": "user",
  91. "content": "=userRequest"
  92. },
  93. {
  94. "role": "user",
  95. "content": "Target Language:"
  96. },
  97. {
  98. "role": "user",
  99. "content": "=targetLang || 'zh-CN'"
  100. },
  101. {
  102. "role": "user",
  103. "content": "Generate Blueprint.json. This is the structured requirements file — define projectName, valueDomains, roles, entities, apps (with pages and sections), and features. Follow the 6-file spec precisely. Output ONLY valid JSON."
  104. }
  105. ],
  106. "output_config": {
  107. "format": {
  108. "type": "json_object"
  109. }
  110. }
  111. },
  112. "out": {
  113. "$blueprint": "=_result",
  114. "$blueprintStr": "=_result",
  115. "/Process/Specs/Blueprint.json": "=_result"
  116. },
  117. "next": "Fork_Phase1"
  118. },
  119. {
  120. "id": "Fork_Phase1",
  121. "meta": {
  122. "title": "Phase 1: DataSchema + LayoutPlan + FileManifest (parallel)"
  123. },
  124. "children": [
  125. "LLM_GenDataSchema",
  126. "LLM_GenLayoutPlan",
  127. "LLM_GenFileManifest"
  128. ],
  129. "next": "LLM_GenContractSheet"
  130. },
  131. {
  132. "id": "LLM_GenDataSchema",
  133. "meta": {
  134. "title": "Agent-200 DataSchema"
  135. },
  136. "in": {
  137. "stream": true,
  138. "docs": [
  139. "1",
  140. "79",
  141. "62"
  142. ],
  143. "max_tokens": 32768,
  144. "messages": [
  145. {
  146. "role": "user",
  147. "content": "Blueprint:"
  148. },
  149. {
  150. "role": "user",
  151. "content": "=$blueprintStr"
  152. },
  153. {
  154. "role": "user",
  155. "content": "Generate DataSchema.json. Transform Blueprint entity drafts into precise table structures with VL types, indexes, relations, and testData. Output ONLY valid JSON."
  156. }
  157. ],
  158. "output_config": {
  159. "format": {
  160. "type": "json_object"
  161. }
  162. }
  163. },
  164. "out": {
  165. "$dataSchema": "=_result",
  166. "$dataSchemaStr": "=_result",
  167. "/Process/Specs/DataSchema.json": "=_result"
  168. },
  169. "next": "RETURN"
  170. },
  171. {
  172. "id": "LLM_GenLayoutPlan",
  173. "meta": {
  174. "title": "Agent-250 LayoutPlan"
  175. },
  176. "in": {
  177. "stream": true,
  178. "docs": [
  179. "1",
  180. "79",
  181. "63"
  182. ],
  183. "max_tokens": 32768,
  184. "messages": [
  185. {
  186. "role": "user",
  187. "content": "Blueprint:"
  188. },
  189. {
  190. "role": "user",
  191. "content": "=$blueprintStr"
  192. },
  193. {
  194. "role": "user",
  195. "content": "Generate LayoutPlan.json. Define app layouts (layoutTree with containers, sections, conditionalViews, modals), section structure sketches, and extracted components. Pure visual structure — no data flow. Each app entry MUST include filePath for the final .vx file. Output ONLY valid JSON."
  196. }
  197. ],
  198. "output_config": {
  199. "format": {
  200. "type": "json_object"
  201. }
  202. }
  203. },
  204. "out": {
  205. "$layoutPlan": "=_result",
  206. "$layoutPlanStr": "=_result",
  207. "/Process/Specs/LayoutPlan.json": "=_result"
  208. },
  209. "next": "RETURN"
  210. },
  211. {
  212. "id": "LLM_GenFileManifest",
  213. "meta": {
  214. "title": "Agent-450 FileManifest"
  215. },
  216. "in": {
  217. "stream": true,
  218. "docs": [
  219. "1",
  220. "79",
  221. "66"
  222. ],
  223. "max_tokens": 32768,
  224. "messages": [
  225. {
  226. "role": "user",
  227. "content": "Blueprint:"
  228. },
  229. {
  230. "role": "user",
  231. "content": "=$blueprintStr"
  232. },
  233. {
  234. "role": "user",
  235. "content": "Generate FileManifest.json. Enumerate all VL files (vdb, vth, vs, cp, sc, vx) with paths, types, generatedBy, sourceId, dependsOn, and inter-file references. REQUIRED top-level fields: files([{path,type,sourceId}]), references([{from,to,refType}]). Use format: databaseFile, themeFile, serviceFiles, componentFiles, sectionFiles, appFiles for compatibility. CRITICAL naming rules: databaseFile.path MUST be Database/<ProjectName>.vdb and themeFile.path MUST be Theme/Theme.vth. Every service/component/section/app file must include its exact final filePath. Output ONLY valid JSON."
  236. }
  237. ],
  238. "output_config": {
  239. "format": {
  240. "type": "json_object"
  241. }
  242. }
  243. },
  244. "out": {
  245. "$fileManifest": "=_result",
  246. "$fileManifestStr": "=_result",
  247. "/Process/Specs/FileManifest.json": "=_result"
  248. },
  249. "next": "RETURN"
  250. },
  251. {
  252. "id": "LLM_GenContractSheet",
  253. "meta": {
  254. "title": "Phase 2: ContractSheet (depends on DataSchema)"
  255. },
  256. "in": {
  257. "stream": true,
  258. "docs": [
  259. "1",
  260. "79",
  261. "64"
  262. ],
  263. "max_tokens": 32768,
  264. "messages": [
  265. {
  266. "role": "user",
  267. "content": "Blueprint:"
  268. },
  269. {
  270. "role": "user",
  271. "content": "=$blueprintStr"
  272. },
  273. {
  274. "role": "user",
  275. "content": "DataSchema:"
  276. },
  277. {
  278. "role": "user",
  279. "content": "=$dataSchemaStr"
  280. },
  281. {
  282. "role": "user",
  283. "content": "Generate ContractSheet.json. Define: serviceDomains (with VirtualTable declarations and service signatures), sectionContracts (publicProps, publicEvents, publicMethods, consumesServices), componentContracts. All output types must be precise to field level. Output ONLY valid JSON."
  284. }
  285. ],
  286. "output_config": {
  287. "format": {
  288. "type": "json_object"
  289. }
  290. }
  291. },
  292. "out": {
  293. "$contractSheet": "=_result",
  294. "$contractSheetStr": "=_result",
  295. "/Process/Specs/ContractSheet.json": "=_result"
  296. },
  297. "next": "LLM_GenStateBehavior"
  298. },
  299. {
  300. "id": "LLM_GenStateBehavior",
  301. "meta": {
  302. "title": "Phase 3: StateBehavior (depends on ContractSheet + LayoutPlan)"
  303. },
  304. "in": {
  305. "stream": true,
  306. "docs": [
  307. "1",
  308. "79",
  309. "65"
  310. ],
  311. "max_tokens": 32768,
  312. "messages": [
  313. {
  314. "role": "user",
  315. "content": "Blueprint:"
  316. },
  317. {
  318. "role": "user",
  319. "content": "=$blueprintStr"
  320. },
  321. {
  322. "role": "user",
  323. "content": "ContractSheet:"
  324. },
  325. {
  326. "role": "user",
  327. "content": "=$contractSheetStr"
  328. },
  329. {
  330. "role": "user",
  331. "content": "LayoutPlan:"
  332. },
  333. {
  334. "role": "user",
  335. "content": "=$layoutPlanStr"
  336. },
  337. {
  338. "role": "user",
  339. "content": "Generate StateBehavior.json. Define: appStates (global vars, initSequence), sectionBehaviors (keyStates, serviceBindings, initBehavior, internalMethods), eventWiring (cross-module events with handler steps), modalTriggers. keyStates types must match service output types. Output ONLY valid JSON."
  340. }
  341. ],
  342. "output_config": {
  343. "format": {
  344. "type": "json_object"
  345. }
  346. }
  347. },
  348. "out": {
  349. "$stateBehavior": "=_result",
  350. "$stateBehaviorStr": "=_result",
  351. "/Process/Specs/StateBehavior.json": "=_result"
  352. },
  353. "next": "Set_390_SkipSpecValidation"
  354. },
  355. {
  356. "id": "Set_390_SkipSpecValidation",
  357. "meta": {
  358. "title": "Skip spec validation (generation-only mode)"
  359. },
  360. "target": "$specValidation",
  361. "value": "={\"success\":true,\"skipped\":true,\"reason\":\"validation disabled\"}",
  362. "next": "Fork_CodeGen"
  363. },
  364. {
  365. "id": "Fork_CodeGen",
  366. "meta": {
  367. "title": "Phase 4: Seed default Theme + generate all VL code in parallel"
  368. },
  369. "children": [
  370. "LLM_GenVDB",
  371. "SeedTheme_GenVTH",
  372. "Loop_GenVS",
  373. "Loop_GenCP",
  374. "Loop_GenSC",
  375. "Loop_GenVX"
  376. ],
  377. "next": "Set_590_SkipCodeValidation"
  378. },
  379. {
  380. "id": "LLM_GenVDB",
  381. "meta": {
  382. "title": "Generate .vdb Database"
  383. },
  384. "in": {
  385. "stream": true,
  386. "docs": [
  387. "1",
  388. "79",
  389. "67"
  390. ],
  391. "max_tokens": 32768,
  392. "messages": [
  393. {
  394. "role": "user",
  395. "content": "Blueprint (valueDomains):"
  396. },
  397. {
  398. "role": "user",
  399. "content": "=$blueprintStr"
  400. },
  401. {
  402. "role": "user",
  403. "content": "DataSchema:"
  404. },
  405. {
  406. "role": "user",
  407. "content": "=$dataSchemaStr"
  408. },
  409. {
  410. "role": "user",
  411. "content": "Generate complete VL .vdb source code based on DataSchema entities, relations, and testData. Output ONLY VL source code, no markdown fences."
  412. }
  413. ]
  414. },
  415. "out": {
  416. "$vdbCode": "=_result",
  417. "/{$fileManifest.databaseFile.path || ('Database/' + $blueprint.projectName + '.vdb')}": "=_result"
  418. },
  419. "onError": "skip",
  420. "next": "RETURN"
  421. },
  422. {
  423. "id": "SeedTheme_GenVTH",
  424. "meta": {
  425. "title": "Seed default Theme/Theme.vth"
  426. },
  427. "in": {
  428. "path": "Theme/Theme.vth"
  429. },
  430. "out": {
  431. "$vthCode": "=_result",
  432. "/{$fileManifest.themeFile.path || 'Theme/Theme.vth'}": "=_result"
  433. },
  434. "next": "RETURN"
  435. },
  436. {
  437. "id": "Loop_GenVS",
  438. "meta": {
  439. "title": "Generate all .vs Service Domains (parallel)"
  440. },
  441. "mode": "parallel",
  442. "source": "=$contractSheet.serviceDomains",
  443. "children": [
  444. "LLM_GenVSFile"
  445. ],
  446. "next": "RETURN"
  447. },
  448. {
  449. "id": "LLM_GenVSFile",
  450. "meta": {
  451. "title": "Generate .vs Service"
  452. },
  453. "in": {
  454. "stream": true,
  455. "docs": [
  456. "1",
  457. "79",
  458. "69"
  459. ],
  460. "max_tokens": 32768,
  461. "messages": [
  462. {
  463. "role": "user",
  464. "content": "Service Domain:"
  465. },
  466. {
  467. "role": "user",
  468. "content": "=_item"
  469. },
  470. {
  471. "role": "user",
  472. "content": "Blueprint (valueDomains):"
  473. },
  474. {
  475. "role": "user",
  476. "content": "=$blueprintStr"
  477. },
  478. {
  479. "role": "user",
  480. "content": "DataSchema:"
  481. },
  482. {
  483. "role": "user",
  484. "content": "=$dataSchemaStr"
  485. },
  486. {
  487. "role": "user",
  488. "content": "Generate complete VL .vs source code. Include VirtualTables and all service methods. Output ONLY VL source code, no markdown fences."
  489. }
  490. ]
  491. },
  492. "out": {
  493. "/{_item.filePath}": "=_result"
  494. },
  495. "onError": "skip",
  496. "next": "RETURN"
  497. },
  498. {
  499. "id": "Loop_GenCP",
  500. "meta": {
  501. "title": "Generate all .cp Components (parallel)"
  502. },
  503. "mode": "parallel",
  504. "source": "=$contractSheet.componentContracts",
  505. "children": [
  506. "LLM_GenCPFile"
  507. ],
  508. "next": "RETURN"
  509. },
  510. {
  511. "id": "LLM_GenCPFile",
  512. "meta": {
  513. "title": "Generate .cp Component"
  514. },
  515. "in": {
  516. "stream": true,
  517. "docs": [
  518. "1",
  519. "79",
  520. "70"
  521. ],
  522. "max_tokens": 32768,
  523. "messages": [
  524. {
  525. "role": "user",
  526. "content": "Component Contract:"
  527. },
  528. {
  529. "role": "user",
  530. "content": "=_item"
  531. },
  532. {
  533. "role": "user",
  534. "content": "Blueprint (valueDomains):"
  535. },
  536. {
  537. "role": "user",
  538. "content": "=$blueprintStr"
  539. },
  540. {
  541. "role": "user",
  542. "content": "LayoutPlan (preview sizes):"
  543. },
  544. {
  545. "role": "user",
  546. "content": "=$layoutPlanStr"
  547. },
  548. {
  549. "role": "user",
  550. "content": "Generate complete VL .cp source code. Pure UI component — NO service calls. Output ONLY VL source code, no markdown fences."
  551. }
  552. ]
  553. },
  554. "out": {
  555. "/{_item.filePath}": "=_result"
  556. },
  557. "onError": "skip",
  558. "next": "RETURN"
  559. },
  560. {
  561. "id": "Loop_GenSC",
  562. "meta": {
  563. "title": "Generate all .sc Sections (parallel)"
  564. },
  565. "mode": "parallel",
  566. "source": "=$contractSheet.sectionContracts",
  567. "children": [
  568. "LLM_GenSCFile"
  569. ],
  570. "next": "RETURN"
  571. },
  572. {
  573. "id": "LLM_GenSCFile",
  574. "meta": {
  575. "title": "Generate .sc Section"
  576. },
  577. "in": {
  578. "stream": true,
  579. "docs": [
  580. "1",
  581. "79",
  582. "71"
  583. ],
  584. "max_tokens": 32768,
  585. "messages": [
  586. {
  587. "role": "user",
  588. "content": "Section Contract:"
  589. },
  590. {
  591. "role": "user",
  592. "content": "=_item"
  593. },
  594. {
  595. "role": "user",
  596. "content": "ContractSheet (service signatures):"
  597. },
  598. {
  599. "role": "user",
  600. "content": "=$contractSheetStr"
  601. },
  602. {
  603. "role": "user",
  604. "content": "LayoutPlan (section structure):"
  605. },
  606. {
  607. "role": "user",
  608. "content": "=$layoutPlanStr"
  609. },
  610. {
  611. "role": "user",
  612. "content": "StateBehavior (state + bindings):"
  613. },
  614. {
  615. "role": "user",
  616. "content": "=$stateBehaviorStr"
  617. },
  618. {
  619. "role": "user",
  620. "content": "Blueprint (valueDomains):"
  621. },
  622. {
  623. "role": "user",
  624. "content": "=$blueprintStr"
  625. },
  626. {
  627. "role": "user",
  628. "content": "Generate complete VL .sc source code. Section handles business logic and service calls. Output ONLY VL source code, no markdown fences."
  629. }
  630. ]
  631. },
  632. "out": {
  633. "/{_item.filePath}": "=_result"
  634. },
  635. "onError": "skip",
  636. "next": "RETURN"
  637. },
  638. {
  639. "id": "Loop_GenVX",
  640. "meta": {
  641. "title": "Generate all .vx Apps (parallel)"
  642. },
  643. "mode": "parallel",
  644. "source": "=$layoutPlan.apps",
  645. "children": [
  646. "LLM_GenVXFile"
  647. ],
  648. "next": "RETURN"
  649. },
  650. {
  651. "id": "LLM_GenVXFile",
  652. "meta": {
  653. "title": "Generate .vx App"
  654. },
  655. "in": {
  656. "stream": true,
  657. "docs": [
  658. "1",
  659. "79",
  660. "72"
  661. ],
  662. "max_tokens": 32768,
  663. "messages": [
  664. {
  665. "role": "user",
  666. "content": "App Layout:"
  667. },
  668. {
  669. "role": "user",
  670. "content": "=_item"
  671. },
  672. {
  673. "role": "user",
  674. "content": "ContractSheet (section interfaces):"
  675. },
  676. {
  677. "role": "user",
  678. "content": "=$contractSheetStr"
  679. },
  680. {
  681. "role": "user",
  682. "content": "StateBehavior (event wiring):"
  683. },
  684. {
  685. "role": "user",
  686. "content": "=$stateBehaviorStr"
  687. },
  688. {
  689. "role": "user",
  690. "content": "Blueprint (valueDomains):"
  691. },
  692. {
  693. "role": "user",
  694. "content": "=$blueprintStr"
  695. },
  696. {
  697. "role": "user",
  698. "content": "Generate complete VL .vx source code. App manages routing, section placement, and cross-section event wiring. Output ONLY VL source code, no markdown fences."
  699. }
  700. ]
  701. },
  702. "out": {
  703. "/{_item.filePath || ('Apps/' + _item.appId + '.vx')}": "=_result"
  704. },
  705. "onError": "skip",
  706. "next": "RETURN"
  707. },
  708. {
  709. "id": "Set_590_SkipCodeValidation",
  710. "meta": {
  711. "title": "Phase 5: Skip generated-code validation"
  712. },
  713. "target": "$codeValidation",
  714. "value": "={\"success\":true,\"skipped\":true,\"reason\":\"validation disabled\"}",
  715. "next": "Stop_Done"
  716. },
  717. {
  718. "id": "Stop_Done",
  719. "meta": {
  720. "title": "Code Generation Complete"
  721. }
  722. }
  723. ]
  724. }