codeplain 0.3.13.dev47__tar.gz → 0.3.13.dev49__tar.gz

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 (292) hide show
  1. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/publish-to-pypi.yml +38 -1
  2. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/PKG-INFO +2 -2
  3. codeplain-0.3.13.dev49/concept_utils.py +3 -0
  4. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/file_utils.py +6 -106
  5. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code.py +38 -5
  6. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_exceptions.py +12 -42
  7. codeplain-0.3.13.dev49/plain2code_nodes.py +3 -0
  8. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_utils.py +1 -16
  9. codeplain-0.3.13.dev49/plain_file.py +3 -0
  10. codeplain-0.3.13.dev49/plain_spec.py +37 -0
  11. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/pyproject.toml +6 -3
  12. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/requirements.txt +5 -2
  13. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_file_utils.py +1 -70
  14. codeplain-0.3.13.dev49/tests/test_render_range.py +42 -0
  15. codeplain-0.3.13.dev49/tests/test_user_error_message.py +36 -0
  16. codeplain-0.3.13.dev47/concept_utils.py +0 -221
  17. codeplain-0.3.13.dev47/plain2code_nodes.py +0 -119
  18. codeplain-0.3.13.dev47/plain_file.py +0 -871
  19. codeplain-0.3.13.dev47/plain_spec.py +0 -441
  20. codeplain-0.3.13.dev47/tests/data/imports/circular_imports_1.plain +0 -8
  21. codeplain-0.3.13.dev47/tests/data/imports/circular_imports_2.plain +0 -8
  22. codeplain-0.3.13.dev47/tests/data/imports/circular_imports_main.plain +0 -12
  23. codeplain-0.3.13.dev47/tests/data/imports/diamond_import_1.plain +0 -16
  24. codeplain-0.3.13.dev47/tests/data/imports/diamond_import_2.plain +0 -16
  25. codeplain-0.3.13.dev47/tests/data/imports/diamond_import_common.plain +0 -11
  26. codeplain-0.3.13.dev47/tests/data/imports/diamond_imports_main.plain +0 -13
  27. codeplain-0.3.13.dev47/tests/data/imports/import_with_functionalities.plain +0 -7
  28. codeplain-0.3.13.dev47/tests/data/imports/imports_module_with_functionalities.plain +0 -12
  29. codeplain-0.3.13.dev47/tests/data/imports/non_existent_import.plain +0 -12
  30. codeplain-0.3.13.dev47/tests/data/plainfile/add_new_task_modal_specification.yaml +0 -1
  31. codeplain-0.3.13.dev47/tests/data/plainfile/duplicate_specification_heading.plain +0 -7
  32. codeplain-0.3.13.dev47/tests/data/plainfile/empty_functional_specs_section.plain +0 -4
  33. codeplain-0.3.13.dev47/tests/data/plainfile/invalid_specification_order.plain +0 -7
  34. codeplain-0.3.13.dev47/tests/data/plainfile/missing_non_functional_requirements.plain +0 -5
  35. codeplain-0.3.13.dev47/tests/data/plainfile/no_functional_specs_section.plain +0 -5
  36. codeplain-0.3.13.dev47/tests/data/plainfile/plain_source_with_absolute_link.plain +0 -9
  37. codeplain-0.3.13.dev47/tests/data/plainfile/plain_source_with_missing_link.plain +0 -9
  38. codeplain-0.3.13.dev47/tests/data/plainfile/plain_source_with_url_link.plain +0 -9
  39. codeplain-0.3.13.dev47/tests/data/plainfile/task_list_ui_specification.yaml +0 -1
  40. codeplain-0.3.13.dev47/tests/data/plainfile/task_manager_with_reference_links.plain +0 -40
  41. codeplain-0.3.13.dev47/tests/data/plainfile/without_non_functional_requirement.plain +0 -5
  42. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_acceptance_tests.plain +0 -20
  43. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_acceptance_tests_nondefined.plain +0 -20
  44. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_defined_nondefined.plain +0 -18
  45. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_defined_nondefined_2.plain +0 -18
  46. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_definition.plain +0 -16
  47. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_noconcepts.plain +0 -18
  48. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_nonconcept.plain +0 -15
  49. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_nondefined.plain +0 -18
  50. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_redefinition.plain +0 -19
  51. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_several_concepts.plain +0 -13
  52. codeplain-0.3.13.dev47/tests/data/plainfileparser/concept_validation_valid.plain +0 -16
  53. codeplain-0.3.13.dev47/tests/data/plainfileparser/cyclic_definitions.plain +0 -9
  54. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts.plain +0 -13
  55. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_base.plain +0 -2
  56. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_defaults_exported.plain +0 -13
  57. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_example.plain +0 -13
  58. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_imported_exported.plain +0 -12
  59. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_inherited_reexported.plain +0 -15
  60. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_malformed.plain +0 -13
  61. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_missing_definition.plain +0 -14
  62. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_missing_definition_example.plain +0 -13
  63. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_multiple_per_bullet.plain +0 -14
  64. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_multiple_per_bullet_undefined.plain +0 -13
  65. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_nested.plain +0 -15
  66. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_nested_example.plain +0 -13
  67. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_no_definitions.plain +0 -10
  68. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_not_declared.plain +0 -8
  69. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_not_declared_example.plain +0 -13
  70. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_transitive_example.plain +0 -13
  71. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_transitive_l1.plain +0 -13
  72. codeplain-0.3.13.dev47/tests/data/plainfileparser/exported_concepts_transitive_l2.plain +0 -13
  73. codeplain-0.3.13.dev47/tests/data/plainfileparser/plain_file_parser_with_comments.plain +0 -8
  74. codeplain-0.3.13.dev47/tests/data/plainfileparser/plain_file_with_comments_indented.plain +0 -10
  75. codeplain-0.3.13.dev47/tests/data/plainfileparser/regular_plain_source.plain +0 -11
  76. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts.plain +0 -7
  77. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_defs.plain +0 -2
  78. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_example.plain +0 -13
  79. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_l1.plain +0 -7
  80. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_l2.plain +0 -5
  81. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_missing.plain +0 -10
  82. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_module.plain +0 -11
  83. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_partial.plain +0 -13
  84. codeplain-0.3.13.dev47/tests/data/plainfileparser/required_concepts_partial_duplicate.plain +0 -14
  85. codeplain-0.3.13.dev47/tests/data/plainfileparser/requires_without_definitions_example.plain +0 -10
  86. codeplain-0.3.13.dev47/tests/data/plainfileparser/topological_sort.plain +0 -14
  87. codeplain-0.3.13.dev47/tests/data/plainfileparser/topological_sort_not_referenced.plain +0 -22
  88. codeplain-0.3.13.dev47/tests/data/requires/circular_requires_main.plain +0 -18
  89. codeplain-0.3.13.dev47/tests/data/requires/circular_requires_sub.plain +0 -12
  90. codeplain-0.3.13.dev47/tests/data/requires/diamond_requires_1.plain +0 -12
  91. codeplain-0.3.13.dev47/tests/data/requires/diamond_requires_2.plain +0 -12
  92. codeplain-0.3.13.dev47/tests/data/requires/diamond_requires_common.plain +0 -7
  93. codeplain-0.3.13.dev47/tests/data/requires/diamond_requires_main.plain +0 -19
  94. codeplain-0.3.13.dev47/tests/data/requires/independent_requires_1.plain +0 -7
  95. codeplain-0.3.13.dev47/tests/data/requires/independent_requires_2.plain +0 -7
  96. codeplain-0.3.13.dev47/tests/data/requires/independent_requires_main.plain +0 -19
  97. codeplain-0.3.13.dev47/tests/data/requires/non_existent_require.plain +0 -18
  98. codeplain-0.3.13.dev47/tests/data/requires/normal_requires_1.plain +0 -12
  99. codeplain-0.3.13.dev47/tests/data/requires/normal_requires_2.plain +0 -12
  100. codeplain-0.3.13.dev47/tests/data/requires/normal_requires_common.plain +0 -7
  101. codeplain-0.3.13.dev47/tests/data/requires/normal_requires_main.plain +0 -19
  102. codeplain-0.3.13.dev47/tests/data/sample_base64_image.txt +0 -1
  103. codeplain-0.3.13.dev47/tests/data/simple.plain +0 -7
  104. codeplain-0.3.13.dev47/tests/data/templates/block_level_include.plain +0 -12
  105. codeplain-0.3.13.dev47/tests/data/templates/code_variables.plain +0 -10
  106. codeplain-0.3.13.dev47/tests/data/templates/header.plain +0 -7
  107. codeplain-0.3.13.dev47/tests/data/templates/implement.plain +0 -3
  108. codeplain-0.3.13.dev47/tests/data/templates/implement_2.plain +0 -3
  109. codeplain-0.3.13.dev47/tests/data/templates/template_include.plain +0 -4
  110. codeplain-0.3.13.dev47/tests/data/templates/test_hardest_problem.plain +0 -2
  111. codeplain-0.3.13.dev47/tests/test_imports.py +0 -53
  112. codeplain-0.3.13.dev47/tests/test_plainfile.py +0 -271
  113. codeplain-0.3.13.dev47/tests/test_plainfileparser.py +0 -775
  114. codeplain-0.3.13.dev47/tests/test_plainspec.py +0 -103
  115. codeplain-0.3.13.dev47/tests/test_requires.py +0 -28
  116. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.claude/settings.json +0 -0
  117. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.flake8 +0 -0
  118. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/dependabot.yml +0 -0
  119. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/e2e.yml +0 -0
  120. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/lint-and-test.yml +0 -0
  121. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/lint-powershell.yml +0 -0
  122. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/notify-slack-on-main-merge.yml +0 -0
  123. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/publish-dev-to-pypi.yml +0 -0
  124. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.github/workflows/publish-install-script.yml +0 -0
  125. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.gitignore +0 -0
  126. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.vscode/launch.json +0 -0
  127. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/.vscode/settings.json +0 -0
  128. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/CLAUDE.md +0 -0
  129. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/CONTRIBUTING.md +0 -0
  130. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/LICENSE +0 -0
  131. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/README.md +0 -0
  132. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/change_detection.py +0 -0
  133. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/cli_output/__init__.py +0 -0
  134. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/cli_output/dry_run.py +0 -0
  135. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/cli_output/render_summary.py +0 -0
  136. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/cli_output/status.py +0 -0
  137. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/codeplain_REST_api.py +0 -0
  138. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/config/__init__.py +0 -0
  139. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/config/system_config.yaml +0 -0
  140. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/conformance_fix_journal.py +0 -0
  141. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/diff_utils.py +0 -0
  142. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/docs/generate_cli.py +0 -0
  143. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/docs/plain2code_cli.md +0 -0
  144. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/docs/starting_a_plain_project_from_scratch.md +0 -0
  145. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/event_bus.py +0 -0
  146. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_golang/config.yaml +0 -0
  147. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_golang/harness_tests/hello_world_test.go +0 -0
  148. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_golang/hello_world_golang.plain +0 -0
  149. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_golang/run.sh +0 -0
  150. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_python/config.yaml +0 -0
  151. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_python/harness_tests/hello_world_display/test_hello_world.py +0 -0
  152. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_python/hello_world_python.plain +0 -0
  153. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_python/run.sh +0 -0
  154. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/config.yaml +0 -0
  155. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress/e2e/hello_world.cy.ts +0 -0
  156. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress/support/e2e.ts +0 -0
  157. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/harness_tests/hello_world_display/cypress.config.ts +0 -0
  158. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/harness_tests/hello_world_display/package.json +0 -0
  159. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/harness_tests/hello_world_display/tsconfig.json +0 -0
  160. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/hello_world_react.plain +0 -0
  161. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/example_hello_world_react/run.sh +0 -0
  162. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/examples/run.sh +0 -0
  163. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/git_preflight.py +0 -0
  164. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/git_utils.py +0 -0
  165. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/install/bash/examples.sh +0 -0
  166. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/install/bash/install.sh +0 -0
  167. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/install/bash/walkthrough.sh +0 -0
  168. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/install/powershell/examples.ps1 +0 -0
  169. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/install/powershell/install.ps1 +0 -0
  170. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/install/powershell/walkthrough.ps1 +0 -0
  171. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/memory_management.py +0 -0
  172. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/metadata_utils.py +0 -0
  173. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/module_renderer.py +0 -0
  174. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/partial_rendering.py +0 -0
  175. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/path_resolution.py +0 -0
  176. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_arguments.py +0 -0
  177. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_cli.md +0 -0
  178. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_console.py +0 -0
  179. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_events.py +0 -0
  180. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_logger.py +0 -0
  181. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_read_config.py +0 -0
  182. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_state.py +0 -0
  183. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain2code_telemetry.py +0 -0
  184. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/plain_modules.py +0 -0
  185. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/pytest.ini +0 -0
  186. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/__init__.py +0 -0
  187. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/analyze_specification_ambiguity.py +0 -0
  188. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/base_action.py +0 -0
  189. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/commit_conformance_tests_changes.py +0 -0
  190. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/commit_implementation_code_changes.py +0 -0
  191. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/create_dist.py +0 -0
  192. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/distill_conformance_test_memory.py +0 -0
  193. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/exit_with_error.py +0 -0
  194. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/finish_functional_requirement.py +0 -0
  195. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/fix_conformance_test.py +0 -0
  196. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/fix_unit_tests.py +0 -0
  197. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/prepare_repositories.py +0 -0
  198. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/prepare_testing_environment.py +0 -0
  199. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/refactor_code.py +0 -0
  200. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/render_conformance_tests.py +0 -0
  201. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/render_functional_requirement.py +0 -0
  202. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/run_conformance_tests.py +0 -0
  203. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/run_unit_tests.py +0 -0
  204. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/actions/summarize_conformance_tests.py +0 -0
  205. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/agent_tools.py +0 -0
  206. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/code_renderer.py +0 -0
  207. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/conformance_tests.py +0 -0
  208. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/implementation_code_helpers.py +0 -0
  209. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/render_context.py +0 -0
  210. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/render_types.py +0 -0
  211. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/render_utils.py +0 -0
  212. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/state_machine_config.py +0 -0
  213. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/states.py +0 -0
  214. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/render_machine/triggers.py +0 -0
  215. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/resources/codeplain_overview.png +0 -0
  216. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/resources/plain_example.png +0 -0
  217. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/standard_template_library/golang-console-app-template.plain +0 -0
  218. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/standard_template_library/python-console-app-template.plain +0 -0
  219. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/standard_template_library/typescript-react-app-boilerplate.plain +0 -0
  220. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/standard_template_library/typescript-react-app-template.plain +0 -0
  221. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/system_config.py +0 -0
  222. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_conformance_tests_cypress.ps1 +0 -0
  223. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_conformance_tests_cypress.sh +0 -0
  224. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_conformance_tests_golang.ps1 +0 -0
  225. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_conformance_tests_golang.sh +0 -0
  226. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_conformance_tests_python.ps1 +0 -0
  227. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_conformance_tests_python.sh +0 -0
  228. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_flutter.ps1 +0 -0
  229. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_flutter.sh +0 -0
  230. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_golang.ps1 +0 -0
  231. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_golang.sh +0 -0
  232. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_python.ps1 +0 -0
  233. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_python.sh +0 -0
  234. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_react.ps1 +0 -0
  235. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/test_scripts/run_unittests_react.sh +0 -0
  236. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/__init__.py +0 -0
  237. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/conftest.py +0 -0
  238. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/acceptance_tests_warning/main_requiring_acceptance_tests.plain +0 -0
  239. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/acceptance_tests_warning/required_with_acceptance_tests.plain +0 -0
  240. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/partial_rendering/pr_code_var.plain +0 -0
  241. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/partial_rendering/pr_implement.plain +0 -0
  242. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/partial_rendering/pr_leaf.plain +0 -0
  243. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/partial_rendering/pr_middle.plain +0 -0
  244. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/partial_rendering/pr_root.plain +0 -0
  245. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/data/partial_rendering/pr_solo.plain +0 -0
  246. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/e2e/Dockerfile +0 -0
  247. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/e2e/conftest.py +0 -0
  248. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/e2e/test_hello_world_python.py +0 -0
  249. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/e2e/test_hello_world_python_windows.py +0 -0
  250. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_agent_tools.py +0 -0
  251. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_arg_provenance.py +0 -0
  252. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_change_detection.py +0 -0
  253. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_cli_output.py +0 -0
  254. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_conformance_fix_journal.py +0 -0
  255. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_console_log_styles.py +0 -0
  256. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_distill_conformance_test_memory.py +0 -0
  257. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_dry_run_link_validation.py +0 -0
  258. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_fix_unit_tests_action.py +0 -0
  259. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_fix_unit_tests_conformance_context.py +0 -0
  260. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_folder_path_resolution.py +0 -0
  261. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_git_preflight.py +0 -0
  262. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_git_utils.py +0 -0
  263. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_headless_logging.py +0 -0
  264. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_log_file_name_resolution.py +0 -0
  265. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_logging_config_path_resolution.py +0 -0
  266. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_partial_rendering.py +0 -0
  267. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_path_resolution.py +0 -0
  268. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_plain2code.py +0 -0
  269. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_plain2code_state.py +0 -0
  270. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_plain2code_utils.py +0 -0
  271. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_plain_modules.py +0 -0
  272. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_prepare_repositories_layout.py +0 -0
  273. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_render_finished_report.py +0 -0
  274. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_render_stop_reason.py +0 -0
  275. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_resolve_config_file.py +0 -0
  276. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_script_path_resolution.py +0 -0
  277. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_system_config.py +0 -0
  278. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_telemetry.py +0 -0
  279. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_terminal_attachment.py +0 -0
  280. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_tui_components.py +0 -0
  281. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_tui_usage.py +0 -0
  282. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tests/test_usage_summary.py +0 -0
  283. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/__init__.py +0 -0
  284. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/components.py +0 -0
  285. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/models.py +0 -0
  286. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/plain2code_tui.py +0 -0
  287. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/plain_module_render_choice_tui.py +0 -0
  288. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/spinner.py +0 -0
  289. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/state_handlers.py +0 -0
  290. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/styles.css +0 -0
  291. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/tui/widget_helpers.py +0 -0
  292. {codeplain-0.3.13.dev47 → codeplain-0.3.13.dev49}/usage_summary.py +0 -0
