pi-apexlang 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/README.md +22 -5
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/UPSTREAM.json +2 -2
  4. package/docs/assets/overview.en.png +0 -0
  5. package/docs/assets/overview.en.svg +89 -0
  6. package/docs/assets/overview.uk.png +0 -0
  7. package/docs/assets/overview.uk.svg +89 -0
  8. package/docs/en/README.md +41 -0
  9. package/docs/en/architecture.md +73 -0
  10. package/docs/en/getting-started.md +77 -0
  11. package/docs/en/maintenance.md +83 -0
  12. package/docs/en/tool-reference.md +85 -0
  13. package/docs/uk/README.md +41 -0
  14. package/docs/uk/architecture.md +73 -0
  15. package/docs/uk/getting-started.md +77 -0
  16. package/docs/uk/maintenance.md +83 -0
  17. package/docs/uk/tool-reference.md +85 -0
  18. package/extensions/apexlang/index.ts +19 -10
  19. package/extensions/lib/apexlang-cli.d.mts +1 -2
  20. package/extensions/lib/apexlang-cli.mjs +18 -13
  21. package/extensions/lib/apexlang-local-validate.mjs +83 -0
  22. package/extensions/lib/apexlang-local-validator.py +116 -0
  23. package/extensions/lib/apexlang-runtime-validate.mjs +76 -0
  24. package/package.json +2 -1
  25. package/skills/apexlang/APEXlang Skills and Workflows.md +325 -0
  26. package/skills/apexlang/README.md +6 -6
  27. package/skills/apexlang/RELEASE-NOTES.md +2 -2
  28. package/skills/apexlang/SKILL.md +24 -19
  29. package/skills/apexlang/agents/openai.yaml +4 -3
  30. package/skills/apexlang/assets/apex-generation/components.registry.json +1001 -16
  31. package/skills/apexlang/assets/apexlang/domains-catalog.json +6 -1
  32. package/skills/apexlang/assets/component-attributes.json +1924 -180
  33. package/skills/apexlang/assets/component-policies.json +19 -10
  34. package/skills/apexlang/assets/contracts/grammar-semantic-rules.json +134 -0
  35. package/skills/apexlang/assets/contracts/package-layers.json +56 -0
  36. package/skills/apexlang/assets/contracts/page-construction-packs.json +154 -0
  37. package/skills/apexlang/assets/contracts/page-patterns.json +119 -0
  38. package/skills/apexlang/assets/grammar/apexlang.ebnf +11743 -0
  39. package/skills/apexlang/assets/indexes/font-apex-icon-index.json +1699 -0
  40. package/skills/apexlang/assets/routing-catalog-main.json +11 -10
  41. package/skills/apexlang/assets/routing-load-policy.json +35 -9
  42. package/skills/apexlang/assets/rules-mapping.json +110 -2
  43. package/skills/apexlang/assets/rules.catalog.json +1298 -0
  44. package/skills/apexlang/assets/validator-fix-recipes.json +372 -17
  45. package/skills/apexlang/assets/workspace-intelligence.json +7 -10
  46. package/skills/apexlang/manifest.json +268 -12
  47. package/skills/apexlang/references/domains/README.md +1 -1
  48. package/skills/apexlang/references/domains/page-components/buttons.md +2 -2
  49. package/skills/apexlang/references/domains/page-components/page-items.md +3 -3
  50. package/skills/apexlang/references/domains/page-components/regions/region-display-selector/workflow-region-display-selector.md +69 -0
  51. package/skills/apexlang/references/domains/page-components/regions.md +1 -0
  52. package/skills/apexlang/references/domains/template-components/comments.md +61 -0
  53. package/skills/apexlang/references/domains/template-components/registry.md +2 -0
  54. package/skills/apexlang/references/domains/template-components/templates.md +47 -0
  55. package/skills/apexlang/references/domains/template-components/timeline.md +51 -0
  56. package/skills/apexlang/references/ops/one-message-router-contract.md +2 -2
  57. package/skills/apexlang/references/ops/runtime-gates/01-direct-sqlcl-import.md +1 -1
  58. package/skills/apexlang/references/ops/runtime-gates/02-direct-sqlcl-validate-gate.md +1 -1
  59. package/skills/apexlang/references/ops/runtime-gates.md +17 -16
  60. package/skills/apexlang/references/ops/sqlcl-agents/00-connection-gate.md +7 -7
  61. package/skills/apexlang/references/ops/sqlcl.md +7 -8
  62. package/skills/apexlang/references/policies/compiler-prop-map.md +6 -4
  63. package/skills/apexlang/references/policies/governance/00-governance.md +2 -2
  64. package/skills/apexlang/references/policies/memory-bank/00-guard/ai.guard.md +126 -922
  65. package/skills/apexlang/references/policies/memory-bank/20-data/apex.logic.md +3 -3
  66. package/skills/apexlang/references/policies/memory-bank/20-data/db.connection.md +9 -11
  67. package/skills/apexlang/references/policies/memory-bank/30-pages/apex.cards-page.md +95 -0
  68. package/skills/apexlang/references/policies/memory-bank/30-pages/apex.page.md +2 -2
  69. package/skills/apexlang/references/policies/memory-bank/30-pages/apex.smart-filter-search.md +145 -74
  70. package/skills/apexlang/references/policies/memory-bank/40-components/apex.region-interactions.md +9 -2
  71. package/skills/apexlang/references/policies/memory-bank/40-components/apex.region-media.md +6 -5
  72. package/skills/apexlang/references/policies/memory-bank/systemPatterns.md +9 -1
  73. package/skills/apexlang/references/workflows/apex-generation/agents/20-agent-draft.md +51 -232
  74. package/skills/apexlang/references/workflows/apex-generation/agents/30-agent-critique.md +49 -449
  75. package/skills/apexlang/references/workflows/apex-generation/agents/40-agent-revision.md +38 -238
  76. package/skills/apexlang/references/workflows/apex-generation/nlu/nlu-routing-test-matrix.md +8 -2
  77. package/skills/apexlang/references/workflows/apex-generation/nlu/nlu-routing-validation-notes.md +19 -3
  78. package/skills/apexlang/references/workflows/apex-generation/registry.md +15 -1
  79. package/skills/apexlang/references/workflows/apex-generation/templates.md +1 -1
  80. package/skills/apexlang/references/workflows/apex-generation.md +1 -1
  81. package/skills/apexlang/references/workflows/apexlang/apexlang-execution-model.md +5 -5
  82. package/skills/apexlang/references/workflows/apexlang/prompt-contracts.md +81 -10
  83. package/skills/apexlang/references/workflows/apexlang/workflow-create-app-from-fr-and-model.md +18 -7
  84. package/skills/apexlang/release-notes.json +156 -0
  85. package/skills/apexlang/runtime/grammar_contract.mjs +1166 -0
  86. package/skills/apexlang/runtime/internal/python/format_apexlang.py +210 -0
  87. package/skills/apexlang/runtime/internal/python/validate_apexlang.py +14142 -5843
  88. package/skills/apexlang/runtime/internal/python/validator_common.py +2 -0
  89. package/skills/apexlang/runtime/lib/catalogs.mjs +1026 -0
  90. package/skills/apexlang/runtime/lib/common.mjs +35 -0
  91. package/skills/apexlang/runtime/runtime.bundle.mjs +457 -57
  92. package/skills/apexlang/templates/items/combobox/combobox.explicit-defaults.md +1 -1
  93. package/skills/apexlang/templates/items/date-picker/date-picker._common.md +1 -1
  94. package/skills/apexlang/templates/items/date-picker/date-picker.explicit-defaults.md +1 -1
  95. package/skills/apexlang/templates/items/file-upload/file-upload._common.md +30 -24
  96. package/skills/apexlang/templates/items/file-upload/file-upload.compact-template.md +6 -0
  97. package/skills/apexlang/templates/items/file-upload/file-upload.explicit-defaults.md +23 -8
  98. package/skills/apexlang/templates/items/file-upload/file-upload.minimal.md +6 -0
  99. package/skills/apexlang/templates/items/hidden-item/hidden-item._common.md +1 -1
  100. package/skills/apexlang/templates/items/hidden-item/hidden-item.explicit-defaults.md +1 -1
  101. package/skills/apexlang/templates/items/items._common.md +3 -2
  102. package/skills/apexlang/templates/items/list-manager/list-manager.explicit-defaults.md +1 -1
  103. package/skills/apexlang/templates/items/markdown-editor/markdown-editor._common.md +1 -1
  104. package/skills/apexlang/templates/items/markdown-editor/markdown-editor.explicit-defaults.md +1 -1
  105. package/skills/apexlang/templates/items/number-field/number-field._common.md +8 -6
  106. package/skills/apexlang/templates/items/number-field/number-field.explicit-defaults.md +12 -2
  107. package/skills/apexlang/templates/items/popup-lov/popup-lov.explicit-defaults.md +1 -1
  108. package/skills/apexlang/templates/items/rich-text-editor/rich-text-editor._common.md +1 -1
  109. package/skills/apexlang/templates/items/rich-text-editor/rich-text-editor.explicit-defaults.md +1 -1
  110. package/skills/apexlang/templates/items/select-many/standard.md +1 -1
  111. package/skills/apexlang/templates/items/shuttle/shuttle.explicit-defaults.md +1 -1
  112. package/skills/apexlang/templates/items/switch/switch._common.md +8 -8
  113. package/skills/apexlang/templates/items/switch/switch.explicit-defaults.md +1 -1
  114. package/skills/apexlang/templates/items/text-area/text-area._common.md +2 -3
  115. package/skills/apexlang/templates/items/text-area/text-area.explicit-defaults.md +1 -1
  116. package/skills/apexlang/templates/items/text-area/text-area.required-length.md +1 -3
  117. package/skills/apexlang/templates/items/text-autocomplete/text-autocomplete.explicit-defaults.md +1 -1
  118. package/skills/apexlang/templates/items/text-autocomplete/text-autocomplete.required-length.md +1 -3
  119. package/skills/apexlang/templates/items/text-field/text-field._common.md +2 -3
  120. package/skills/apexlang/templates/items/text-field/text-field.explicit-defaults.md +1 -1
  121. package/skills/apexlang/templates/items/text-field/text-field.required-length.md +1 -3
  122. package/skills/apexlang/templates/page-examples/faceted-search/faceted-search.example.md +0 -5
  123. package/skills/apexlang/templates/page-examples/form-page/form-page.example.md +0 -9
  124. package/skills/apexlang/templates/page-examples/interactive-report-page/interactive-report-page.example.md +2 -2
  125. package/skills/apexlang/templates/page-examples/login-page/login-page.example.md +0 -8
  126. package/skills/apexlang/templates/page-examples/task-definition-initiated-tasks-page/task-definition-initiated-tasks-page.example.md +7 -17
  127. package/skills/apexlang/templates/page-examples/task-definition-my-tasks-page/task-definition-my-tasks-page.example.md +7 -65
  128. package/skills/apexlang/templates/page-examples/task-definition-task-details/task-definition-task-details.example.md +38 -201
  129. package/skills/apexlang/templates/region-components/calendar/calendar.custom-styling.md +3 -1
  130. package/skills/apexlang/templates/region-components/calendar/calendar.faceted-search.md +3 -2
  131. package/skills/apexlang/templates/region-components/cards/README.md +12 -4
  132. package/skills/apexlang/templates/region-components/cards/cards._common.md +176 -37
  133. package/skills/apexlang/templates/region-components/cards/cards._index.md +2 -1
  134. package/skills/apexlang/templates/region-components/cards/cards.refresh-after-dialog.md +46 -0
  135. package/skills/apexlang/templates/region-components/cards/cards.refresh-on-change.md +58 -0
  136. package/skills/apexlang/templates/region-components/cards/cards.rest-source.md +54 -18
  137. package/skills/apexlang/templates/region-components/cards/cards.standard.md +37 -21
  138. package/skills/apexlang/templates/region-components/chart/chart._series._common.md +1 -4
  139. package/skills/apexlang/templates/region-components/chart/chart.pie.md +6 -2
  140. package/skills/apexlang/templates/region-components/chart/chart.status-meter-gauge.md +1 -1
  141. package/skills/apexlang/templates/region-components/chart/chart.stock.md +2 -0
  142. package/skills/apexlang/templates/region-components/chart/features/chart.feature-chart-links.md +9 -7
  143. package/skills/apexlang/templates/region-components/faceted-search/faceted-search._common.md +1 -14
  144. package/skills/apexlang/templates/region-components/form/form._items._common.md +1 -5
  145. package/skills/apexlang/templates/region-components/interactive-report/interactive-report._columns._common.md +2 -6
  146. package/skills/apexlang/templates/region-components/interactive-report/interactive-report.page-header-actions.md +1 -7
  147. package/skills/apexlang/templates/region-components/list/README.md +1 -1
  148. package/skills/apexlang/templates/region-components/list/list._common.md +1 -1
  149. package/skills/apexlang/templates/region-components/map/map.backgrounds.md +12 -10
  150. package/skills/apexlang/templates/region-components/map/map.layer.extruded-polygons.md +16 -12
  151. package/skills/apexlang/templates/region-components/map/map.layer.heat-map.md +10 -7
  152. package/skills/apexlang/templates/region-components/map/map.layer.lines.md +10 -8
  153. package/skills/apexlang/templates/region-components/map/map.layer.polygons.md +21 -18
  154. package/skills/apexlang/templates/region-components/map/map.region.background-custom.md +25 -19
  155. package/skills/apexlang/templates/region-components/map/map.region.background-shared.md +19 -13
  156. package/skills/apexlang/templates/region-components/map/map.region.bbox-sql.md +13 -13
  157. package/skills/apexlang/templates/region-components/map/map.region.bbox-static.md +2 -2
  158. package/skills/apexlang/templates/region-components/map/map.region.browser-location.md +3 -7
  159. package/skills/apexlang/templates/region-components/map/map.region.init-position-sql.md +7 -7
  160. package/skills/apexlang/templates/region-components/region-display-selector/README.md +5 -2
  161. package/skills/apexlang/templates/region-components/region-display-selector/region-display-selector._common.md +60 -7
  162. package/skills/apexlang/templates/region-components/region-display-selector/region-display-selector._index.md +4 -1
  163. package/skills/apexlang/templates/region-components/region-display-selector/region-display-selector.permutations.md +55 -0
  164. package/skills/apexlang/templates/region-components/region-display-selector/region-display-selector.standard.md +91 -5
  165. package/skills/apexlang/templates/region-components/smart-filter-search/README.md +6 -2
  166. package/skills/apexlang/templates/region-components/smart-filter-search/smart-filter-search._common.md +107 -46
  167. package/skills/apexlang/templates/region-components/smart-filter-search/smart-filter-search._index.md +4 -3
  168. package/skills/apexlang/templates/region-components/smart-filter-search/smart-filter-search.standard.md +33 -17
  169. package/skills/apexlang/templates/shared-components/component-settings/component-settings._common.md +1 -0
  170. package/skills/apexlang/templates/shared-components/component-settings.example.md +1 -0
  171. package/skills/apexlang/templates/shared-components/email-templates.example.md +1 -1
  172. package/skills/apexlang/templates/shared-components/rest-data-sources/example_rest_data_source.example.md +40 -46
  173. package/skills/apexlang/templates/shared-components/task-definitions/action-task.example.md +2 -30
  174. package/skills/apexlang/templates/shared-components/task-definitions/approve-request.example.md +3 -31
  175. package/skills/apexlang/templates/template-components/README.md +27 -15
  176. package/skills/apexlang/templates/template-components/avatar/README.md +56 -0
  177. package/skills/apexlang/templates/template-components/avatar/avatar._common.md +149 -0
  178. package/skills/apexlang/templates/template-components/avatar/avatar._index.md +42 -0
  179. package/skills/apexlang/templates/template-components/{avatar._template_options.md → avatar/avatar._template_options.md} +1 -1
  180. package/skills/apexlang/templates/template-components/avatar/avatar.report-icon.md +48 -0
  181. package/skills/apexlang/templates/template-components/avatar/avatar.report-image-url-column.md +62 -0
  182. package/skills/apexlang/templates/template-components/avatar/avatar.report-initials.md +54 -0
  183. package/skills/apexlang/templates/template-components/badge/README.md +38 -0
  184. package/skills/apexlang/templates/template-components/badge/badge._common.md +183 -0
  185. package/skills/apexlang/templates/template-components/badge/badge._index.md +20 -0
  186. package/skills/apexlang/templates/template-components/badge/badge.report-link.md +66 -0
  187. package/skills/apexlang/templates/template-components/badge/badge.report-minimal.md +76 -0
  188. package/skills/apexlang/templates/template-components/comments/README.md +20 -0
  189. package/skills/apexlang/templates/template-components/comments/comments._common.md +43 -0
  190. package/skills/apexlang/templates/template-components/comments/comments._index.md +25 -0
  191. package/skills/apexlang/templates/template-components/{comments._template_options.md → comments/comments._template_options.md} +2 -1
  192. package/skills/apexlang/templates/template-components/comments/comments.apex-task-comments.md +77 -0
  193. package/skills/apexlang/templates/template-components/comments/comments.partial-column.md +120 -0
  194. package/skills/apexlang/templates/template-components/comments/comments.permutations.md +425 -0
  195. package/skills/apexlang/templates/template-components/content-row/README.md +1 -1
  196. package/skills/apexlang/templates/template-components/content-row/content-row._common.md +1 -1
  197. package/skills/apexlang/templates/template-components/content-row/content-row._index.md +1 -1
  198. package/skills/apexlang/templates/template-components/content-row/content-row._template_options.md +1 -1
  199. package/skills/apexlang/templates/template-components/flexbox-container/README.md +9 -0
  200. package/skills/apexlang/templates/template-components/flexbox-container/flexbox-container._index.md +13 -0
  201. package/skills/apexlang/templates/template-components/media-list/README.md +100 -0
  202. package/skills/apexlang/templates/template-components/media-list/media-list._common.md +174 -0
  203. package/skills/apexlang/templates/template-components/media-list/media-list._index.md +50 -0
  204. package/skills/apexlang/templates/template-components/{media-list._template_options.md → media-list/media-list._template_options.md} +8 -2
  205. package/skills/apexlang/templates/template-components/media-list/media-list.partial.md +50 -0
  206. package/skills/apexlang/templates/template-components/media-list/media-list.report-avatar-badge.md +76 -0
  207. package/skills/apexlang/templates/template-components/media-list/media-list.report-base.md +71 -0
  208. package/skills/apexlang/templates/template-components/media-list/media-list.report-grouped.md +40 -0
  209. package/skills/apexlang/templates/template-components/media-list/media-list.report-layouts.md +50 -0
  210. package/skills/apexlang/templates/template-components/media-list/media-list.report-link.md +53 -0
  211. package/skills/apexlang/templates/template-components/metric-card/README.md +19 -4
  212. package/skills/apexlang/templates/template-components/metric-card/metric-card._common.md +122 -29
  213. package/skills/apexlang/templates/template-components/metric-card/metric-card._index.md +6 -0
  214. package/skills/apexlang/templates/template-components/metric-card/metric-card._template_options.md +47 -2
  215. package/skills/apexlang/templates/template-components/metric-card/metric-card.partial-minimal.md +51 -0
  216. package/skills/apexlang/templates/template-components/metric-card/metric-card.permutations.md +56 -0
  217. package/skills/apexlang/templates/template-components/metric-card/metric-card.report-avatar-badge.md +98 -0
  218. package/skills/apexlang/templates/template-components/metric-card/metric-card.report-grouping-selection.md +131 -0
  219. package/skills/apexlang/templates/template-components/metric-card/metric-card.report-link.md +66 -0
  220. package/skills/apexlang/templates/template-components/metric-card/metric-card.report-minimal.md +97 -0
  221. package/skills/apexlang/templates/template-components/template-components.registry.json +90 -1
  222. package/skills/apexlang/templates/template-components/timeline/README.md +19 -0
  223. package/skills/apexlang/templates/template-components/timeline/timeline._common.md +43 -0
  224. package/skills/apexlang/templates/template-components/timeline/timeline._index.md +24 -0
  225. package/skills/apexlang/templates/template-components/{timeline._template_options.md → timeline/timeline._template_options.md} +2 -1
  226. package/skills/apexlang/templates/template-components/timeline/timeline.permutations.md +399 -0
  227. package/skills/apexlang/templates/template-components/timeline/timeline.report-sample-data.md +168 -0
  228. package/skills/apexlang/templates/workspace-components/credentials/credentials-for-open-ai.example.md +1 -1
  229. package/skills/apexlang/templates/workspace-components/generative-ai-services/open-ai.example.md +8 -6
  230. package/skills/apexlang/tools/apexctl.mjs +167 -4
  231. package/skills/apexlang/tools/compiler-truth-audit.mjs +95 -63
  232. package/skills/apexlang/tools/query-valid-props-context.mjs +30 -0
  233. package/skills/apexlang/tools/query-valid-props-normalize.mjs +1 -0
  234. package/skills/apexlang/tools/query-valid-props-runtime.mjs +13 -8
  235. package/skills/apexlang/tools/query-valid-props-semantics.mjs +391 -0
  236. package/skills/apexlang/tools/query-valid-props-template-components.mjs +15 -1
  237. package/skills/apexlang/tools/query-valid-props.mjs +198 -216
  238. /package/skills/apexlang/templates/template-components/{badge._template_options.md → badge/badge._template_options.md} +0 -0
  239. /package/skills/apexlang/templates/template-components/{flexbox-container._template_options.md → flexbox-container/flexbox-container._template_options.md} +0 -0
