codeplain 0.3.12.dev26__py3-none-any.whl → 0.3.13__py3-none-any.whl

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 (41) hide show
  1. {codeplain-0.3.12.dev26.dist-info → codeplain-0.3.13.dist-info}/METADATA +8 -8
  2. {codeplain-0.3.12.dev26.dist-info → codeplain-0.3.13.dist-info}/RECORD +36 -35
  3. {codeplain-0.3.12.dev26.dist-info → codeplain-0.3.13.dist-info}/WHEEL +1 -1
  4. codeplain_REST_api.py +26 -32
  5. concept_utils.py +2 -220
  6. file_utils.py +23 -107
  7. module_renderer.py +2 -4
  8. plain2code.py +39 -6
  9. plain2code_arguments.py +30 -0
  10. plain2code_exceptions.py +12 -42
  11. plain2code_nodes.py +2 -118
  12. plain2code_state.py +6 -2
  13. plain2code_utils.py +1 -16
  14. plain_file.py +2 -870
  15. plain_spec.py +9 -413
  16. render_machine/actions/exit_with_error.py +8 -7
  17. render_machine/actions/fix_unit_tests.py +224 -47
  18. render_machine/actions/render_functional_requirement.py +10 -3
  19. render_machine/actions/run_unit_tests.py +9 -0
  20. render_machine/agent_tools.py +270 -0
  21. render_machine/code_renderer.py +0 -3
  22. render_machine/render_context.py +10 -2
  23. render_machine/render_types.py +54 -11
  24. tests/test_agent_tools.py +166 -0
  25. tests/test_arg_provenance.py +20 -0
  26. tests/test_file_utils.py +67 -54
  27. tests/test_fix_unit_tests_action.py +239 -0
  28. tests/test_fix_unit_tests_conformance_context.py +120 -25
  29. tests/test_plain2code_state.py +5 -0
  30. tests/test_render_finished_report.py +1 -0
  31. tests/test_render_range.py +42 -0
  32. tests/test_render_stop_reason.py +210 -0
  33. tests/test_terminal_attachment.py +1 -0
  34. tests/test_user_error_message.py +36 -0
  35. tests/test_imports.py +0 -53
  36. tests/test_plainfile.py +0 -271
  37. tests/test_plainfileparser.py +0 -775
  38. tests/test_plainspec.py +0 -103
  39. tests/test_requires.py +0 -28
  40. {codeplain-0.3.12.dev26.dist-info → codeplain-0.3.13.dist-info}/entry_points.txt +0 -0
  41. {codeplain-0.3.12.dev26.dist-info → codeplain-0.3.13.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codeplain
3
- Version: 0.3.12.dev26
3
+ Version: 0.3.13
4
4
  Summary: Transform plain language specifications into working code
5
5
  License-File: LICENSE
6
6
  Classifier: Environment :: Console
@@ -8,23 +8,23 @@ Classifier: Intended Audience :: Developers
8
8
  Classifier: Operating System :: OS Independent
9
9
  Classifier: Topic :: Software Development :: Code Generators
10
10
  Requires-Python: ==3.11.*
11
- Requires-Dist: gitpython==3.1.59
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
17
17
  Requires-Dist: requests==2.34.2
18
18
  Requires-Dist: rich==15.0.0
19
- Requires-Dist: sentry-sdk==2.68.1
19
+ Requires-Dist: sentry-sdk==2.73.0
20
20
  Requires-Dist: textual>=7.5.0
21
21
  Requires-Dist: tiktoken==0.14.0
22
22
  Requires-Dist: transitions==0.9.3
23
23
  Provides-Extra: dev
24
- Requires-Dist: black==26.5.1; extra == 'dev'
25
- Requires-Dist: flake8==7.3.0; extra == 'dev'
26
- Requires-Dist: isort==8.0.1; extra == 'dev'
27
- Requires-Dist: mypy==2.3.0; extra == 'dev'
24
+ Requires-Dist: black==26.10.1; extra == 'dev'
25
+ Requires-Dist: flake8==7.4.1; extra == 'dev'
26
+ Requires-Dist: isort==9.0.2; extra == 'dev'
27
+ Requires-Dist: mypy==2.4.0; extra == 'dev'
28
28
  Requires-Dist: pytest==9.1.1; extra == 'dev'
29
29
  Description-Content-Type: text/markdown
30
30
 
@@ -1,31 +1,31 @@
1
1
  change_detection.py,sha256=CazORZrezeZSw2I6VBvieN-c2SEjieZPo6pNrKwmMVA,6915
2
- codeplain_REST_api.py,sha256=RGCoPyxzzdshJW96UDmwKjtgMk11iSyIK4iiHMdFIW8,25332
3
- concept_utils.py,sha256=TpyiQ4DfMtO231j-lPj65i0suRTPr8t9j3QNf9KiM4A,8080
2
+ codeplain_REST_api.py,sha256=KJeFKBeVqbTr3RlINqiL5Q4roooJ1ISYlix1_KxqF9w,25262
3
+ concept_utils.py,sha256=vzwC0_0HOZtPerDs7qPmjtyPleQNiuQ4CcmCKoIy7EM,141
4
4
  conformance_fix_journal.py,sha256=7wL3UOc3BWaUo5MCmiFbb3kIwOQ6iEpdQSyEmedo8Vk,9488
5
5
  diff_utils.py,sha256=AjiQlqo5pRos_8hVXZo5yBurl5BzSrTMGrQv4dCtRCg,1198
6
6
  event_bus.py,sha256=g5XLwRfjrvTIcB6urjREuCJzZj5TA93hy8lKXLGXuCE,650
7
- file_utils.py,sha256=IshKvld9LJLwXSB3lxZ1HQyVHa93I626BsTScBu95ss,12118
7
+ file_utils.py,sha256=d46BFIKM97nPTwkiYFoEfTmxAngEajkSKxJbX3orErY,8885
8
8
  git_preflight.py,sha256=vB2A8GyYz_iWr8jOE4POFLBHr3qihmedWuidspGdsrw,1509
9
9
  git_utils.py,sha256=gCUA6_9zg19f6k_0aVcRnIVlAJSBD0Vt6takx-0pKME,16547
10
10
  memory_management.py,sha256=CwIOQqF7Xo1sNfvP69zQRK_CpjinQD9dbolhRPl6lTk,2446
11
11
  metadata_utils.py,sha256=YO17o7IAma5TT1ZN0pTwrLVr_KxFQ8APv02KqKPpI5k,1641
12
- module_renderer.py,sha256=IJBle8mbBARn_xrekjSpsVID7719yy2rNPkM15-ONoI,6982
12
+ module_renderer.py,sha256=OvIgAorSxGwrdTZcKy4hdmNgkdJGh6z6-VzzqrTlRHs,6966
13
13
  partial_rendering.py,sha256=uzZc2j4d3pAXzfiHw_y1TK4yLRsLOb1Mm21570AGxJ8,13837
14
14
  path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
15
- plain2code.py,sha256=8kLrycxLgVrTcgRIDzJzlYcima7psIVNiKNE3P5XPJY,21283
16
- plain2code_arguments.py,sha256=sFpRQkSgU45CTFufEq5pHDSZktgel1ZQMM6oE6fh18E,17698
15
+ plain2code.py,sha256=M4Z2qIHjk9fEYlxINyeKrpCbbv6NpZ5kmTDbGvDLXtc,22840
16
+ plain2code_arguments.py,sha256=7TS2P351jmmyi-l8QKCHG732O3TtQ0kh4qbh14_4oLw,18634
17
17
  plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
18
18
  plain2code_events.py,sha256=rgDF5PDtNr_lEPvJmd1tIQXZrzwgzZW5b-_pykugqe4,1587
19
- plain2code_exceptions.py,sha256=rtFEQbs1ruzSlGXIGJZoZry9sjYzmhPKHiUQIECcbL0,2567
19
+ plain2code_exceptions.py,sha256=zlszHIhaPWPN4fvYQibMIDM7f1xsW5J8sEWTOosIUGc,2068
20
20
  plain2code_logger.py,sha256=YQ-ENYBHKXROVv6Q52xh7eXrFkj_3Lex__N9zfxlw9Y,5729
21
- plain2code_nodes.py,sha256=IwjQqJxRSJKgP6eEnkYGy3VQHIyoazgkFxAEkxkjfJ8,4426
21
+ plain2code_nodes.py,sha256=QCC9RYBBfHycahvYovcN414sRlGL-dqRV3Baeu7KPkw,140
22
22
  plain2code_read_config.py,sha256=D5CxnmTRjddupecWvstcUm0kIJWWzq5-Zmk6sU0wbIg,2235
23
- plain2code_state.py,sha256=uePQlC29Pbhm1yXfdCFebONYdy6jo13gTTmXSwC11cQ,3168
23
+ plain2code_state.py,sha256=jIo4knKI99C1xkX1E_OaD3pdS9pczI2h9wofDjifMvE,3348
24
24
  plain2code_telemetry.py,sha256=e4UCAoFklJMDWGQsL50i7nTLiOBy8gs86A0XO4WLgPo,4597
25
- plain2code_utils.py,sha256=unOxuqSQRpwG8YF6uoQhnZ3ZSTJRIUCPLdJ-1lRZR5M,1534
26
- plain_file.py,sha256=yzdHYBZye1UjI6K-vcod5u9hPqQ_zBQS050yypdmB3M,37614
25
+ plain2code_utils.py,sha256=-MOISy5nwu9szDasckFYe6wOTkEeEAkLaq6deprRg78,1095
26
+ plain_file.py,sha256=50CevjRihjddXbc3WzKKJF_kaVcMHUJ1FH2HJUZawT8,138
27
27
  plain_modules.py,sha256=nXlmw0J2rKkuU1Y3A68LVtZ1Ffdc-D5iMjxaXSaSHTQ,25963
28
- plain_spec.py,sha256=7nb5lLJKHZ3uu9THkSXyJ5brIKkbGW0ooVfRclLdlzA,16062
28
+ plain_spec.py,sha256=AhDbw4GSQ95wC8fkFSPG66MsCu-37Kcz8Skcj66fQhA,1262
29
29
  system_config.py,sha256=sA8wiPmBMtRsLwSQ40U5pVdLazAafbV-1Z19Yp0HiSQ,5314
30
30
  usage_summary.py,sha256=MA4WcVaAwz6IWCN4k_rgxVcwO4I157wN7BZlFi3h0R4,1282
31
31
  cli_output/__init__.py,sha256=MBKl0YbVpWE-tBa3V5_aVbB7vbaqlIK2NsHTjRUZqis,284
@@ -37,11 +37,12 @@ config/system_config.yaml,sha256=of5R9vukSohU9AlkGJOcAVQA1UJgxYmDy6islU6iFuE,508
37
37
  docs/generate_cli.py,sha256=0FHVhICbM8g7ahdInTNih3hNKpty1wbV5rdGECMJj48,656
38
38
  examples/example_hello_world_python/harness_tests/hello_world_display/test_hello_world.py,sha256=dwTowrHiVKKbrDv21v8xJC30Q57AXZkQasdGOO5JsBE,470
39
39
  render_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
- render_machine/code_renderer.py,sha256=-vp_ltU7e3ssX9hbS8IY4ETSp-39JAuoJ3ZltKpdt1M,3959
40
+ render_machine/agent_tools.py,sha256=Kp2g9GphV7oA9MbOHctKp0UJJJUOgcfCz2SeW9NL6jg,12305
41
+ render_machine/code_renderer.py,sha256=ZmisVQHVtI1rBN1qdywW-H_hNeUzVELkHUdApGReYjY,3795
41
42
  render_machine/conformance_tests.py,sha256=PNTCnJNd_xNIhpTPPS8vlx8qws3cTgQSTLdADRab2YM,9617
42
43
  render_machine/implementation_code_helpers.py,sha256=Fxm-IInoZjAIZn41_-WXWj7VIYczpW4yH44Gt8CYMAQ,2378
43
- render_machine/render_context.py,sha256=iaJWI_EMSn51LNF_b7KRvlir46ZgUkjbaEiVgSvMTCI,26314
44
- render_machine/render_types.py,sha256=A5BHAkjmDHQ0pd5rR6THlRY5z6rzrdJdcgZFhN7yw9w,8860
44
+ render_machine/render_context.py,sha256=3lPieD5Rq5wlZUTwFiC4fl5hqruLYOJ0xiZlWcT0dL8,26817
45
+ render_machine/render_types.py,sha256=Z7dNKd4TKyFV214k6nrdXvYPZPfX82FU3qM7iqbYkY8,11552
45
46
  render_machine/render_utils.py,sha256=yA3X15E_Lebk_-MxkSz9rM_qy-Pes8EQ9Ye-smkHCDw,9320
46
47
  render_machine/state_machine_config.py,sha256=0pL4PyrZ5F2UumvHLMRfhyh64M4pDvf-9zEs-5OAEU8,27866
47
48
  render_machine/states.py,sha256=Lu-7upbs9_bjJsy0P738qx5IiN0DzVcFdhF2-m6YjnQ,2067
@@ -52,17 +53,17 @@ render_machine/actions/commit_conformance_tests_changes.py,sha256=08yxCPCpf5Tlrz
52
53
  render_machine/actions/commit_implementation_code_changes.py,sha256=yi51oAArLCgWcmFbynes-BK2IGnZwA7wygrTJGoL8dY,826
53
54
  render_machine/actions/create_dist.py,sha256=ykER7i2OvWAXjrlAZnkQHpiNl00vSMF8WDxNhlWKfsA,1088
54
55
  render_machine/actions/distill_conformance_test_memory.py,sha256=ENjfhTWqRLePHeRF4t8zNRhWKDV2rU4pLYuU_CZhhmo,2639
55
- render_machine/actions/exit_with_error.py,sha256=W6TMULHJcHEaXE4WUnlELEu0_l7IZy9HWaPkXyqg7ck,1279
56
+ render_machine/actions/exit_with_error.py,sha256=bw7seapQg5gE5Ag233SJkjnVW4B-JjHPr50XzG0v1P8,1570
56
57
  render_machine/actions/finish_functional_requirement.py,sha256=usQgPSg6PHpBOR1RhK7lPz9zjY-2VJJDqi3T0nlqdLw,841
57
58
  render_machine/actions/fix_conformance_test.py,sha256=Yy6niLefPIyR3vSxyyX4NUi3NJ4dVc0aEAH9JBCBYX4,11572
58
- render_machine/actions/fix_unit_tests.py,sha256=pqZzp7snSAe967o_kbh1yAhp9pZIMFY9uoJK1HGcCuc,3532
59
+ render_machine/actions/fix_unit_tests.py,sha256=NgfoqCI4XANrA9muAT9bygEEuvqnwTTZGJS4nfsy0WM,13540
59
60
  render_machine/actions/prepare_repositories.py,sha256=HyZ1R6E3H5V-G4WDSGfhxl_arskmW9FcaxNdQr6JjVs,3867
60
61
  render_machine/actions/prepare_testing_environment.py,sha256=kIsXgV6-jOlqp-04cimPgTQoHPrVIu0zW-H_Jj-jowE,2106
61
62
  render_machine/actions/refactor_code.py,sha256=gyPsnqgHseL2bkENu4WeGCRyV0R18_GH3JOrPdoxKvg,2609
62
63
  render_machine/actions/render_conformance_tests.py,sha256=5gOQn-G1T9UWEI8sDfALcVdArk0ln9DgUprOPjccS-U,9268
63
- render_machine/actions/render_functional_requirement.py,sha256=53KzMVlcefoag1x73roCEQvQ7FbmH8FzhXMQau-s8tg,4655
64
+ render_machine/actions/render_functional_requirement.py,sha256=byfASfohbeKNHqyRD5NFJCg6U7q6OVtOF8ocWtjbsws,5110
64
65
  render_machine/actions/run_conformance_tests.py,sha256=yUG6buqp75EOmJYxdM6MmCNF5_G4TUxA-QSTKx7EzxA,3760
65
- render_machine/actions/run_unit_tests.py,sha256=A4WXtSzpCLDHYR8fQAbfxUf_E19GYflZSHZaSreoFPk,2101
66
+ render_machine/actions/run_unit_tests.py,sha256=j0qsHMLy49I_DX5QLlH0OdPT6bPMc0icmVg2N5MYm9U,2711
66
67
  render_machine/actions/summarize_conformance_tests.py,sha256=Vy1kRK8vyazK_BbsKuz1MLDN_TQWVxxzkwEEm-50byc,1639
67
68
  standard_template_library/golang-console-app-template.plain,sha256=JOusEjCj7jagnXUzaI-SdIr3hj1wTo2uShK017aNtVM,949
68
69
  standard_template_library/python-console-app-template.plain,sha256=HW-REeF8Crk0r_w4-MxnleVHeW6PdOB2C8gO8FDG61g,931
@@ -70,42 +71,42 @@ standard_template_library/typescript-react-app-boilerplate.plain,sha256=6LFxhEOz
70
71
  standard_template_library/typescript-react-app-template.plain,sha256=DN5wEJcT8ZqQTf0vFKi9Z1isi9cin2UVNOZb3r28d3M,715
71
72
  tests/__init__.py,sha256=Wk73Io62J15BtlLVIzxmASDWaaJkQLevS4BLK5LDAQg,16
72
73
  tests/conftest.py,sha256=QZcp08htUlJGgmHDlRWFgsWXZ8o8IBWTD5QqJaUMlU8,790
73
- tests/test_arg_provenance.py,sha256=d_J7aCeHMXBpctBWTt60WU-I8pEKN7XRXRTJZZGCdo0,3441
74
+ tests/test_agent_tools.py,sha256=1WQjKlDd1kna5D4fvlLJ1o5DxyjW0wy-9tx8tRPv6Sw,7840
75
+ tests/test_arg_provenance.py,sha256=kUqTcaCxMgbwY0-k_aHf40X1TN-5p7DhLHYrfcgX9N0,4252
74
76
  tests/test_change_detection.py,sha256=jH8SEhndX400DNqIKmcYLzxHqq9WFdgmuvY3XPq-ZFc,13534
75
77
  tests/test_cli_output.py,sha256=9yTk0pD2w6vkiSdSkYwneUmEtNqX4x64F6PzYShUEcw,19331
76
78
  tests/test_conformance_fix_journal.py,sha256=olTeAuxXgFwQ8LSQyt0FqtBy9_XY_gK-Ei_pUuJ0C3M,10389
77
79
  tests/test_console_log_styles.py,sha256=sxlhynMAP-kmqhBn1-pKvZXdCnlKSyCGJqwYKrh6sQ0,6468
78
80
  tests/test_distill_conformance_test_memory.py,sha256=Tftw9l-gLVwIU6QttY03h2VedvuFxpIsCmZIzvWfxMA,5481
79
81
  tests/test_dry_run_link_validation.py,sha256=ivvYXQPqUkQ8glbFyUrdCninCxF2mg-rAsDcfjcB7MM,2140
80
- tests/test_file_utils.py,sha256=R_ZIhrTtwlhHxgmbBtA8PFEU5-QB4Fi5skJ7PS2KzdU,3614
81
- tests/test_fix_unit_tests_conformance_context.py,sha256=IEsXK0xMLRuHmoQGBwrY0ENWVng2n-db_YzSO2qBfqM,9136
82
+ tests/test_file_utils.py,sha256=RPab1wBsbE7XAPGync56WveFVnRvafFVRia1a2mMQhk,4490
83
+ tests/test_fix_unit_tests_action.py,sha256=0xY94BFbYa528LBXmO7_gfVNbQEqdzXsDHPjQV5qfy0,11410
84
+ tests/test_fix_unit_tests_conformance_context.py,sha256=G6-_YMhN5BY1sJ7cAx3BDnf_McgFcRpyP0iP6mwJ1eA,13154
82
85
  tests/test_folder_path_resolution.py,sha256=K9v684xkPE0HOAsovg8uDixpZmaIk7ho-Wd3rTjKLF0,6560
83
86
  tests/test_git_preflight.py,sha256=6aQqInDzpk03pS-6UfkGQWjErrIXTEdHs5oeq3ZYzTw,3186
84
87
  tests/test_git_utils.py,sha256=h3rWhhs4XVRYqzVzdmj51siF_AYD-GkbZiefK2iGfWo,15614
85
88
  tests/test_headless_logging.py,sha256=soNESeotKQaU-SQyxtjpq35l-dLVsauZ_lJ-wk9i2mI,6419
86
- tests/test_imports.py,sha256=1ncbqQhtQW237kIjyV-Ufl7-R-PuduvoYFj2iS-DXW4,2608
87
89
  tests/test_log_file_name_resolution.py,sha256=99g9NgPF-BZ98CvNyqDcltBAx4sLBE8gpQPAAieKiPc,3619
88
90
  tests/test_logging_config_path_resolution.py,sha256=avz_ehRd18INwIXvAy1AwVzNNUz0vS8eu1nRe0bra8g,2650
89
91
  tests/test_partial_rendering.py,sha256=r0RUUd1pI4-2ZkRrM1j8_kUqv-70hrOGjuKBhZoRmH0,22758
90
92
  tests/test_path_resolution.py,sha256=yQpd-Unq1lwNv0wkRPwVs5pDT8JmyyDgbpiTQsyt--Y,2615
91
93
  tests/test_plain2code.py,sha256=lyb7iYK8XHu1dmTFh9Q31YgX0faNlCHiyI5M35VQwOg,3780
92
- tests/test_plain2code_state.py,sha256=cowPZS9oRbv9J49CE4P3Rc47Q5oQOby4bTf2OlnRlBI,1217
94
+ tests/test_plain2code_state.py,sha256=O-sDt4F_lF6XtanWKWfh5IsNmDdfuJP_JoGagujzdfM,1440
93
95
  tests/test_plain2code_utils.py,sha256=-W8a7FquMJQ_pTdBoBF1XprzNL2G555QhdtXCy6BDyQ,1237
94
96
  tests/test_plain_modules.py,sha256=Fn3FeH-M4exnyFJDZzc9YWaLEfBmiqPH5TpiBT9jgAs,33033
95
- tests/test_plainfile.py,sha256=wZ_PN4GULPWIpl_AK_r_6jkgtX0Ch8EHmN5IhX7huOE,11027
96
- tests/test_plainfileparser.py,sha256=OY7dCilaUEeM4vAOShQYsZXKQzzUOi7nGYBaROu8Te8,26606
97
- tests/test_plainspec.py,sha256=ng55E8ajrH2-gPC1p_QDIe_zXplPvoqHJ-d57UWKFTw,3577
98
97
  tests/test_prepare_repositories_layout.py,sha256=PhJQLnHfjfjo6CTWoicyEKgL0_GtjwB2OKYAWSBVHtk,14638
99
- tests/test_render_finished_report.py,sha256=9HTpIYhLptufxPpG1krezYUh6DqUM1V0S_M0XnY3K7E,7648
100
- tests/test_requires.py,sha256=6tnHYaKudxN-RiQjSFoi9nHe_x0ze3QF-f-j67zAE74,1250
98
+ tests/test_render_finished_report.py,sha256=1OaL6S4LSRJ0JwDFu8HFEM02o4ZEn6oPtDpXPasNEVo,7670
99
+ tests/test_render_range.py,sha256=G6gsJfVQ12N487X2VxVmvSOhtWvfYXCKrP2CAKYzgzU,1496
100
+ tests/test_render_stop_reason.py,sha256=13oRRGrZKNyJFD2iDxDrD7VFvmobbtfAFcnKKdiCJT8,8550
101
101
  tests/test_resolve_config_file.py,sha256=b87tDOvyzbsnE-QRWbZ97ou7NuyaAgskv-dbYBum31c,2830
102
102
  tests/test_script_path_resolution.py,sha256=tiEqMevQRXr9YpfHN0xldOOQpLAUgnSqTzeZWkKHaUY,4156
103
103
  tests/test_system_config.py,sha256=gH5qs9q4lh5CljAdz28HUrJzuKqCvkZherFuv7enMak,2787
104
104
  tests/test_telemetry.py,sha256=LINvx1_Oz1OJ3ho2RcIcAA29IsNfUbkVVCbFaQcrBaA,8133
105
- tests/test_terminal_attachment.py,sha256=HQND9_LXxmz3yzEbLF8gwAiWRnnYTGqaT_Ion1aomj4,10463
105
+ tests/test_terminal_attachment.py,sha256=mAJIKr0rXFytytZZm1XENV0T9kPYblhwkRTTtT4SzPs,10485
106
106
  tests/test_tui_components.py,sha256=O_PB6z_Xt7YWebsD21b99PVgFtqq5c03lVtYytIT5Ps,6200
107
107
  tests/test_tui_usage.py,sha256=sfiAGTpRrT3MRr0-8DH3qjuECSxjODVgwzrK_K3iPXs,7959
108
108
  tests/test_usage_summary.py,sha256=Ps0kVzvmdZYeXrBR-cqkn3szTV5neYKs1PmmURngeIc,1079
109
+ tests/test_user_error_message.py,sha256=zQu9SK6oRUyW4p8NPwKnCdHWjx7Sh8iwI_QoFrPFynA,1332
109
110
  tests/e2e/conftest.py,sha256=5Dm67UTOE-M6hMb-mqZvwa6Ek_wmZgsR7fUv9ZEqCwY,4164
110
111
  tests/e2e/test_hello_world_python.py,sha256=2Cgs3-79dtQh5gVab257tFDHXTznefZeYqbTjlM4Nng,1632
111
112
  tests/e2e/test_hello_world_python_windows.py,sha256=ggynH_Wm4011M500zoPNNgvD-s4vZ3hvlorf1yARgQQ,2019
@@ -118,8 +119,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
118
119
  tui/state_handlers.py,sha256=zbUS_D9eU8qIwVpaxPEp9zL9bpg8gXsWNoUaqg9TLrQ,16664
119
120
  tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
120
121
  tui/widget_helpers.py,sha256=jitm2WHiKj-NVFL-hULxWzckPreRbUTl9OIZLN31-ek,6997
121
- codeplain-0.3.12.dev26.dist-info/METADATA,sha256=n5K9GxRJCVM0xiNFrzuQozTnTcFCAqq3xi6Oq3JR6Vk,7257
122
- codeplain-0.3.12.dev26.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
123
- codeplain-0.3.12.dev26.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
124
- codeplain-0.3.12.dev26.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
125
- codeplain-0.3.12.dev26.dist-info/RECORD,,
122
+ codeplain-0.3.13.dist-info/METADATA,sha256=6jZ4kOnS45HV1al99frfTAkmbrRvut3Xh46MQ8bKSPw,7255
123
+ codeplain-0.3.13.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
124
+ codeplain-0.3.13.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
125
+ codeplain-0.3.13.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
126
+ codeplain-0.3.13.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
codeplain_REST_api.py CHANGED
@@ -308,38 +308,6 @@ class CodeplainAPI:
308
308
 
309
309
  return self.post_request(endpoint_url, headers, payload, run_state)
310
310
 
311
- def fix_unittests_issue(
312
- self,
313
- frid,
314
- plain_source_tree,
315
- linked_resources,
316
- existing_files_content,
317
- module_name: str,
318
- required_modules,
319
- unittests_issue,
320
- run_state: RunState,
321
- conformance_tests_fixes: list[dict] | None = None,
322
- ):
323
- endpoint_url = f"{self.api_url}/fix_unittests_issue"
324
- headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
325
-
326
- payload = {
327
- "frid": frid,
328
- "plain_source_tree": plain_source_tree,
329
- "linked_resources": linked_resources,
330
- "existing_files_content": existing_files_content,
331
- "module_name": module_name,
332
- "required_modules": required_modules,
333
- "unittests_issue": unittests_issue,
334
- "unittest_batch_id": run_state.unittest_batch_id,
335
- }
336
- # Implementation code changes made by the conformance tests fixer right before this unit tests run;
337
- # only sent when unit tests are processed inside the conformance tests phase.
338
- if conformance_tests_fixes is not None:
339
- payload["conformance_tests_fixes"] = conformance_tests_fixes
340
-
341
- return self.post_request(endpoint_url, headers, payload, run_state)
342
-
343
311
  def distill_conformance_test_memory(
344
312
  self,
345
313
  frid,
@@ -613,3 +581,29 @@ class CodeplainAPI:
613
581
  }
614
582
 
615
583
  return self.post_request(endpoint_url, headers, payload, run_state)
584
+
585
+ def agent_start(self, task_type: str, task_params: dict, frid: str, module_name: str, run_state: RunState):
586
+ """Start a server-side agent session; returns the first turn (tool calls or completion)."""
587
+ endpoint_url = f"{self.api_url}/agent/start"
588
+ headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
589
+ payload = {
590
+ "task_type": task_type,
591
+ "task_params": task_params,
592
+ "frid": frid,
593
+ "module_name": module_name,
594
+ }
595
+ return self.post_request(endpoint_url, headers, payload, run_state)
596
+
597
+ def agent_continue(
598
+ self, session_id: str, tool_results: list[dict], frid: str, module_name: str, run_state: RunState
599
+ ):
600
+ """Feed tool results into an agent session and run its next turn."""
601
+ endpoint_url = f"{self.api_url}/agent/continue"
602
+ headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
603
+ payload = {
604
+ "session_id": session_id,
605
+ "tool_results": tool_results,
606
+ "frid": frid,
607
+ "module_name": module_name,
608
+ }
609
+ return self.post_request(endpoint_url, headers, payload, run_state)
concept_utils.py CHANGED
@@ -1,221 +1,3 @@
1
- import re
2
- from copy import deepcopy
3
- from typing import Optional
1
+ """Compatibility shim: the parser now lives in the ``plain-parser`` package."""
4
2
 
5
- import mistletoe.block_token
6
- import networkx as nx
7
-
8
- import plain_spec
9
- from plain2code_exceptions import PlainSyntaxError
10
-
11
- # These are reserved concept names that are pre-defined and must not be redefined in the definitions section.
12
- DEFAULT_CONCEPTS = {
13
- ":ConformanceTests:",
14
- ":UnitTests:",
15
- ":AcceptanceTest:",
16
- ":AcceptanceTests:",
17
- ":Implementation:",
18
- ":plainDefinitions:",
19
- ":plainImplementationReqs:",
20
- ":plainFunctionality:",
21
- ":plainTestReqs:",
22
- ":plainImplementationCode:",
23
- }
24
-
25
-
26
- def extract_concepts_from_definition(text: str) -> tuple[list[str], list[str]]:
27
- pattern = r"-\s(:[^\:]+:)(?:,\s*:[^\:]+:)*"
28
- match = re.search(pattern, text)
29
-
30
- if not match:
31
- return list(), [
32
- f"Syntax error: Invalid definition specification text: {text}. Should start with `- :<concept>:` (where <concept> is any string that does not contain `:`)."
33
- ]
34
-
35
- concept_candidates = re.findall(r":[^\:]+:", match.group())
36
- valid_concepts = list[str]()
37
- concept_re = r":[+\-\.0-9A-Z_a-z]+:"
38
- errors = list[str]()
39
- for candidate in concept_candidates:
40
- if re.match(concept_re, candidate):
41
- valid_concepts.append(candidate)
42
- else:
43
- errors.append(
44
- f"Syntax error: Invalid concept: {candidate}. Should contain only letters, numbers, hyphens and dots."
45
- )
46
-
47
- return valid_concepts, errors
48
-
49
-
50
- def extract_concepts_from_spec_text(text: str) -> str:
51
- return re.findall(r":[+\-\.0-9A-Z_a-z]+:", text)
52
-
53
-
54
- def collect_concepts(plain_source) -> tuple[set[str], list[str]]:
55
- if plain_spec.DEFINITIONS not in plain_source:
56
- return set(), list()
57
-
58
- concepts = list[str]()
59
- errors = list[str]()
60
- for definition in plain_source[plain_spec.DEFINITIONS]:
61
- spec_text = definition["markdown"]
62
- new_concepts, new_errors = extract_concepts_from_definition(spec_text)
63
- errors.extend(new_errors)
64
- concepts.extend(new_concepts)
65
-
66
- return concepts, errors
67
-
68
-
69
- def validate_concepts_in_spec(spec: dict, concepts: set[str], spec_group: str) -> list[str]:
70
- spec_text = spec["markdown"]
71
- used_concepts = extract_concepts_from_spec_text(spec_text)
72
- errors = []
73
- for used_concept in used_concepts:
74
- if used_concept not in concepts and used_concept not in DEFAULT_CONCEPTS:
75
- errors.append(
76
- f"Syntax error: Concept {used_concept} is not defined in the definitions. {spec_group}: {spec_text}"
77
- )
78
-
79
- return errors
80
-
81
-
82
- def validate_concepts_in_spec_group(spec_group, plain_source, concepts: set[str]) -> list[str]:
83
- if spec_group not in plain_source:
84
- return []
85
-
86
- errors = []
87
- for spec in plain_source[spec_group]:
88
- errors.extend(validate_concepts_in_spec(spec, concepts, spec_group))
89
-
90
- return errors
91
-
92
-
93
- def validate_concepts(marshalled_plain_source) -> list[str]:
94
- errors = list[str]()
95
- concepts = deepcopy(DEFAULT_CONCEPTS)
96
- tree_based_concepts = deepcopy(DEFAULT_CONCEPTS)
97
-
98
- new_concepts, new_errors = collect_concepts(marshalled_plain_source)
99
- errors.extend(new_errors)
100
-
101
- unique_new_concepts = set(new_concepts)
102
- intersection = unique_new_concepts.intersection(concepts)
103
-
104
- if len(unique_new_concepts) < len(new_concepts) or (len(intersection) > 0):
105
- misused_concepts = {concept for concept in new_concepts if new_concepts.count(concept) > 1}
106
- misused_concepts.update(intersection)
107
- errors.append(f"Syntax error: Concepts were defined multiple times: {', '.join(misused_concepts)} .")
108
-
109
- concepts.update(unique_new_concepts)
110
- tmp_tree_based_concepts = tree_based_concepts.union(unique_new_concepts)
111
-
112
- for spec_group in [
113
- plain_spec.NON_FUNCTIONAL_REQUIREMENTS,
114
- plain_spec.TEST_REQUIREMENTS,
115
- plain_spec.FUNCTIONAL_REQUIREMENTS,
116
- plain_spec.DEFINITIONS,
117
- ]:
118
- errors.extend(validate_concepts_in_spec_group(spec_group, marshalled_plain_source, tmp_tree_based_concepts))
119
-
120
- if plain_spec.FUNCTIONAL_REQUIREMENTS in marshalled_plain_source:
121
- for func_spec in marshalled_plain_source[plain_spec.FUNCTIONAL_REQUIREMENTS]:
122
- if "acceptance_tests" not in func_spec:
123
- continue
124
-
125
- acceptance_tests = func_spec["acceptance_tests"]
126
- for spec in acceptance_tests:
127
- errors.extend(validate_concepts_in_spec(spec, tmp_tree_based_concepts, plain_spec.ACCEPTANCE_TESTS))
128
-
129
- return errors
130
-
131
-
132
- def find_concept_definitions_in_plain_source(
133
- concept: str,
134
- plain_source: dict,
135
- renderer,
136
- ) -> list[mistletoe.block_token.token]:
137
- definitions = list[mistletoe.block_token.token]()
138
- if plain_source[plain_spec.DEFINITIONS] is None:
139
- return definitions
140
-
141
- for definition in plain_source[plain_spec.DEFINITIONS].children:
142
- rendered_definition = renderer.render(definition)
143
- defined_concepts, _ = extract_concepts_from_definition(rendered_definition)
144
- if concept in defined_concepts:
145
- definitions.append(definition)
146
- used_concepts = [
147
- used_concept
148
- for used_concept in extract_concepts_from_spec_text(rendered_definition)
149
- if used_concept != concept and used_concept not in DEFAULT_CONCEPTS
150
- ]
151
- for used_concept in used_concepts:
152
- definitions.extend(find_concept_definitions_in_plain_source(used_concept, plain_source, renderer))
153
-
154
- return definitions
155
-
156
-
157
- def build_adjacency_list(definitions: Optional[list[dict]]) -> tuple[dict, dict]:
158
- adjacency_list = dict[str, list[str]]()
159
- concept_definitions = dict[str, dict]()
160
- if definitions is None or len(definitions) == 0:
161
- return adjacency_list, concept_definitions
162
-
163
- for definition in definitions:
164
- def_text = definition["markdown"]
165
- new_concepts, _ = extract_concepts_from_definition(def_text)
166
- used_concepts = [
167
- used_concept
168
- for used_concept in extract_concepts_from_spec_text(def_text)
169
- if used_concept not in new_concepts and used_concept not in DEFAULT_CONCEPTS
170
- ]
171
- used_concepts = set(used_concepts)
172
-
173
- for new_concept in new_concepts:
174
- if new_concept not in adjacency_list:
175
- adjacency_list[new_concept] = []
176
-
177
- for used_concept in used_concepts:
178
- if used_concept not in adjacency_list:
179
- adjacency_list[used_concept] = []
180
-
181
- adjacency_list[used_concept].extend(new_concepts)
182
-
183
- for new_concept in new_concepts:
184
- concept_definitions[new_concept] = definition
185
-
186
- return adjacency_list, concept_definitions
187
-
188
-
189
- def sort_definitions(definitions: list[dict]) -> list[dict]:
190
- if len(definitions) <= 1:
191
- return
192
-
193
- adjacency_list, concept_definitions = build_adjacency_list(definitions)
194
-
195
- concept_graph = nx.DiGraph()
196
- for node, neighbors in adjacency_list.items():
197
- for neighbour in neighbors:
198
- concept_graph.add_edge(node, neighbour)
199
- if not neighbors:
200
- concept_graph.add_node(node)
201
-
202
- if not nx.is_directed_acyclic_graph(concept_graph):
203
- msg = "Found cycles in the concept graph. Cycles are not allowed."
204
- all_cycles = list(nx.simple_cycles(concept_graph))
205
-
206
- for cycle in all_cycles:
207
- cyclic_definitions = []
208
- cyclic_definitions.append(concept_definitions[cycle[0]]["markdown"])
209
- cyclic_definitions.append(concept_definitions[cycle[1]]["markdown"])
210
- msg += "Cyclic definitons:\n"
211
- msg += "\n".join(cyclic_definitions)
212
- msg += "\n"
213
-
214
- raise PlainSyntaxError(f"Plain syntax error: {msg}")
215
-
216
- order = list(nx.topological_sort(concept_graph))
217
- if len(order) > 0:
218
- definition_to_order_idx = {
219
- plain_spec.hash_text(str(concept_definitions[concept])): idx for idx, concept in enumerate(order)
220
- }
221
- definitions.sort(key=lambda definition: definition_to_order_idx[plain_spec.hash_text(str(definition))])
3
+ from plain_parser.concept_utils import * # noqa: F401,F403
file_utils.py CHANGED
@@ -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"]
@@ -142,7 +142,21 @@ def get_existing_files_content(build_folder, existing_files):
142
142
  return existing_files_content
143
143
 
144
144
 
145
+ def ensure_final_newline(content: str) -> str:
146
+ """Ends non-empty text with a newline, as linters expect (e.g. RuboCop, ESLint eol-last, Ruff W292)."""
147
+ if content and not content.endswith("\n"):
148
+ return content + "\n"
149
+ return content
150
+
151
+
145
152
  def store_response_files(target_folder, response_files, existing_files):
153
+ """Writes the files returned by the API to target_folder. None content deletes the file.
154
+
155
+ Every written file ends with a newline - whole-file rewrites come back from the API without one. The
156
+ added newline is also written back into response_files, so callers that diff response_files against
157
+ the folder afterwards see exactly what is on disk. Content is written byte-for-byte, without newline
158
+ translation, so the disk matches response_files on every platform.
159
+ """
146
160
  for file_name in response_files:
147
161
  full_file_name = os.path.join(target_folder, file_name)
148
162
 
@@ -156,9 +170,11 @@ def store_response_files(target_folder, response_files, existing_files):
156
170
 
157
171
  continue
158
172
 
173
+ response_files[file_name] = ensure_final_newline(response_files[file_name])
174
+
159
175
  os.makedirs(os.path.dirname(full_file_name), exist_ok=True)
160
176
 
161
- with open(full_file_name, "w", encoding="utf-8") as f:
177
+ with open(full_file_name, "w", encoding="utf-8", newline="") as f:
162
178
  f.write(response_files[file_name])
163
179
 
164
180
  if file_name not in existing_files:
@@ -167,106 +183,6 @@ def store_response_files(target_folder, response_files, existing_files):
167
183
  return existing_files
168
184
 
169
185
 
170
- def open_from(dirs, file_name):
171
- for dir in dirs:
172
- full_file_name = os.path.join(dir, file_name)
173
- if not os.path.isfile(full_file_name):
174
- continue
175
-
176
- with open(full_file_name, "rb") as f:
177
- content = f.read()
178
- return content.decode("utf-8")
179
-
180
- return None
181
-
182
-
183
- def resolve_linked_resource(dirs, file_name):
184
- """Return the first existing path for file_name across dirs, or None if not found.
185
-
186
- Mirrors the search order used by open_from so that validating a linked resource and
187
- loading it can never disagree.
188
- """
189
- for dir in dirs:
190
- full_file_name = os.path.join(dir, file_name)
191
- if os.path.exists(full_file_name):
192
- return full_file_name
193
-
194
- return None
195
-
196
-
197
- def load_linked_resources(template_dirs: list[str], resources_list, module_name: str):
198
- linked_resources = {}
199
-
200
- for resource in resources_list:
201
- file_name = resource["target"]
202
- if file_name in linked_resources:
203
- continue
204
-
205
- try:
206
- content = open_from(template_dirs, file_name)
207
- except UnicodeDecodeError:
208
- raise UnsupportedResourceType(
209
- f"Referenced resource '{file_name}' in module '{module_name}' is a binary file. "
210
- f"Only text files (e.g. .md, .txt, .json, .yaml) can be referenced from a .plain file."
211
- )
212
-
213
- if content is None:
214
- raise FileNotFoundError(f"""
215
- Resource file {file_name} not found. Resource files are searched in the following order (highest to lowest precedence):
216
-
217
- 1. The directory containing your .plain file
218
- 2. The directory specified by --template-dir (if provided)
219
- 3. The built-in 'standard_template_library' directory
220
-
221
- Please ensure that the resource exists in one of these locations, or specify the correct --template-dir if using custom templates.
222
- """)
223
-
224
- blob = find_large_base64_blob(content)
225
- if blob is not None:
226
- raise UnsupportedBase64Content(
227
- f"Referenced resource '{file_name}' in module '{module_name}' contains a large "
228
- f"base64-encoded blob ({len(blob)} characters), such as an embedded image. Inline "
229
- "base64 data is not supported. Remove the data from the resource. "
230
- "If the data should be used by the end software, "
231
- "save the data to a separate file and include the file path in the specification without it being a reference file."
232
- )
233
-
234
- linked_resources[file_name] = content
235
-
236
- return linked_resources
237
-
238
-
239
- class TrackingFileSystemLoader(Plain2CodeLoaderMixin, FileSystemLoader):
240
- def __init__(self, *args, **kwargs):
241
- super().__init__(*args, **kwargs)
242
- self.loaded_templates = {}
243
-
244
- def get_source(self, environment, template_name, **kwargs):
245
- source = super().get_source(environment, template_name, **kwargs)
246
- self.loaded_templates[template_name] = source.source
247
- return source
248
-
249
-
250
- def get_loaded_templates(source_path, plain_source):
251
- # Render the plain source with Liquid templating engine
252
- # to identify the templates that are being loaded
253
-
254
- liquid_loader = TrackingFileSystemLoader(source_path)
255
- liquid_env = Environment(loader=liquid_loader, undefined=StrictUndefined)
256
- liquid_env.tags["include"] = Plain2CodeIncludeTag(liquid_env)
257
-
258
- liquid_env.filters["code_variable"] = plain_spec.code_variable_liquid_filter
259
- liquid_env.filters["prohibited_chars"] = plain_spec.prohibited_chars_liquid_filter
260
-
261
- plain_source_template = liquid_env.from_string(plain_source)
262
- try:
263
- plain_source = plain_source_template.render()
264
- except UndefinedError as e:
265
- raise Exception(f"Undefined liquid variable: {str(e)}")
266
-
267
- return plain_source, liquid_loader.loaded_templates
268
-
269
-
270
186
  def update_build_folder_with_rendered_files(build_folder, existing_files, response_files):
271
187
  changed_files = set()
272
188
  changed_files.update(response_files.keys())
module_renderer.py CHANGED
@@ -134,10 +134,8 @@ class ModuleRenderer:
134
134
 
135
135
  code_renderer.run()
136
136
  if code_renderer.render_context.state == States.RENDER_FAILED.value:
137
- error_message = RenderError.get_display_message(
138
- code_renderer.render_context.previous_action_payload,
139
- fallback_message=code_renderer.render_context.last_error_message,
140
- )
137
+ # ExitWithError resolved and logged the stop reason; the TUI shows the same text.
138
+ error_message = code_renderer.render_context.last_error_message or RenderError.get_display_message(None)
141
139
  code_renderer.render_context.event_bus.publish(RenderFailed(error_message=error_message))
142
140
  return False, True
143
141