@@ -14,6 +14,9 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  permissions:
16
16
  contents: write
17
+ outputs:
18
+ # The notify job replies in the start notice's thread.
19
+ slack-ts: ${{ steps.slack-start.outputs.ts }}
17
20
 
18
21
  steps:
19
22
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -23,6 +26,7 @@ jobs:
23
26
 
24
27
  # Non-fatal: Slack being down must not block the release.
25
28
  - name: Notify Slack (start)
29
+ id: slack-start
26
30
  if: ${{ vars.SLACK_CHANNEL_ID != '' }}
27
31
  continue-on-error: true
28
32
  uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
@@ -93,6 +97,13 @@ jobs:
93
97
  if: ${{ !cancelled() && vars.SLACK_CHANNEL_ID != '' }}
94
98
  runs-on: ubuntu-latest
95
99
 
100
+ env:
101
+ # Notices reply in the start notice's thread, quoted so YAML keeps the ts a
102
+ # string. Without a start notice (its post failed or never ran) this is null,
103
+ # which the Slack client drops, and they post to the channel. Failures are
104
+ # also broadcast to the channel; success stays in the thread.
105
+ THREAD_TS: ${{ needs.build.outputs.slack-ts && format('"{0}"', needs.build.outputs.slack-ts) || 'null' }}
106
+
96
107
  steps:
97
108
  - name: Notify Slack (build failure)
98
109
  if: ${{ needs.build.result == 'failure' }}
@@ -103,6 +114,8 @@ jobs:
103
114
  errors: true
104
115
  payload: |
105
116
  channel: ${{ vars.SLACK_CHANNEL_ID }}
117
+ thread_ts: ${{ env.THREAD_TS }}
118
+ reply_broadcast: ${{ env.THREAD_TS != 'null' }}
106
119
  text: >-
107
120
  *Codeplain Client*: Build of `${{ github.ref_name }}` FAILED :x:. Nothing was published to PyPI.
108
121
  See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
@@ -116,6 +129,8 @@ jobs:
116
129
  errors: true
117
130
  payload: |
118
131
  channel: ${{ vars.SLACK_CHANNEL_ID }}
132
+ thread_ts: ${{ env.THREAD_TS }}
133
+ reply_broadcast: ${{ env.THREAD_TS != 'null' }}
119
134
  text: >-
120
135
  *Codeplain Client*: Publishing `${{ github.ref_name }}` to PyPI FAILED :x:.
121
136
  See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
@@ -141,6 +156,7 @@ jobs:
141
156
  errors: true
142
157
  payload: |
143
158
  channel: ${{ vars.SLACK_CHANNEL_ID }}