@@ -1,255 +1,55 @@
1
1
  > All `node tools/apexctl.mjs ...` commands are package-root relative: run them from the packaged skill root, or invoke that script by explicit path.
2
2
 
3
- # Agent 3 — Revision (Child Workflow)
3
+ # Agent 3 — Revision
4
4
 
5
5
  Purpose
6
- - Apply accepted review notes to produce the final APEXlang artifacts, enforce governance gates, and persist only compact runtime evidence when needed — with minimal token/context usage.
6
+ - Apply only deterministic critique and validator fixes, then prove the result.
7
7
 
8
8
  Inputs
9
- - draft_path: path to the app file in the transient temp workspace outside the repo
10
- - critique_path: internal review payload reference for the current run
11
- - target_type
12
- - output_path? (defaults per scope)
13
- - app_root? (when Whole Application scope is active; e.g., applications/app_###/)
14
- - server_side_condition? (structured object from master workflow)
9
+ - accepted critique payload
10
+ - draft and Generation Plan
11
+ - original intent and context capsule fingerprint
12
+ - `problems.json` or explicit rule IDs
15
13
 
16
14
  <authority_rules>
17
- - Shared prompt contract: `references/workflows/apexlang/prompt-contracts.md`
18
- - Preserve its hierarchy, rule IDs, intermediate artifacts, and stop conditions while applying accepted fixes.
15
+ - Preserve the frozen Generation Plan unless the critique proves that the plan itself violates a higher authority.
16
+ - Use the repair capsule as the deterministic fix entrypoint.
17
+ - Do not expand scope, redesign unaffected components, or infer missing values.
19
18
  </authority_rules>
20
19
 
21
20
  <task_scope>
22
- - Apply accepted critique notes only.
23
- - Keep revision deterministic and avoid re-planning unless the critique explicitly requires a plan repair.
21
+ 1. Preserve the reviewed unit identity and run `node tools/apexctl.mjs context repair --problems <problems.json> --unit-id <unit-id> --ir-pointer <ir-pointer>` or pass explicit `--rule-id` values with the same unit metadata.
22
+ 2. Apply the smallest artifact change described by each resolved recipe.
23
+ 3. Open owning guidance only when the compact recipe cannot be applied safely.
24
+ 4. Rerun the exact compiler/local/live check that produced the finding.
25
+ 5. Repeat only for newly reported deterministic findings; stop when evidence is missing.
24
26
  </task_scope>
25
27
 
26
- <generation_plan_contract>
27
- - Preserve the frozen `Generation Plan` when applying accepted notes.
28
- - If an accepted note changes a plan-level structural decision, record a `Generation Plan Repair`, update the relevant plan fields first, then reconcile the emitted artifact to that repaired plan.
29
- - Do not finalize a revision that still violates `GENERATION_PLAN_DRIFT_001`.
30
- </generation_plan_contract>
31
-
32
- <output_contract>
33
- - Preserve or refresh `compiler_truth_evidence` when structural revisions change a compiler-justified decision.
34
- - For every accepted validator, VSCode Problems, `problems.json`, or `validation-report.json` issue, use `assets/validator-fix-recipes.json` to record `rule_id`, cause, deterministic fix applied, owning guidance, and rerun verification result.
35
- - Keep revision output aligned with the same response-order contract used by Draft when an updated plan or evidence block must be emitted.
36
- </output_contract>
28
+ <repair_contract>
29
+ - Generation Plan Repair is permitted only when a higher-precedence finding proves plan drift.
30
+ - Keep rule ID, cause, changed artifact, deterministic fix, and verification result together.
31
+ - Apply the repair in a fresh context containing the same unit capsule and only its projected repair recipes; do not reload earlier units.
32
+ - Preserve unrelated source, formatting, identifiers, and behavior.
33
+ - Re-run compiler-truth audit after structural changes.
34
+ - Do not load the full validator-fix-recipes catalog or broad Draft/Critique checklists.
35
+ </repair_contract>
37
36
 
38
37
  <stop_conditions>
39
- - Follow `RULES_FIRST_WORKFLOW_REQUIRED_001` and `HUMAN_INTERVENTION_REQUIRED_001`.
40
- - If deterministic revision cannot satisfy the shared contract without inventing structure, keep finals blocked and record Missing Inputs instead of guessing.
38
+ - Do not revise a blocked context capsule into an artifact. Return its concrete `routing_decision.missingInputs` until a new ready capsule is resolved.
39
+ - Stop with Missing Inputs when a recipe needs an unproven schema object, target, mapping, or property.
40
+ - Stop when the recipe and compiler/live evidence conflict.
41
+ - Do not mark completion until all required checks pass.
41
42
  </stop_conditions>
42
43
 
43
- Responsibilities (apply only accepted notes)
44
- - Respect governance:
45
- - Reject any change conflicting with references/policies/memory-bank/00-guard/ai.guard.md or 10-global/apex.global.md.
46
- - Do not invent attributes or CSS classes; use templates/* only.
47
- - Reject finals that attempt to copy content or reusable patterns from `applications/**`; regenerate using the canonical template instead.
48
- - Preserve target-app reads only when they provide concrete integration facts such as existing ids, aliases, navigation entries, breadcrumb entries, or artifact paths.
49
- - Do not create unrelated helper source files for APEXlang generation tasks unless the user explicitly requested tooling or scripts.
50
- - For dynamic-action revisions, follow `references/domains/business-logic/dynamic-actions/workflow-dynamic-actions.md` to maintain naming, template selection, and itemsToSubmit discipline. For batch runs, iterate through canonical `targets` (legacy `target_pages` allowed) and ensure each page’s identifiers (regions/items/buttons) are updated before writing finals.
51
- - For batch revisions across all domains, normalize legacy inputs (`target_pages`, `target_items`, `target_buttons`, `target_button`, `apply_to`) to canonical `targets`, then apply deterministic per-target outcomes.
52
- - For mixed translation/control prompts, do not finalize localization artifacts until runtime language switching versus text-message localization intent has been resolved.
53
- - Page processes: use `references/domains/business-logic/processes/workflow-page-processes-batch.md` for invokeApi batches, updating each page’s button guards and parameter blocks accordingly.
54
- - Application processes: enforce `type: executeCode` only and remove `invokeApi` usage from `appProcess` blocks.
55
- - Item computations: leverage `references/domains/business-logic/computations/workflow-computations-batch.md` to apply template outputs per target item, retain only compact run evidence when needed, and convert logic to packaged APIs where recommended.
56
- - For translations, keep placeholders intact and use `references/domains/shared-components/workflow-translations.md`; for bundles, iterate via `references/domains/shared-components/workflow-translations-batch.md`, logging AI-assisted entries separately.
57
- - For button batches, apply `references/domains/page-components/buttons/workflow-button-batch.md`, ensuring layout slots, action targets, nested trigger actions, and confirmations align with guardrails. Persist only compact run evidence when needed.
58
- - For non-button batch domains (processes, computations, DA batches, translations, SSC/help-text), ensure compact run evidence includes `operation`, canonical `targets`, and per-target statuses before writing finals when the workflow explicitly persists logs.
59
- - Deterministic button autofix: when critique reports a button-behavior policy rule violation, apply the JSON policy fix from `assets/component-policies.json` exactly. For `BTN_RULE_001`, remove `warnOnUnsavedChanges` whenever `behavior.action: definedByDynamicAction`.
60
- - Deterministic button templateOptions autofix: when critique or runtime reports button template-option alias drift, preserve `#DEFAULT#`, keep multi-value arrays bracketed with one accepted value per line, and normalize aliases/naked suffixes to canonical emitted values from the button family contract. Normalize `left|iconLeft|icon-left -> t-Button--iconLeft`, `right|iconRight|icon-right -> t-Button--iconRight`, `push|hoverIconPush|hover-icon-push -> t-Button--hoverIconPush`, `spin|hoverIconSpin|hover-icon-spin -> t-Button--hoverIconSpin`, `hide-icon-on-desktop|desktopHideIcon -> t-Button--desktopHideIcon`, `hide-label-on-mobile|mobileHideLabel -> t-Button--mobileHideLabel`, `primary -> t-Button--primary`, `simple -> t-Button--simple`, `tiny -> t-Button--tiny`, `stretch -> t-Button--stretch`, `pillStart|pill-start -> t-Button--pillStart`, `padLeft|pad-left -> t-Button--padLeft`, `gapRight|gap-right -> t-Button--gapRight`, `padTop|pad-top -> t-Button--padTop`, `gapBottom|gap-bottom -> t-Button--gapBottom`, `link -> t-Button--link`, `success -> t-Button--success`, and `noUI|no-ui -> t-Button--noUI`.
61
- - Deterministic button icon-position autofix: when a `@/text-with-icon` button has `icon` but no icon-position template option, add `t-Button--iconLeft`; when it has both `t-Button--iconLeft` and `t-Button--iconRight`, keep the explicitly requested side if known, otherwise keep left. Remove left/right icon-position options from `@/icon` buttons.
62
- - Deterministic icon autofix: for `FA_ICON_REQUIRED_001`, replace non-`fa-*` icon values with conservative Font APEX classes such as `fa-table`, `fa-users`, `fa-map-marker`, `fa-package`, `fa-image`, `fa-filter`, `fa-edit`, or `fa-plus`; do not use Material, JET, image, or custom CSS icon aliases.
63
- - Deterministic Classic Report component templateOptions autofix: for `CLASSIC_REPORT_DEFAULT_TEMPLATE_REQUIRED_001`, set `componentAppearance.templateOptions` to a multi-line array containing exactly `#DEFAULT#`, `t-Report--stretch`, and `t-Report--horizontalBorders`. Remove `t-Report--altRowsDefault`, `t-Report--staticRowColors`, `t-Report--rowHighlight`, and any vertical/no-border report modifiers unless a specific scenario contract explicitly overrides the Classic Report default.
64
- - Deterministic Classic Report contextual-info wrapper autofix: for `CLASSIC_REPORT_CONTEXTUAL_INFO_TEMPLATE_OPTIONS_REQUIRED_001`, keep `appearance.template: @/contextual-info` and set `appearance.templateOptions` to a multi-line array containing exactly `#DEFAULT#`, `t-Region--hideHeader js-addHiddenHeadingRoleDesc`, and `t-Region--noUI`.
65
- - Deterministic dashboard KPI autofix: for `DASHBOARD_KPI_METRIC_CARD_REQUIRED_001`, replace single-value KPI Classic Reports with one normalized `themeTemplateComponent/metricCard` strip using one source row per KPI. Preserve required KPI labels, icons, aggregate SQL values, meta text, and layout row membership.
66
- - Deterministic dashboard row-plan autofix: for `APP_UX_LAYOUT_RECIPE_REQUIRED_001` or `DASHBOARD_LAYOUT_ROW_PLAN_REQUIRED_001`, treat each `layout_row_plan` entry as one physical row. Split stacked full-width detail, contextual summary, and cards sections into separate one-region entries and remove `startNewRow: false` from the first region in each resulting row. Replace any `dashboard-chart-flow` recipe with explicit `two-up-equal` and `three-up-equal` chart row entries.
67
- - Deterministic drawer default autofix: for `DRAWER_POSITION_DEFAULT_END_REQUIRED_001`, add `js-dialog-class-t-Drawer--pullOutEnd` to drawer form `appearance.templateOptions` unless the requirements explicitly specify start/top/bottom or centered dialog behavior.
68
- - Deterministic `.apx` line-ending fix: for `APEXLANG_LF_LINE_ENDINGS_REQUIRED_001`, rewrite only the affected generated or revised `.apx` artifacts with LF line endings before any validation, publish, or handoff.
69
- - Deterministic display-only autofix:
70
- - For `pageItem` with `type: displayOnly`, remove unsupported `appearance.width` and `appearance.height`.
71
- - Ensure `settings.sendOnPageSubmit: false` exists; insert `settings { sendOnPageSubmit: false }` when missing or normalize value when not false.
72
- - Keep all other display-only attributes unchanged unless critique explicitly requests additional revisions.
73
- - Deterministic master-detail Content Row autofix:
74
- - For `CONTENT_ROW_SETTINGS_SUBSTITUTION_REQUIRED_001`, rewrite Content Row `settings.overline`, `settings.title`, `settings.description`, and `settings.miscellaneous` column mappings from bare aliases to `&COLUMN_NAME.` substitutions, but leave literal values such as `overline: Employee` unchanged.
75
- - For `CONTENT_ROW_SELECTION_ITEMS_REQUIRED_001`, add or fix native Content Row selection items. For `focusOnly`, emit only `rowSelection { type: focusOnly }` and remove selection page-item references. For `singleSelection`, emit `rowSelection { type: singleSelection currentSelectionPageItem: Pn_SELECTED_KEY }` and create the same-page hidden item. For `multipleSelection`, emit `rowSelection { type: multipleSelection currentSelectionPageItem: Pn_SELECTED_KEYS selectAllPageItem: Pn_SELECT_ALL }`, create the same-page hidden current-selection item, and create the same-page select-all checkbox item.
76
- - For `MASTER_DETAIL_CONTENT_ROW_ACTION_REQUIRED_001`, add or fix a report-mode Content Row `action ... (` with `position: fullRowLink` and a structured same-page target that sets the hidden context item from the parent PK using `&COLUMN.` substitution. Do not accept native `rowSelection.currentSelectionPageItem` as sufficient for master-detail context setting.
77
- - For `MASTER_DETAIL_DYNAMIC_ACTION_REQUIRED_001`, remove URL-style same-page reloads from master selection, update the hidden parent context item through dynamic-action/declarative behavior, and refresh every dependent child region after the context changes.
78
- - For map child context drift, replace `v()`/`nv()` session-state reads with normal `:P...` binds and add explicit child-region refresh behavior. Add map-layer `source.pageItemsToSubmit` only when direct compiler truth for the active build proves it valid for the selected layer shape.
79
- - For missing map marker edit/open links, add a declarative map layer `link { target: { page, items } }` using the marker key column and target form primary-key item declared in the UX contract.
80
- - For `MAP_INITIAL_VIEWPORT_BOUNDS_REQUIRED_001`, replace average-center/fixed-zoom `initialPositionAndZoom` with a SQL-derived `boundingBox` using min/max longitude and latitude over the layer dataset, and remove `infiniteMap` from controls when bounding-box metadata is present.
81
- - For `MASTER_DETAIL_VISIBLE_SELECTOR_REGRESSION_001`, convert the visible parent select-list selector into a protected hidden context item unless the user explicitly requested manual selection.
82
- - For `MASTER_DETAIL_CHILD_BIND_SUBMIT_REQUIRED_001` or `IR_CONTEXT_BIND_SUBMIT_REQUIRED_001`, add every same-page item referenced by child Interactive Report SQL binds to `source.pageItemsToSubmit`.
83
- - For `MASTER_DETAIL_TOOLBAR_ACTIONS_REQUIRED_001`, move child create/edit/detail buttons into the child Interactive Report scope using `layout.region: @<child-report-static-id>` and `slot: rightOfInteractiveReportSearchBar`; move primary page-level create buttons to the breadcrumb/title-bar region, usually `layout.region: @breadcrumb` and `slot: NEXT`.
84
- - For `PARENT_CHILD_ACTION_COVERAGE_REQUIRED_001`, update `.apexlang/app-ux-contract.json` before patching pages: add `actionCoverage` under the relevant `behaviorPlan.parentChildContext` entry for parent edit, child create, child edit/detail, and page-level create behaviors, then materialize those links/buttons in the page artifacts.
85
- - For `PAGE_ACTION_BREADCRUMB_REQUIRED_001`, move the primary page-level create button from the report/search results region to the breadcrumb/title-bar region, usually `layout.region: @breadcrumb`; keep region toolbar placement only for child/detail actions.
86
- - For `MASTER_DETAIL_LAYOUT_REQUIRED_001`, use `appearance.pageTemplate: @/standard` and the master-detail Content Row BODY-grid recipe: parent Content Row first in `BODY` with `columnSpan: 3` or `4`, child report second in `BODY` with `startNewRow: false`, and remove redundant child `column` / `columnSpan` unless the validated contract requires them. Do not use `@/left-side-column` or `leftColumn` for master-detail workbenches.
87
- - For `MASTER_DETAIL_CONTENT_ROW_TEMPLATE_REQUIRED_001`, set the master Content Row region `appearance { template: @/standard templateOptions: #DEFAULT# }`. Do not repair it to `@/blank-with-attributes`; that shell is for structural containers and dashboard KPI strips.
88
- - For `APP_UX_FORM_VALIDATION_REQUIRED_001`, update `.apexlang/app-ux-contract.json` if needed, then add a page-level validation using the canonical validation templates. Associate the error with the target item and include the controlling item/value condition for conditional requirements.
89
- - For `APP_UX_FORM_CONTEXT_REQUIRED_001`, convert the context-owned item to `type: hidden` or a hidden-template display state, preserve launcher item mappings, and keep checksum protection appropriate for server-owned context values.
90
- - For `APP_UX_FORM_DEFAULT_REQUIRED_001`, add an explicit default or dynamic-action set-value behavior that submits the source item, looks up the declared source column, populates the target item, and preserves user override when the requirement allows it.
91
- - For `FACET_SOURCE_DATA_TYPE_REQUIRED_001`, `FACET_RANGE_DATA_TYPE_REQUIRED_001`, or `FACET_DATE_DATA_TYPE_REQUIRED_001`, set date/time facets such as `ORDER_DATE` or `ORDER_DATETIME` to `source.dataType: date`, set numeric facets to `source.dataType: number`, and remove `source.dataType` from string facets instead of using `varchar2`.
92
- - For `FACET_LIST_ENTRIES_LIMIT_REQUIRED_001`, add `listEntries.maxDisplayedEntries: 10` to checkbox/radio facets unless requirements justify 5-15. For `FACET_VALUE_FILTER_INITIAL_REQUIRED_001`, add `listEntries.displayFilterInitially: true` to the same `listEntries` block.
93
- - For `IR_PROJECTED_COLUMNS_REQUIRED_001`, add missing Interactive Report `column (...)` definitions for every SQL projection using `interactive-report._columns._common.md`; preserve numeric end alignment and required headings.
94
- - For `INTERACTIVE_REPORT_LINK_COLUMN_TYPE_FORBIDDEN_001`, change only top-level Interactive Report column `type: link` to `type: plainText`; preserve the `link {}` block, `target`, `linkText`, heading, layout, source, comments, and every other column setting.
95
- - Deterministic layout autofix:
96
- - Apply these fixes to generated application artifacts before final validation; app output is not a layout-lint bypass.
97
- - Apply layout fixes per local scope: page slot rows, nested `parentRegion` rows, item rows by `layout.region + layout.slot`, and button rows by `layout.region + layout.slot`.
98
- - For equal-width sibling rows, remove `layout.column` and `layout.columnSpan`.
99
- - Ensure the first component in an equal-width row omits `layout.startNewRow`.
100
- - Ensure second-and-later equal-width siblings set `layout.startNewRow: false`.
101
- - Do not alter intentionally asymmetric rows such as sidebar-main, faceted-search, or parent-child split layouts.
102
- - Finals:
103
- - Write revised `.apx` outputs only to the transient temp app:
104
- - Pages → temp `{output_path}/pages/` or `{app_root}/pages/`
105
- - Shared components → temp `{output_path}/shared-components/` or `{app_root}/shared-components/`
106
- - Publish into `applications/<target-app>/...` only after the resolved live runtime action succeeds.
107
- - Compact run evidence:
108
- - Persist a concise list of applied/rejected/deferred notes only when the workflow explicitly stores durable evidence under `the temp-runtime logs directory under `APEXLANG_OUTPUT_ROOT/logs/``.
109
- - Preserve `compiler-truth-report.json` for generated or revised `.apx` artifacts and block completion when the report is missing or failing.
110
- - Preserve `validation-report.json`, `validation-transcript.log`, `problems.json`, and `component-contracts/<build>.json` from `runtime validate`. Apply fixes only for reported live validation problems, then rerun `runtime validate` until live APEX validation passes.
111
- - Resolve or explicitly defer parallel-skill contradictions recorded by critique; unresolved conflicts must remain as `Missing Inputs`.
112
-
113
- Navigation, breadcrumb, and page grouping revisions (non-modal)
114
- - When missing, append a Navigation Menu entry under shared-components/lists.apx targeting:
115
- f?p=&APP_ID.:&PAGE_ID.:&APP_SESSION.::&DEBUG.:::
116
- Choose a logical sequence number consistent with neighboring entries.
117
- - When missing, append a breadcrumb entry under shared-components/breadcrumbs.apx for the new page.
118
- - For `BREADCRUMB_REGION_TITLE_VISIBLE_GENERIC_001`, rename the page breadcrumb/title-bar region away from generic chrome text such as `Breadcrumb` or `Title Bar`, use the current page title/current breadcrumb entry as the visible region name, keep the title-bar/breadcrumb templates, and use live-valid template options such as standalone `#DEFAULT#`.
119
- - For management/launcher hub media-list entries, add a conservative `fa-*` icon and `userDefinedAttributes { 1: ... }` description when missing; choose semantic icons from the target domain such as `fa-package`, `fa-image`, `fa-filter`, `fa-users`, `fa-map-marker`, `fa-table`, or `fa-sitemap`.
120
- - For shared-components/lists.apx and shared-components/breadcrumbs.apx, normalize `behavior { target: ... }` to `link { target: ... }`.
121
- - For shared-components/component-settings.example.md, normalize direct settings keys to `settings { attributes: {...} }` and preserve existing values.
122
- - When page_group input is provided or inferable, set pageGroup: @your-group at the page root (not inside appearance/nav/css/security).
123
- - Do not emit group at page root; group is only valid within region/item templates and must remain unchanged there.
124
- - Align with references/policies/memory-bank/30-pages/apex.page.md and Tier‑2 orchestration acceptance rules.
125
-
126
- - Server-side execution fixes (scope split)
127
- - When critique requires conversion of page-process executeCode package calls, perform these revisions:
128
- - Replace `type: executeCode` with `type: invokeApi`.
129
- - Add:
130
- ```
131
- invoke {
132
- package: PKG_NAME
133
- procedureOrFunction: PROC_OR_FUNC
134
- }
135
- ```
136
- - For each argument, add a `parameter ( ... )` block with explicit `direction` (in | out | in out) and `value` mapping (either `item: Pn_ITEM` or `type: expression` with `plsqlExpression`).
137
- - Preserve `execution { sequence, point }`, `serverSideCondition`, and any `advanced` attributes.
138
- - Remove `plsqlCode` content when replaced by `invokeApi`; keep justification comments if present.
139
- - Do not modify anonymous `executeCode` blocks that do not call packages unless critique notes require changes.
140
- - Do not convert a valid thin page-level `executeCode` wrapper to `invokeApi` when critique confirms it is a page-coupled loader or branch-gated flow that needs direct page-item assignment and keeps business logic inside the package.
141
- - When critique flags `appProcess type: invokeApi`, convert to:
142
- - `type: executeCode`
143
- - `source { plsqlCode: ```plsql <PKG>.<PROC>(...named notation...); ``` }`
144
- - Preserve execution, serverSideCondition, security, and config blocks.
145
-
146
- Guardrail-driven PL/SQL and DB connection handling
147
- - Resolve `PLSQL_INLINE_BLOCK_001` from `00-guard/ai.guard.md` by removing inline PL/SQL bodies > 4000 raw characters and replacing them with package API usage (`app_process_api` default) plus compliant process type (`invokeApi` for page process, `executeCode` for appProcess).
148
- - Resolve `SQL_INLINE_BLOCK_001` by removing inline SQL bodies > 4000 raw characters, moving the query into a secure view, and rewriting the page/region/LOV/computation to reference that view.
149
- - Resolve oversized `aiAgent` tool `settings.sqlQuery` the same way: move prompt-independent joins, aggregations, and normalization into secure view(s), then keep only a short prompt-aware wrapper query inline.
150
- - Resolve calendar vocabulary drift deterministically: remove unsupported calendar settings such as `showTime`, normalize calendar settings to the canonical long-form names (`displayColumn`, `startDateColumn`, `endDateColumn`, `pkColumn`), restrict `additionalCalendarViews` to `list` and `navigation`, and collapse combined header tokens such as `t-Region--hideHeader js-addHiddenHeadingRoleDesc` into one `templateOptions` value. Record the source template/example as defective when critique or runtime flags the drift.
151
- - Resolve Interactive Grid saved-report metadata drift deterministically:
152
- - remove explicit chart sort `LABEL` values when they only restate metadata-backed default behavior
153
- - preserve metadata-backed aggregate view/static-id fields when they are part of the accepted contract instead of stripping them as ignored parameters
154
- - Resolve calendar link drift deterministically: rewrite legacy string `settings.createLink` / `settings.viewEditLink` examples to structured object syntax only when the accepted inputs explicitly provide the target page and any required item mappings. If critique reports invented target pages or item names, remove the guessed values and keep the artifact blocked with Missing Inputs guidance instead of inventing replacements.
155
- - If deterministic package/view naming or verified metadata is missing, keep finals blocked and record Missing Inputs rather than inventing DB objects.
156
- - Resolve `DB_CONN_REQUIRED_001` from `00-guard/ai.guard.md` by requesting `db_connection_name` before any DB object creation/update; if still missing, block DB-object finals and keep the item in Missing Inputs/Required Revisions.
157
- - Preserve `compiler_truth_evidence` from the draft/critique payload whenever revision rewrites a structure justified by compiler truth.
158
- - If revision changes a non-exact-match structural decision, refresh the affected `compiler_truth_evidence` entry before finalizing; do not keep stale conclusions attached to a rewritten shape.
159
- - Preserve `generation_plan` from the draft/critique payload whenever revision keeps the same structural decision set.
160
- - If revision changes a non-trivial structural decision, refresh the affected `generation_plan` fields before finalizing; do not keep stale plan decisions attached to a rewritten artifact.
161
-
162
- SQL hygiene and pagination (Required Revisions)
163
- - ACL role declaration autofix:
164
- - When critique reports `ACL_ROLE_DECLARATION_REQUIRED_001`, create `shared-components/acl-roles.apx` when absent.
165
- - Add missing ACL role declarations for every referenced role.
166
- - Normalize declared and referenced ACL role static IDs to lowercase kebab-case.
167
- - Rewrite authorization references to the normalized role IDs so authorizations and roles artifact remain consistent.
168
- - For region SQL sources and any fenced SQL in templates:
169
- - If `SELECT *` is present, do not attempt to expand columns automatically; record a Required Revision to project explicit columns per 20-data/apex.sql.md.
170
- - If deterministic ordering is missing for paginated regions, record a Required Revision to add ordering aligned with displayed columns.
171
- - For SQL-backed template components, remove `ORDER BY` from `source.sqlQuery` and add top-level `orderBy {}`. Use `type: staticValue` with `orderByClause` unless a same-page item intentionally controls ordering with `type: item`.
172
- - If report SQL/PLSQL contains HTML literals for UI rendering, remove markup from SQL/PLSQL and move presentation logic to `columnFormatting.htmlExpression` per `references/policies/memory-bank/30-pages/apex.report-column-rendering.md` (`REPORT_SQL_HTML_LITERAL_FORBIDDEN_001`).
173
- - When a report column uses `columnFormatting.htmlExpression`, normalize away `type: richText` and keep plain text type implicit unless a non-default type is explicitly required.
174
- - If SQL/PLSQL `WHERE` predicates compare columns ending with `_static_id` without LOWER normalization, rewrite deterministically to canonical form per `STATIC_ID_WHERE_LOWER_REQUIRED_001`:
175
- - `lower(col_static_id) = lower(<value_or_bind>)`
176
- - `lower(col_static_id) != lower(<value_or_bind>)`
177
- - `lower(col_static_id) in ('lowercase','values')`
178
- - If Interactive Report SQL uses user-entered text predicates without `LOWER()` normalization on both sides, rewrite deterministically to canonical form per `IR_TEXT_SEARCH_CASE_NORMALIZATION_REQUIRED_001`:
179
- - `col = :PXX_ITEM` -> `lower(col) = lower(:PXX_ITEM)`
180
- - `col like '%' || :PXX_SEARCH || '%'` -> `lower(col) like '%' || lower(:PXX_SEARCH) || '%'`
181
- - If no pagination/row limit is configured, record a Required Revision to enable pagination and set sensible `maxRowsToProcess`; avoid unbounded sets.
182
- - If pagination type is missing or outside the region-specific catalog in `20-data/apex.sql.md` without user direction, record a Required Revision to align with the catalog and document the chosen type:
183
- - Classic Report default: `rowRangesXToYNoPagination`
184
- - Interactive Report default: `rowRangesXToY`
185
- - Interactive Grid default: `scroll`
186
- - When critique reports same-application report/grid navigation implemented as `type: url`, `f?p=...`, or SQL-generated URL columns, rewrite it to declarative page-target syntax whenever the accepted inputs identify the target page and item mapping and the DSL supports that target shape.
187
- - When critique reports a `redirectThisApp` button implemented as scalar `target: f?p=...` or bare `target { ... }`, rewrite it to a declarative `target: { page, items, clearCache, action, request }` object whenever the target page and item mapping are known.
188
- - Resolve SSC tokens by expanding them into catalog-compliant conditions (per 20-data/apex.logic.md) and annotate finals with a comment referencing the token origin. When expanding `plsqlExpression` conditions, enforce the guardrails in section 8 (bind syntax, null safety, no DML/dynamic SQL, approved patterns). Record Missing Inputs or Required Revisions when proposals violate these rules, and include both the one-line intent and validated expression in draft summaries. If the token is unknown, record Missing Inputs and do not guess. For batch SSC runs, do not apply finals automatically; keep the affected targets in compact run evidence when that workflow persists logs.
189
- - For `itemIsInColonDelimitedList` and `itemIsNotInColonDelimitedList`, normalize legacy `value` to `list` during revision. Emit `list` in finals and keep `value` only as migration input.
190
- - If SQL hints are detected, record a Required Revision to remove them.
191
- - Enforce table aliases and leading‑comma formatting (one column per line); record Required Revisions where violated.
192
- - Do not rewrite queries without schema context; prefer emitting Required Revisions with clear, actionable notes referencing 20-data/apex.sql.md and 10-global/apex.global.md.
193
-
194
- PL/SQL named notation compliance
195
- - For PL/SQL text blocks (plsqlCode, plsqlFunctionBody, plsqlExpression):
196
- - Do not auto-convert positional to named notation unless a trusted signature catalog is available.
197
- - Emit Required Revisions listing each offending call and a suggested rewrite using named notation (param_name => value) for every argument.
198
- - Parameterless calls "()" are acceptable and require no changes.
199
-
200
- Governance gates (existence checks with minimal tokens)
201
- - Critical Pages (always):
202
- - Ensure presence of Page 0 (`p00000-*.apx`), Page 1 (`p00001-*.apx`), and Page 9999 (`p09999-*.apx`) under the correct pages/ directory.
203
- - If missing, create from:
204
- - templates/page-examples/global_page_0/global_page_0._index.md
205
- - templates/page-examples/home-page/home-page._index.md
206
- - templates/page-examples/login-page/login-page._index.md
207
- - Critical Shared Components (Whole Application only):
208
- - Ensure {app_root}/shared-components/ exists and is populated.
209
- - If missing or empty, seed from:
210
- - Source: templates/base-app-structure/scaffold-example/shared-components/**
211
- - Target: {app_root}/shared-components/**
212
- - Keep token usage minimal: refer by glob paths; do not enumerate files.
213
- - Remove documentation-only placeholders inherited from `base-app-structure/` unless the run explicitly requires those values.
214
- - Mandatory cleanup: remove leaked template-family files from the transient app root before finals, including `README.md`, `base-app-structure._common.md`, `base-app-structure._index.md`, and `base-app-structure.registry.json`.
215
- - Mandatory cleanup: remove leaked template-family docs from the transient app root before finals.
216
- - Mandatory cleanup: if the transient app root contains top-level entries outside `.apex/`, `application.apx`, `deployments/`, `page-groups.apx`, `pages/`, `shared-components/`, and `supporting-objects/`, remove the leaked scaffold/template entries instead of carrying them into published output.
217
-
218
- Loop cap and scoring (honor Critique policy)
219
- - Read PASS and CONFIDENCE from the structured review payload for the current run:
220
- - PASS: 1|2
221
- - CONFIDENCE: 0.00–1.00 (numeric)
222
- - If CONFIDENCE < 0.95 and PASS = 1 → perform one additional generate -> review -> fix pass (the master sets next PASS=2).
223
- - If PASS = 2 → stop after this revision; if CONFIDENCE < 0.95 record outstanding issues and do not loop again.
224
- - When a workflow explicitly stores durable run evidence, ensure the compact record includes:
225
- - PASS: <value from critique>
226
- - CONFIDENCE: <value from critique>
227
- - For styling-owned runs, include the chosen implementation path, official-reference status, theme-mode evidence path, token/class audit, CSS attachment and cache-busting, and required visual-gate coverage.
228
- - After two passes (max), stop and record outstanding issues regardless of confidence.
229
-
230
- Import runtime gate reconciliation
231
- - If run evidence does not show prerequisite metadata source was resolved first, block completion and record `DB_MODE_PROMPT_REQUIRED_001` in compact run evidence.
232
- - If run evidence does not show a passing compiler-truth audit for the staged app path, block completion and record `COMPILER_TRUTH_EVIDENCE_REQUIRED_001` or `COMPILER_TRUTH_AUDIT_FAILED_001` before runtime handoff.
233
- - For online runs, require direct SQLcl success for `apex validate -input <resolved_app_path>` before marking completion.
234
- - If the post-check GUI choice resolves to import, also require direct SQLcl import success for the same `resolved_app_path` in the same authenticated SQLcl user session; otherwise record `ONLINE_IMPORT_CONDITIONAL_001`.
235
- - If local predeploy validation or direct SQLcl roundtrip output reports failure, apply deterministic fixes only for reported issues:
236
- - vocabulary compatibility failures -> normalize only to canonical `26.1.0+3102` vocabulary by running `node tools/apexctl.mjs apexlang validate --app-path <resolved_app_path> --fix-vocab`, persist report path ``APEXLANG_OUTPUT_ROOT/logs/apexlang-vocab-report.json``, and keep completion blocked until unresolved aliases are zero.
237
- - schema contract failures -> prioritize compiler-truth-backed DSL rewrites first; use `assets/component-attributes.json` only as fallback/internal validator context when stronger runtime-backed proof is unavailable.
238
- - SQLcl not found -> request a working SQLcl installation on PATH; do not guess command locations.
239
- - SQLcl validate/import failures -> record actionable revisions and preserve failing command output context in compact run evidence.
240
- - For runtime/import failures, the master may run up to 2 additional live retries after the first failure (3 total live rounds), but each retry must follow a fix -> local DSL validation -> live rerun sequence.
241
- - Do not mark run complete until runtime gate passes or retries are exhausted (`RUNTIME_GATE_COMPLETION_REQUIRED_001`).
242
- - Do not mark `validate-and-import` runs complete until import execution success is recorded (`ONLINE_IMPORT_CONDITIONAL_001`).
243
-
244
- Notes
245
- - Keep tokens low by referencing paths and rules; avoid quoting large portions of the draft or critique.
246
- - Prefer declarative validations/processes; push heavy logic to DB packages/views; guard DML by button/process.
247
- - When server-side conditions are requested, ensure finals align with the provided scope, type, and attributes; do not invent or alter conditions without updated inputs. Emit Missing Inputs if data was not supplied by the workflow.
248
- - Help text and annotation enforcement: apply the guardrails from 10-global/apex.global.md, 30-pages/apex.form.md, 30-pages/apex.classic-report.md, 30-pages/apex.interactive-report.md, 30-pages/apex.interactive-grid-page.md, and 40-components/apex.items.md. Ensure the default guidance layer is present: page help on major pages, concise help on user-editable and filter/control items, and developer comments on key report columns and high-value regions. Use Text Messages, planned message keys, or approved sources, respect length limits (inline <=60 chars; detailed <=400 chars), and keep draft/apply state in compact run evidence when batch workflows persist logs. Convert uncontrolled literals to Text Message references before finals; otherwise record Required Revisions.
249
- - When guidance is missing and inputs are otherwise sufficient, auto-revise the draft to add helpful page help, item help, and column comments rather than leaving the issue as advisory. Replace placeholders and label-only restatements with concise, behavior-aware wording derived from authoritative metadata first, then from emitted labels, validation, LOV semantics, format masks, and source-column purpose.
250
- - For report/grid column metadata, preserve the existing `comments { comments: ... }` shape. Do not invent alternate annotation blocks. When revising comments, keep the required attributes `Display Label`, `Display in Report`, `Display in Form`, `Format Mask`, `Value Required`, `Read Only`, `Primary Display Column`, and `Authorization Scheme`; include `Summary` only when a short leading business-intent sentence materially helps maintenance, and mirror executable settings such as `appearance.formatMask` and `security.authorizationScheme` when present.
251
-
252
- Invocation (always constitutional)
253
- - This agent is orchestrated automatically when `SKILL.md` loads `references/workflows/apex-generation.md`.
254
- - No manual activation or deactivation steps are required.
255
- - The master governs minimal rule loading and routing; this file remains concise and path‑referenced.
44
+ Compatibility repair coverage
45
+ - `CONTENT_ROW_SELECTION_ITEMS_REQUIRED_001`: `rowSelection { type: focusOnly }` contains no page-item references; single/multiple modes use the documented items and identity column.
46
+ - `INTERACTIVE_REPORT_LINK_COLUMN_TYPE_FORBIDDEN_001`: change only top-level Interactive Report column `type: link` to `type: plainText` and preserve the nested link target.
47
+ - Deterministic master-detail Content Row autofix requires a `fullRowLink` action that sets the hidden context item. Do not accept native `rowSelection.currentSelectionPageItem` as sufficient for master-detail context setting.
48
+ - Mandatory cleanup: remove leaked template-family docs for `APP_TEMPLATE_ARTIFACT_LEAK_001` while retaining only allowed runtime artifacts.
49
+ - Repair authority is projected from `assets/validator-fix-recipes.json`; do not load that complete asset.
50
+
51
+ Output
52
+ - Updated artifact paths.
53
+ - Applied rule IDs and compact change summaries.
54
+ - Verification results and remaining blockers.
55
+ - Final capsule fingerprint.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
  - Verify the NLU Router behavior defined by `SKILL.md` while loading `references/workflows/apex-generation.md`, using the Component Registry (`assets/apex-generation/components.registry.json`) and rule loading via `assets/rules-mapping.json`.
5
- - Each test lists expected: target_type, matched components, rules, templates, required inputs to ask for, and outputs.
5
+ - Each test lists expected: target_type, matched components, compact rules/contracts, exact templates only when selected, required inputs to ask for, source trace, and outputs.
6
6
 
7
7
  ## Conventions
8
8
  - Message 1: references/workflows/apex-generation.md
@@ -15,7 +15,9 @@
15
15
 
16
16
  ## Legend
17
17
  - Rules are union-loaded: 00-guard + 10-global + matched 20-data/30-pages/40-components.
18
- - Only templates present under templates/* may be used.
18
+ - Use `assets/rules.catalog.json` and structured contracts before broad prose.
19
+ - Use `assets/grammar/apexlang.ebnf` and compiler metadata or `query-valid-props` before template-derived DSL.
20
+ - Only exact templates selected by the rule/contract/workflow trace may be used.
19
21
 
20
22
  1) Page with Interactive Report + Form (same page) + LOV + Refresh
21
23
  - Input: “Build a page with an interactive report and a form on {{source.table}}; use Lookup LOV for {{lookup.valueColumn}}; refresh report after submit”
@@ -39,6 +41,8 @@
39
41
  - {{source.table}}: table, pk, columns
40
42
  - LOV: source table/view={{lookup.table}}, value={{lookup.valueColumn}}, display={{lookup.displayColumn}}
41
43
  - DA: target region identifier (IR region), trigger (after form submit)
44
+ - Source trace:
45
+ - rules.catalog/rules-mapping -> page-construction-packs:report-modal-form or explicit page workflow -> grammar/compiler metadata -> listed exact templates
42
46
  - Outputs: internal generate/review/fix loop, then final written under pages/
43
47
 
44
48
  2) Interactive Report only ({{source.table}} with {{lookup.valueColumn}} filter LOV)
@@ -104,6 +108,8 @@
104
108
  - templates/page-examples/dashboard-page/dashboard-page._index.md
105
109
  - Optional: templates/page-examples/classic-report-page/classic-report-page._index.md (tile-like classic report)
106
110
  - Required inputs: SQL or table/view for aggregation
111
+ - Source trace:
112
+ - rules.catalog:DASHBOARD_KPI_METRIC_CARD_REQUIRED_001 -> page-construction-packs:dashboard -> grammar/compiler metadata for metricCard/chart/report shape -> exact dashboard/metric templates only when selected
107
113
  - Outputs: internal generate/review/fix loop, then final page
108
114
 
109
115
  5) Single Chart (amount by category)
@@ -3,6 +3,7 @@
3
3
  Objective
4
4
  - Validate that natural one‑liner inputs are routed deterministically to a structured “Message 2” and that minimal rule loading, templates selection, and “Missing Inputs” handling align with governance.
5
5
  - Validate that fragmentary or free-form prompts are accepted as first-class input, normalized once, and clarified only when critical blockers remain.
6
+ - Validate that routing uses progressive disclosure: compact rule/contract first, grammar/compiler metadata for structural legality, and exact template paths only after a concrete family is selected.
6
7
  - No actual generation is executed here; this is a step‑by‑step checklist to simulate and verify behavior.
7
8
  - Inputs containing `{{...}}` are `illustrative_prompt` grammar examples. Substitute verified identifiers during a real run; never treat the variables as schema evidence or final output text.
8
9
 
@@ -13,6 +14,13 @@ Prerequisites
13
14
  - - assets/apex-generation/components.registry.json
14
15
  - Rule routing:
15
16
  - assets/rules-mapping.json (updated with synonyms for calendar, map, cards, form/report region)
17
+ - Compact rule/contract routing:
18
+ - assets/rules.catalog.json
19
+ - assets/contracts/page-patterns.json
20
+ - assets/contracts/page-construction-packs.json
21
+ - Syntax and semantic legality:
22
+ - assets/grammar/apexlang.ebnf
23
+ - tools/query-valid-props.mjs
16
24
  - Skeletons and examples:
17
25
  - - references/workflows/apex-generation.md (includes One-liner guidance and “J) Page — IR + Form”)
18
26
 
@@ -27,7 +35,9 @@ Validation Process
27
35
  - Component lookup via registry
28
36
  - Target_type decision rules
29
37
  - Union rule loading + styling conditional
30
- - Template selection from templates/*
38
+ - Structured pattern/contract selection before exact template loading
39
+ - Grammar/compiler metadata checks before template-derived DSL
40
+ - Source trace synthesis
31
41
  - Required inputs prompting (“Missing Inputs” policy)
32
42
  - Message 2 synthesis
33
43
 
@@ -71,6 +81,7 @@ A) “Page with an interactive report and a form on {{source.table}}; use Lookup
71
81
  - LOV: {{lookup.valueColumn}}->{{lookup.displayColumn}}
72
82
  - DA: IR region identifier, trigger = after submit
73
83
  - Expected Message 2: Structured object with target_type=page, intent summarizing both regions, data_contract populated where provided, styling=none unless specified, output_path default.
84
+ - Expected source trace: intent -> rules.catalog/rules-mapping -> page construction pack or workflow -> grammar/compiler metadata -> exact templates only as selected references.
74
85
 
75
86
  B) “Interactive report on {{source.table}} with a {{lookup.valueColumn}} select list filter using Lookup LOV”
76
87
  - Components: [interactive-report, lov-shared]
@@ -140,7 +151,7 @@ H) “Add an AI assistant/chatbot to the home page”
140
151
  - `Use a theme template component`
141
152
 
142
153
  5) Templates Integrity Check
143
- - For each test, ensure every referenced template exists in:
154
+ - For each test, first ensure the routed rule card, structured contract, or workflow exists. Then ensure every referenced exact template exists in:
144
155
  - templates/page-examples/*
145
156
  - templates/business-logic/*
146
157
  - templates/items/*
@@ -148,6 +159,9 @@ H) “Add an AI assistant/chatbot to the home page”
148
159
  - If a requested visual (e.g., “cards variant”) lacks a template:
149
160
  - Expect a fallback to a supported template.
150
161
  - Critique to record limitation; Revision to apply supported subset only.
162
+ - If grammar or compiler metadata conflicts with a referenced template:
163
+ - Expect critique to mark the template defective.
164
+ - Revision must use the grammar/compiler-valid shape and keep the source trace.
151
165
 
152
166
  6) Output Expectations (when executed)
153
167
  - Working copy: transient temp workspace outside the repo
@@ -166,6 +180,8 @@ Sign‑off Criteria
166
180
  - All sample inputs map deterministically to components and rules.
167
181
  - Fragmentary prompts are accepted without requiring the user to restate them in structured form.
168
182
  - At most one clarification round is used for unresolved critical blockers.
183
+ - Non-trivial cases produce a compact source trace.
184
+ - Grammar/compiler metadata is consulted before templates for structural legality.
169
185
  - No invented attributes/UT classes; missing inputs are requested, not fabricated.
170
- - Only existing templates are referenced; unsupported visuals trigger documented fallbacks.
186
+ - Only selected exact templates are referenced; unsupported visuals trigger documented fallbacks.
171
187
  - Styling rules are conditionally loaded only when styling is provided.
@@ -1,4 +1,4 @@
1
- # Component Registry Excerpts — Apex Developer
1
+ # Component Registry Excerpts — APEX Developer
2
2
 
3
3
  | Keyword | Component | Notes |
4
4
  |---------|-----------|-------|
@@ -12,3 +12,17 @@
12
12
  | `dynamic action` | dynamic-action-* | Refresh/report invocation |
13
13
 
14
14
  Refer to `assets/apex-generation/components.registry.json` for full list and synonyms.
15
+
16
+ ## Ownership routing
17
+
18
+ Component `routing` metadata resolves ownership before profile and template selection:
19
+
20
+ 1. `selectorGroups`: explicit component or host-region selectors.
21
+ 2. `competingSignals`: named competing components, ordered by `competingOrder`.
22
+ 3. `aliases`: direct component names.
23
+ 4. `fallbackSelectorGroups`: generic template wording that must yield to explicit names.
24
+ 5. `semanticFallback`, then generic component scoring.
25
+
26
+ Both selector fields map owner names to phrase arrays; `direct` means the declaring component's owner. Both use phrase scores plus `selectorWeights`, then `precedence` and owner name for ties. Missing groups are empty. Put generic wording that can overlap a component alias in `fallbackSelectorGroups`; retain explicit component and host-region requests in `selectorGroups`. Document component-specific examples in the owning component guidance.
27
+
28
+ Keep source adapters, placement requirements, feature signals, and candidate suppression on the same routing descriptor. The selected owner drives the existing profile, rule, and template projections. Package assembly copies this registry and the shared resolver; do not maintain separate packaged routing rules.
@@ -1,6 +1,6 @@
1
1
  > All `node tools/apexctl.mjs ...` commands are package-root relative: run them from the packaged skill root, or invoke that script by explicit path.
2
2
 
3
- # Template & Sub-Skill References — Apex Developer
3
+ # Template & Sub-Skill References — APEX Developer
4
4
 
5
5
  ## Authoritative Policies
6
6
  - `references/policies/governance/00-governance.md`
@@ -44,7 +44,7 @@ description: Orchestrate the APEXlang internal generate, review, and fix loop fo
44
44
  1. Normalize free-form input directly according to `references/policies/governance/prompt-normalization.md` and ask only one simple-English clarification round for critical blockers.
45
45
  2. If the request is complete app generation from functional requirements plus model/schema metadata, load `references/workflows/apexlang/workflow-create-app-from-fr-and-model.md`, complete `references/workflows/apexlang/application-spec.template.md`, and freeze the Application Composition Plan before drafting `.apx` artifacts.
46
46
  3. For packaged-build refresh work, classify the change as broad DSL drift or narrow component metadata delta before changing templates, examples, or packaged docs.
47
- 4. Resolve prerequisite metadata and saved-connection discovery first for APEX artifact work: inspect offline schema dictionaries, scan saved SQLcl connections, use discovered aliases as candidates, and require the user to specify the live `db_connection_name` plus corresponding APEX workspace name before live work.
47
+ 4. Resolve prerequisite metadata and saved connections first for APEX artifact work: inspect offline schema dictionaries, scan saved SQLcl connections, auto-bind one deterministic alias, and ask for manual `db_connection_name` only when discovery remains unresolved. Require a workspace name for new-app materialization or resolve a workspace id after runtime-reported ambiguity.
48
48
  5. If `db_mode = online`, continue with the resolved `db_connection_name`, APEX workspace name, and metadata/runtime gates as needed.
49
49
  6. Select page and component patterns only from `templates/**`, using `page-examples/**` first for page-scoped work.
50
50
  7. Use the resolved target app only for integration facts, never as a pattern or DSL source.
@@ -26,13 +26,13 @@ Execution model
26
26
  1. Router receives one-message prompt, including fragmentary or free-form user input.
27
27
  2. `SKILL.md` normalizes intent directly according to `references/policies/governance/prompt-normalization.md` and asks only one simple-English clarification round for critical blockers.
28
28
  3. `SKILL.md` routes to the appropriate app-development subskill.
29
- 4. For full generation, `SKILL.md` first loads `assets/routing-catalog-main.json`, `assets/routing-load-policy.json`, and `assets/apexlang/domains-catalog.json`, then opens the narrow matching README package plus `assets/apex-generation/components.registry.json` only when needed.
30
- 5. The execution subskill loads minimal rules using `assets/rules-mapping.json`.
31
- 6. The execution subskill runs one internal generate -> review -> fix loop with confidence gates.
32
- 7. The execution subskill must run local repo validation against the temporary working copy before any SQLcl roundtrip for generated APEX artifacts.
29
+ 4. For full generation, use the frozen application spec and UX contract to select each implementation unit. The resolver queries the component registry; the model receives only selected component routes, not the full registry.
30
+ 5. Resolve a fresh task-specific `context resolve` capsule for each implementation unit; do not retain prior unit capsules.
31
+ 6. Run generate -> unit-local review -> deterministic repair for that unit. Do not retain prior unit capsules or re-run whole-app validation after every page.
32
+ 7. After all units are assembled, run one full local integration validation and compiler-truth audit against the temporary working copy before any SQLcl roundtrip.
33
33
  8. Only after the local first-pass check runs may the workflow perform the live APEXlang check through the selected live runtime path under `references/ops/runtime-gates/02-direct-sqlcl-validate-gate.md`.
34
34
  9. If a sandboxed build-root runtime attempt fails before real `apex validate` / `apex import` output because of filesystem/setup errors such as `EPERM`, `ENOENT`, or build-root `workdir/*` write failures, treat that as an environment blocker, not a DSL defect, and escalate immediately to the real live build-root roundtrip.
35
- 10. If the runtime/import path fails, each real live retry must feed findings back into critique/revision, rerun local DSL validation, and then rerun the real SQLcl roundtrip; do not use blind unchanged retries.
35
+ 10. If the runtime/import path fails, each real live retry must feed findings back into the identified unit critique/revision, rerun local integration validation, and then rerun the real SQLcl roundtrip; do not use blind unchanged retries.
36
36
  11. A run may attempt the live APEXlang check at most 3 times. After the third failed live check attempt, stop and surface the owning layer plus remaining blocker.
37
37
  12. Default every APEX artifact workflow to check-only before live SQLcl execution; in user-facing responses, label that choice as `Check APEXlang code`. After the live APEXlang check passes, offer GUI/clickable choices labeled `Check APEXlang code` or `Check and import APEXlang code`.
38
38
  13. If GUI choices are unavailable, stop after checking the code and report import as a follow-up.