159
+ thread_ts: ${{ env.THREAD_TS }}
144
160
  text: >-
145
161
  *Codeplain Client*: pre-release `${{ github.ref_name }}` published to PyPI :test_tube:.
146
162
  Normal installs are unaffected — try it with `pip install --pre codeplain==${{ steps.version.outputs.version }}`.
@@ -154,10 +170,27 @@ jobs:
154
170
  errors: true
155
171
  payload: |
156
172
  channel: ${{ vars.SLACK_CHANNEL_ID }}
173
+ thread_ts: ${{ env.THREAD_TS }}
157
174
  text: >-
158
175
  *Codeplain Client*: `${{ github.ref_name }}` published to PyPI :white_check_mark:.
159
176
  Install with `pip install --upgrade codeplain`.
160
177
 
178
+ # Success also puts a ✅ on the start notice, so the result shows in the
179
+ # channel without another message. Needs the app's reactions:write scope.
180
+ # Non-fatal: the result is already posted, and a re-run gets already_reacted.
181
+ - name: Notify Slack (✅ on the start notice)
182
+ if: ${{ needs.publish-to-pypi.result == 'success' && env.THREAD_TS != 'null' }}
183
+ continue-on-error: true
184
+ uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
185
+ with:
186
+ method: reactions.add
187
+ token: ${{ secrets.SLACK_BOT_TOKEN }}
188
+ errors: true
189
+ payload: |
190
+ channel: ${{ vars.SLACK_CHANNEL_ID }}
191
+ timestamp: ${{ env.THREAD_TS }}
192
+ name: white_check_mark
193
+
161
194
  # Release pipelines to be turned on only after the rest of the infrastructure
162
195
  # is ready.
163
196
  #
@@ -165,7 +198,7 @@ jobs:
165
198
  # # keeps its minimal permissions and no checkout.
166
199
  # linear-release:
167
200
  # name: Record release in Linear
168
- # needs: publish-to-pypi
201
+ # needs: [build, publish-to-pypi]
169
202
  # runs-on: ubuntu-latest
170
203
  #
171
204
  # permissions:
@@ -192,6 +225,9 @@ jobs:
192
225
  # # outcome — `failure()` would never fire.
193
226
  # - name: Notify Slack (release not recorded)
194
227
  # if: ${{ steps.linear.outcome == 'failure' && vars.SLACK_CHANNEL_ID != '' }}
228
+ # env:
229
+ # # See the notify job.
230
+ # THREAD_TS: ${{ needs.build.outputs.slack-ts && format('"{0}"', needs.build.outputs.slack-ts) || 'null' }}
195
231
  # uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
196
232
  # with:
197
233
  # method: chat.postMessage
@@ -199,6 +235,7 @@ jobs:
199
235
  # errors: true
200
236
  # payload: |
201
237
  # channel: ${{ vars.SLACK_CHANNEL_ID }}
238
+ # thread_ts: ${{ env.THREAD_TS }}
202
239
  # text: >-
203
240
  # *Codeplain Client*: `${{ github.ref_name }}` is on PyPI, but recording it in Linear FAILED :warning:.
204
241
  # See <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|the run log>.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codeplain
3
- Version: 0.3.13.dev47
3
+ Version: 0.3.13.dev49
4
4
  Summary: Transform plain language specifications into working code
5
5
  License-File: LICENSE
6
6
  Classifier: Environment :: Console
@@ -10,7 +10,7 @@ Classifier: Topic :: Software Development :: Code Generators
10
10
  Requires-Python: ==3.11.*
11
11
  Requires-Dist: gitpython==3.2.1
12
12
  Requires-Dist: mistletoe==1.6.0
13
- Requires-Dist: networkx==3.6.1
13
+ Requires-Dist: plain-parser==0.1.4
14
14
  Requires-Dist: python-frontmatter==1.3.0
15
15
  Requires-Dist: python-liquid2==0.4.0
16
16
  Requires-Dist: pyyaml==6.0.3
@@ -0,0 +1,3 @@
1
+ """Compatibility shim: the parser now lives in the ``plain-parser`` package."""
2
+
3
+ from plain_parser.concept_utils import * # noqa: F401,F403
@@ -3,14 +3,14 @@ import shutil
3
3
  import stat
4
4
  from pathlib import Path
5
5
 
6
- from liquid2 import Environment, FileSystemLoader, StrictUndefined
7
- from liquid2.exceptions import UndefinedError
6
+ from plain_parser.loaders import ( # noqa: F401
7
+ TrackingFileSystemLoader,
8
+ get_loaded_templates,
9
+ load_linked_resources,
10
+ open_from,
11
+ )
8
12
 
9
- import plain_spec
10
13
  from plain2code_console import console
11
- from plain2code_exceptions import UnsupportedBase64Content, UnsupportedResourceType
12
- from plain2code_nodes import Plain2CodeIncludeTag, Plain2CodeLoaderMixin
13
- from plain2code_utils import find_large_base64_blob
14
14
  from plain_modules import CODEPLAIN_MEMORY_SUBFOLDER, CODEPLAIN_METADATA_FOLDER
15
15
 
16
16
  BINARY_FILE_EXTENSIONS = [".pyc"]
@@ -183,106 +183,6 @@ def store_response_files(target_folder, response_files, existing_files):
183
183
  return existing_files
184
184
 
185
185
 
186
- def open_from(dirs, file_name):
187
- for dir in dirs:
188
- full_file_name = os.path.join(dir, file_name)
189
- if not os.path.isfile(full_file_name):
190
- continue
191
-
192
- with open(full_file_name, "rb") as f:
193
- content = f.read()
194
- return content.decode("utf-8")
195
-
196
- return None
197
-
198
-
199
- def resolve_linked_resource(dirs, file_name):
200
- """Return the first existing path for file_name across dirs, or None if not found.
201
-
202
- Mirrors the search order used by open_from so that validating a linked resource and
203
- loading it can never disagree.
204
- """
205
- for dir in dirs:
206
- full_file_name = os.path.join(dir, file_name)
207
- if os.path.exists(full_file_name):
208
- return full_file_name
209
-
210
- return None
211
-
212
-
213
- def load_linked_resources(template_dirs: list[str], resources_list, module_name: str):
214
- linked_resources = {}
215
-
216
- for resource in resources_list:
217
- file_name = resource["target"]
218
- if file_name in linked_resources:
219
- continue
220
-
221
- try:
222
- content = open_from(template_dirs, file_name)
223
- except UnicodeDecodeError:
224
- raise UnsupportedResourceType(
225
- f"Referenced resource '{file_name}' in module '{module_name}' is a binary file. "
226
- f"Only text files (e.g. .md, .txt, .json, .yaml) can be referenced from a .plain file."
227
- )
228
-
229
- if content is None:
230
- raise FileNotFoundError(f"""
231
- Resource file {file_name} not found. Resource files are searched in the following order (highest to lowest precedence):
232
-
233
- 1. The directory containing your .plain file
234
- 2. The directory specified by --template-dir (if provided)
235
- 3. The built-in 'standard_template_library' directory
236
-
237
- Please ensure that the resource exists in one of these locations, or specify the correct --template-dir if using custom templates.
238
- """)
239
-
240
- blob = find_large_base64_blob(content)
241
- if blob is not None:
242
- raise UnsupportedBase64Content(
243
- f"Referenced resource '{file_name}' in module '{module_name}' contains a large "
244
- f"base64-encoded blob ({len(blob)} characters), such as an embedded image. Inline "
245
- "base64 data is not supported. Remove the data from the resource. "
246
- "If the data should be used by the end software, "
247
- "save the data to a separate file and include the file path in the specification without it being a reference file."
248
- )
249
-
250
- linked_resources[file_name] = content
251
-
252
- return linked_resources
253
-
254
-
255
- class TrackingFileSystemLoader(Plain2CodeLoaderMixin, FileSystemLoader):
256
- def __init__(self, *args, **kwargs):
257
- super().__init__(*args, **kwargs)
258
- self.loaded_templates = {}
259
-
260
- def get_source(self, environment, template_name, **kwargs):
261
- source = super().get_source(environment, template_name, **kwargs)
262
- self.loaded_templates[template_name] = source.source
263
- return source
264
-
265
-
266
- def get_loaded_templates(source_path, plain_source):
267
- # Render the plain source with Liquid templating engine
268
- # to identify the templates that are being loaded
269
-
270
- liquid_loader = TrackingFileSystemLoader(source_path)
271
- liquid_env = Environment(loader=liquid_loader, undefined=StrictUndefined)
272
- liquid_env.tags["include"] = Plain2CodeIncludeTag(liquid_env)
273
-
274
- liquid_env.filters["code_variable"] = plain_spec.code_variable_liquid_filter
275
- liquid_env.filters["prohibited_chars"] = plain_spec.prohibited_chars_liquid_filter
276
-
277
- plain_source_template = liquid_env.from_string(plain_source)
278
- try:
279
- plain_source = plain_source_template.render()
280
- except UndefinedError as e:
281
- raise Exception(f"Undefined liquid variable: {str(e)}")
282
-
283
- return plain_source, liquid_loader.loaded_templates
284
-
285
-
286
186
  def update_build_folder_with_rendered_files(build_folder, existing_files, response_files):
287
187
  changed_files = set()
288
188
  changed_files.update(response_files.keys())
@@ -59,6 +59,39 @@ from tui.plain2code_tui import Plain2CodeTUI
59
59
  from tui.plain_module_render_choice_tui import PlainModuleRenderChoiceTUI
60
60
 
61
61
  DEFAULT_TEMPLATE_DIRS = "standard_template_library"
62
+
63
+ # Search-order guidance appended to lookup failures raised by the parser, which only
64
+ # reports the missing file. The wording is the CLI's: it knows what the template
65
+ # directories are and how the user changes them.
66
+ TEMPLATE_NOT_FOUND_HINT = f"""
67
+ The required template could not be found. Templates are searched in the following order (highest to lowest precedence):
68
+
69
+ 1. The directory containing your .plain file
70
+ 2. The directory specified by --template-dir (if provided)
71
+ 3. The built-in '{DEFAULT_TEMPLATE_DIRS}' directory
72
+
73
+ Please ensure that the missing template exists in one of these locations, or specify the correct --template-dir if using custom templates.
74
+ """
75
+
76
+ RESOURCE_NOT_FOUND_HINT = f""" Resource files are searched in the following order (highest to lowest precedence):
77
+
78
+ 1. The directory containing your .plain file
79
+ 2. The directory specified by --template-dir (if provided)
80
+ 3. The built-in '{DEFAULT_TEMPLATE_DIRS}' directory
81
+
82
+ Please ensure that the resource exists in one of these locations, or specify the correct --template-dir if using custom templates."""
83
+
84
+
85
+ def user_error_message(e: BaseException) -> str:
86
+ """Format an exception for the user, appending search-order guidance to lookup failures."""
87
+ message = str(e) if str(e) else repr(e)
88
+ if isinstance(e, TemplateNotFoundError):
89
+ return message + TEMPLATE_NOT_FOUND_HINT
90
+ if isinstance(e, FileNotFoundError):
91
+ return message + RESOURCE_NOT_FOUND_HINT
92
+ return message
93
+
94
+
62
95
  RENDER_THREAD_SHUTDOWN_TIMEOUT = 0.7
63
96
 
64
97
  # The terminal states a render can reach, as the API names them.
@@ -371,7 +404,7 @@ def render( # noqa: C901
371
404
  except Exception as e:
372
405
  run_state.set_render_succeeded(False)
373
406
  render_error.append(e)
374
- event_bus.publish(RenderFailed(error_message=str(e)))
407
+ event_bus.publish(RenderFailed(error_message=user_error_message(e)))
375
408
 
376
409
  if args.headless:
377
410
  console.info(f"Render started. Render ID: {run_state.render_id}")
@@ -446,7 +479,7 @@ def main(): # noqa: C901
446
479
  console.info("Full plain text:\n")
447
480
  console.info(full_plain_source)
448
481
  except Exception as e:
449
- console.error(f"Error: {str(e)}")
482
+ console.error(f"Error: {user_error_message(e)}")
450
483
  return
451
484
 
452
485
  # Parse the plain file (and its required modules) once; reused by dry-run and rendering.
@@ -457,14 +490,14 @@ def main(): # noqa: C901
457
490
  template_dirs,
458
491
  )
459
492
  except Exception as e:
460
- console.error(f"Error: {str(e)}")
493
+ console.error(f"Error: {user_error_message(e)}")
461
494
  return
462
495
 
463
496
  if args.dry_run:
464
497
  try:
465
498
  validate_linked_resources(plain_module)
466
499
  except Exception as e:
467
- console.error(f"Error: {str(e)}")
500
+ console.error(f"Error: {user_error_message(e)}")
468
501
  return
469
502
 
470
503
  console.info("Printing dry run output...\n")
@@ -517,7 +550,7 @@ def main(): # noqa: C901
517
550
  error_message = "Keyboard interrupt"
518
551
  interrupted = True
519
552
  else:
520
- error_message = str(e) if str(e) else repr(e)
553
+ error_message = user_error_message(e)
521
554
 
522
555
  if not isinstance(e, EXPECTED_EXCEPTIONS):
523
556
  exc_info = sys.exc_info()
@@ -1,3 +1,15 @@
1
+ from plain_parser.exceptions import ( # noqa: F401
2
+ ImportedModuleWithFunctionalitiesError,
3
+ InvalidFridArgument,
4
+ InvalidLiquidVariableName,
5
+ MissingFunctionalitiesError,
6
+ ModuleDoesNotExistError,
7
+ PlainSyntaxError,
8
+ UnsupportedBase64Content,
9
+ UnsupportedResourceType,
10
+ )
11
+
12
+
1
13
  class FunctionalRequirementTooComplex(Exception):
2
14
  def __init__(self, message, proposed_breakdown=None):
3
15
  self.message = message
@@ -21,19 +33,6 @@ class MissingResource(Exception):
21
33
  pass
22
34
 
23
35
 
24
- class UnsupportedResourceType(Exception):
25
- pass
26
-
27
-
28
- class PlainSyntaxError(Exception):
29
- pass
30
-
31
-
32
- class UnsupportedBase64Content(Exception):
33
-
34
- pass
35
-
36
-
37
36
  class InternalClientError(Exception):
38
37
  pass
39
38
 
@@ -50,24 +49,12 @@ class OutdatedClientVersion(Exception):
50
49
  pass
51
50
 
52
51
 
53
- class InvalidFridArgument(Exception):
54
- pass
55
-
56
-
57
52
  class InvalidGitRepositoryError(Exception):
58
53
  """Raised when the git repository is in an invalid state."""
59
54
 
60
55
  pass
61
56
 
62
57
 
63
- class InvalidLiquidVariableName(Exception):
64
- pass
65
-
66
-
67
- class ModuleDoesNotExistError(Exception):
68
- pass
69
-
70
-
71
58
  class InternalServerError(Exception):
72
59
  pass
73
60
 
@@ -78,23 +65,6 @@ class MissingPreviousFunctionalitiesError(Exception):
78
65
  pass
79
66
 
80
67
 
81
- class MissingFunctionalitiesError(Exception):
82
- """Raised when a module to be rendered has no functionalities specified at all."""
83
-
84
- pass
85
-
86
-
87
- class ImportedModuleWithFunctionalitiesError(Exception):
88
- """Raised when a module brought in via ``import`` contains functional specs.
89
-
90
- This is a usage error, not a syntax error: the module is syntactically valid
91
- and would be fine as a render target, but functionalities are not allowed in
92
- the import role.
93
- """
94
-
95
- pass
96
-
97
-
98
68
  class NetworkConnectionError(Exception):
99
69
  """Raised when there is a network connectivity issue with the API server."""
100
70
 
@@ -0,0 +1,3 @@
1
+ """Compatibility shim: the parser now lives in the ``plain-parser`` package."""
2
+
3
+ from plain_parser.liquid_nodes import * # noqa: F401,F403
@@ -1,19 +1,4 @@
1
- import re
2
- from typing import Optional
3
-
4
- #
5
- MAX_BASE64_BLOB_LENGTH = 8192
6
-
7
- # Matches a long contiguous base64 / base64url run, optionally preceded by a data: URI header.
8
- _BASE64_BLOB_PATTERN = re.compile(
9
- r"(?:data:[\w.+-]+/[\w.+-]+;base64,)?[A-Za-z0-9+/_-]{%d,}={0,2}" % MAX_BASE64_BLOB_LENGTH
10
- )
11
-
12
-
13
- def find_large_base64_blob(text: str) -> Optional[str]:
14
- """Return the first contiguous base64 blob at or above the threshold, or None."""
15
- match = _BASE64_BLOB_PATTERN.search(text)
16
- return match.group(0) if match else None
1
+ from plain_parser.loaders import MAX_BASE64_BLOB_LENGTH, find_large_base64_blob # noqa: F401
17
2
 
18
3
 
19
4
  def format_duration_hms(total_seconds: float) -> str:
@@ -0,0 +1,3 @@
1
+ """Compatibility shim: the parser now lives in the ``plain-parser`` package."""
2
+
3
+ from plain_parser.plain_file import * # noqa: F401,F403
@@ -0,0 +1,37 @@
1
+ """Compatibility shim: the parser now lives in the ``plain-parser`` package.
2
+
3
+ The render-range helpers below stay here because they read codeplain's CLI
4
+ arguments (``--render-range`` / ``--render-from``); the FRID slicing they wrap
5
+ is ``plain_parser.plain_spec.get_frids_range``.
6
+ """
7
+
8
+ from plain_parser.plain_spec import * # noqa: F401,F403
9
+ from plain_parser.plain_spec import get_frids_range
10
+
11
+
12
+ def get_render_range(render_range, plain_source):
13
+ render_range = render_range.split(",")
14
+ range_end = render_range[1] if len(render_range) == 2 else render_range[0]
15
+
16
+ return get_frids_range(plain_source, render_range[0], range_end)
17
+
18
+
19
+ def get_render_range_from(start, plain_source):
20
+ return get_frids_range(plain_source, start)
21
+
22
+
23
+ def compute_render_range(args, plain_source_tree):
24
+ """Compute render range from --render-range or --render-from arguments.
25
+
26
+ Args:
27
+ args: Parsed command line arguments
28
+ plain_source_tree: Parsed plain source tree
29
+
30
+ Returns:
31
+ List of FRIDs to render, or None to render all
32
+ """
33
+ if args.render_range:
34
+ return get_render_range(args.render_range, plain_source_tree)
35
+ elif args.render_from:
36
+ return get_render_range_from(args.render_from, plain_source_tree)
37
+ return None
@@ -15,8 +15,13 @@ classifiers = [
15
15
  "Topic :: Software Development :: Code Generators",
16
16
  ]
17
17
  dependencies = [
18
- "python-liquid2==0.4.0",
18
+ "plain-parser==0.1.4",
19
+
20
+ # Both transitive via plain-parser; pinned so an automatic mistletoe upgrade doesn't change spec hashes.
19
21
  "mistletoe==1.6.0",
22
+ "python-frontmatter==1.3.0",
23
+
24
+ "python-liquid2==0.4.0",
20
25
  "requests==2.34.2",
21
26
  "tiktoken==0.14.0",
22
27
  "PyYAML==6.0.3",
@@ -24,8 +29,6 @@ dependencies = [
24
29
  "transitions==0.9.3",
25
30
  "textual>=7.5.0",
26
31
  "rich==15.0.0",
27
- "python-frontmatter==1.3.0",
28
- "networkx==3.6.1",
29
32
  "sentry-sdk==2.73.0",
30
33
  ]
31
34
 
@@ -1,6 +1,10 @@
1
- python-liquid2==0.4.0
1
+ plain-parser==0.1.4
2
+
3
+ # Both transitive via plain-parser; pinned so an automatic mistletoe upgrade doesn't change spec hashes.
2
4
  mistletoe==1.6.0
3
5
  python-frontmatter==1.3.0
6
+
7
+ python-liquid2==0.4.0
4
8
  requests==2.34.2
5
9
  rich==15.0.0
6
10
  tiktoken==0.14.0
@@ -8,7 +12,6 @@ PyYAML==6.0.3
8
12
  gitpython==3.2.1
9
13
  pytest==9.1.1
10
14
  textual>=7.5.0
11
- networkx==3.6.1
12
15
  transitions==0.9.3
13
16
  sentry-sdk==2.73.0
14
17
 
@@ -5,9 +5,7 @@ import pytest
5
5
 
6
6
  import file_utils
7
7
  from diff_utils import get_code_diff
8
- from file_utils import get_existing_files_content, load_linked_resources, store_response_files
9
- from plain2code_exceptions import UnsupportedBase64Content, UnsupportedResourceType
10
- from plain2code_utils import MAX_BASE64_BLOB_LENGTH
8
+ from file_utils import get_existing_files_content, store_response_files
11
9
 
12
10
 
13
11
  @pytest.fixture
@@ -16,73 +14,6 @@ def template_dir():
16
14
  yield d
17
15
 
18
16
 
19
- def test_load_linked_resources_text_file(template_dir):
20
- file_path = os.path.join(template_dir, "notes.md")
21
- with open(file_path, "w") as f:
22
- f.write("# hello")
23
-
24
- result = load_linked_resources([template_dir], [{"text": "Notes", "target": "notes.md"}], "my_thing")
25
-
26
- assert result == {"notes.md": "# hello"}
27
-
28
-
29
- def test_load_linked_resources_binary_file_raises_unsupported_resource_type(template_dir):
30
- file_path = os.path.join(template_dir, "icon.png")
31
- with open(file_path, "wb") as f:
32
- f.write(b"\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\xff\xfe\xfd")
33
-
34
- with pytest.raises(UnsupportedResourceType) as exc_info:
35
- load_linked_resources([template_dir], [{"text": "Icon", "target": "icon.png"}], "my_thing")
36
-
37
- assert "icon.png" in str(exc_info.value)
38
- assert "binary file" in str(exc_info.value)
39
- assert "my_thing" in str(exc_info.value)
40
-
41
-
42
- def test_load_linked_resources_missing_file_raises_file_not_found(template_dir):
43
- with pytest.raises(FileNotFoundError):
44
- load_linked_resources([template_dir], [{"text": "Missing", "target": "missing.md"}], "my_thing")
45
-
46
-
47
- def test_load_linked_resources_base64_blob_raises(template_dir):
48
- file_path = os.path.join(template_dir, "request.txt")
49
- with open(file_path, "w") as f:
50
- f.write("curl -d 'selfie_image=" + "A" * (MAX_BASE64_BLOB_LENGTH + 100) + "'")
51
-
52
- with pytest.raises(UnsupportedBase64Content) as exc_info:
53
- load_linked_resources([template_dir], [{"text": "Request", "target": "request.txt"}], "my_thing")
54
-
55
- assert "request.txt" in str(exc_info.value)
56
- assert "my_thing" in str(exc_info.value)
57
-
58
-
59
- def test_load_linked_resources_small_base64_allowed(template_dir):
60
- file_path = os.path.join(template_dir, "token.txt")
61
- with open(file_path, "w") as f:
62
- f.write("token=" + "A" * (MAX_BASE64_BLOB_LENGTH - 100))
63
-
64
- result = load_linked_resources([template_dir], [{"text": "Token", "target": "token.txt"}], "my_thing")
65
-
66
- assert "token.txt" in result
67
-
68
-
69
- def test_load_linked_resources_real_base64_image_raises(template_dir):
70
- # Real base64-encoded JPEG that made Gemini 3 fail, inlined into a curl example resource.
71
- sample_path = os.path.join(os.path.dirname(__file__), "data", "sample_base64_image.txt")
72
- with open(sample_path) as f:
73
- blob = f.read()
74
-
75
- file_path = os.path.join(template_dir, "face_match_request.txt")
76
- with open(file_path, "w") as f:
77
- f.write(f"curl -d 'selfie_image={blob}' https://example.com/face-match")
78
-
79
- with pytest.raises(UnsupportedBase64Content) as exc_info:
80
- load_linked_resources([template_dir], [{"text": "Request", "target": "face_match_request.txt"}], "face_match")
81
-
82
- assert "face_match_request.txt" in str(exc_info.value)
83
- assert str(len(blob)) in str(exc_info.value)
84
-
85
-
86
17
  def test_store_response_files_writes_unicode_as_utf8(template_dir):
87
18
  """A non-cp1252 character (📍 U+1F4CD) is written as UTF-8, whatever the platform's default encoding."""
88
19
  content = "Location 📍 marker\n"
@@ -0,0 +1,42 @@
1
+ from types import SimpleNamespace
2
+
3
+ import pytest
4
+
5
+ import plain_spec
6
+
7
+
8
+ def _four_functionalities():
9
+ return {plain_spec.FUNCTIONAL_REQUIREMENTS: [{"markdown": f"- Functionality {i}."} for i in range(1, 5)]}
10
+
11
+
12
+ def test_get_render_range_parses_start_and_end():
13
+ assert plain_spec.get_render_range("2,3", _four_functionalities()) == ["2", "3"]
14
+
15
+
16
+ def test_get_render_range_single_value_renders_one_frid():
17
+ assert plain_spec.get_render_range("2", _four_functionalities()) == ["2"]
18
+
19
+
20
+ def test_get_render_range_from_runs_to_last_frid():
21
+ assert plain_spec.get_render_range_from("3", _four_functionalities()) == ["3", "4"]
22
+
23
+
24
+ def test_compute_render_range_prefers_render_range():
25
+ args = SimpleNamespace(render_range="1,2", render_from="3")
26
+ assert plain_spec.compute_render_range(args, _four_functionalities()) == ["1", "2"]
27
+
28
+
29
+ def test_compute_render_range_falls_back_to_render_from():
30
+ args = SimpleNamespace(render_range=None, render_from="3")
31
+ assert plain_spec.compute_render_range(args, _four_functionalities()) == ["3", "4"]
32
+
33
+
34
+ def test_compute_render_range_none_when_no_arguments():
35
+ args = SimpleNamespace(render_range=None, render_from=None)
36
+ assert plain_spec.compute_render_range(args, _four_functionalities()) is None
37
+
38
+
39
+ def test_compute_render_range_invalid_frid_raises():
40
+ args = SimpleNamespace(render_range="9", render_from=None)
41
+ with pytest.raises(plain_spec.InvalidFridArgument):
42
+ plain_spec.compute_render_range(args, _four_functionalities())