From a553c1d0e319096ab1afe5ccacfd4b86f2088a0f Mon Sep 17 00:00:00 2001 From: Nejc Stebe Date: Mon, 29 Jun 2026 15:09:48 +0200 Subject: [PATCH 1/2] Switch standard_template_library to git subtree Removes the inline copy of standard_template_library/ so it can be re-added as a git subtree from the plainlang-examples repository. Also drops the now-unnecessary importlib.resources lookup in plain2code.py and documents the subtree sync workflow in CLAUDE.md. --- CLAUDE.md | 22 +++++++++++++- plain2code.py | 3 +- standard_template_library/__init__.py | 1 - .../golang-console-app-template.plain | 29 ------------------- .../python-console-app-template.plain | 22 -------------- .../typescript-react-app-boilerplate.plain | 8 ----- .../typescript-react-app-template.plain | 23 --------------- 7 files changed, 22 insertions(+), 86 deletions(-) delete mode 100644 standard_template_library/__init__.py delete mode 100644 standard_template_library/golang-console-app-template.plain delete mode 100644 standard_template_library/python-console-app-template.plain delete mode 100644 standard_template_library/typescript-react-app-boilerplate.plain delete mode 100644 standard_template_library/typescript-react-app-template.plain diff --git a/CLAUDE.md b/CLAUDE.md index 2e1f936a..506d2c04 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -179,7 +179,7 @@ black . --check && isort . --check-only && flake8 . && mypy . --check-untyped-de - `plain2code_logger.py` - Custom logging with elapsed time timestamps - `plain2code_console.py` - Rich console wrapper with custom styles - `plain2code_state.py` - Runtime state (render ID, counters, timing) -- `standard_template_library/` - Built-in code templates +- `standard_template_library/` - Built-in `.plain` templates (git subtree from `plainlang-examples`) - `examples/` - Sample `.plain` projects ### Testing Architecture @@ -223,6 +223,26 @@ Two logging modes: ### Running Plain2Code from Another Directory The tool can be run from any directory by providing an absolute or relative path to the `.plain` file. All paths (build folder, log file, templates) are resolved relative to the `.plain` file's directory, not the current working directory, unless explicitly overridden via CLI arguments. +### Standard Template Library + +`standard_template_library/` is a git subtree sourced from the `plainlang-examples` repository. It is **not** updated automatically — you must pull changes manually when the templates change upstream: + +```bash +git subtree pull --prefix=standard_template_library git@github.com:Codeplain-ai/plainlang-examples.git subtree/standard-template-library --squash +``` + +The subtree does not track a branch pointer. The branch (`main` above) is just an argument passed at pull time — git uses the `git-subtree-split` hash embedded in the commit history to determine what's new since the last sync. + +**Important:** You must pull from the `subtree/standard-template-library` branch, not `main`. This is a split branch containing only the `standard_template_library/` subdirectory contents at root level. Pulling from `main` would bring in the entire `plainlang-examples` repo. + +If the split branch is outdated, regenerate it first in `plainlang-examples`: + +```bash +# In plainlang-examples/ +git subtree split --prefix=standard_template_library -b subtree/standard-template-library +git push origin subtree/standard-template-library +``` + ### Windows Support Windows users must use WSL (Windows Subsystem for Linux). The codebase has some platform-specific script handling (`.ps1` for Windows, `.sh` for Unix). diff --git a/plain2code.py b/plain2code.py index a66b5bb6..03271b68 100644 --- a/plain2code.py +++ b/plain2code.py @@ -1,4 +1,3 @@ -import importlib.resources import logging import logging.config import os @@ -55,7 +54,7 @@ from tui.plain2code_tui import Plain2CodeTUI from tui.plain_module_render_choice_tui import PlainModuleRenderChoiceTUI -DEFAULT_TEMPLATE_DIRS = importlib.resources.files("standard_template_library") +DEFAULT_TEMPLATE_DIRS = "standard_template_library" RENDER_THREAD_SHUTDOWN_TIMEOUT = 0.7 # Exceptions that represent expected, user-facing error conditions. They are diff --git a/standard_template_library/__init__.py b/standard_template_library/__init__.py deleted file mode 100644 index 35e9cd57..00000000 --- a/standard_template_library/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Standard template library for plain2code diff --git a/standard_template_library/golang-console-app-template.plain b/standard_template_library/golang-console-app-template.plain deleted file mode 100644 index f94d6ccd..00000000 --- a/standard_template_library/golang-console-app-template.plain +++ /dev/null @@ -1,29 +0,0 @@ -***definitions*** - -- :App: is a console application. - -- :MainExecutableFile: is the main executable code file of :App:. - -- :ConformanceTestsExecutableFile: is the main executable code file of :ConformanceTests:. - - -***implementation reqs*** - -- :Implementation: should be in Go lang. - -- :Implementation: should include unit tests using Go's built-in testing package. - - -***test reqs*** - -- :ConformanceTests: should be implemented in Go lang. - -- :ConformanceTestsExecutableFile: should be called "conformance_tests.go". - -- :ConformanceTests: will be executed using the command "go run /conformance_tests.go" from a folder that contains :MainExecutableFile:. - -- Before :ConformanceTests: are executed, "go get" will be executed in the folder containing :MainExecutableFile:. - -- Before :ConformanceTests: are executed, "go get" will be executed in . - -- :App: can be executed using the command "go run". diff --git a/standard_template_library/python-console-app-template.plain b/standard_template_library/python-console-app-template.plain deleted file mode 100644 index f9aa6e85..00000000 --- a/standard_template_library/python-console-app-template.plain +++ /dev/null @@ -1,22 +0,0 @@ -***definitions*** - -- :App: is a console application. - -- :MainExecutableFile: is the main executable code file of :App:. - - -***implementation reqs*** - -- :Implementation: should be in Python. - -- :Implementation: should include :UnitTests: using Unittest framework! If :UnitTests: are put in the subfolder, make sure to include __init__.py to make them discoverable. - -***test reqs*** - -- :ConformanceTests: of :App: should be implemented in Python using Unittest framework. :ConformanceTests: will be run using "python -m unittest discover" command. Therefore, if :ConformanceTests: are put in the subfolder, make sure to include __init__.py to make them discoverable. - -- :ConformanceTests: must be implemented and executed - do not use unittest.skip() or “any other test skipping functionality. - -- The current working directory contains :MainExecutableFile:. - -- :App: can be executed using the command "python :MainExecutableFile:". \ No newline at end of file diff --git a/standard_template_library/typescript-react-app-boilerplate.plain b/standard_template_library/typescript-react-app-boilerplate.plain deleted file mode 100644 index 1e0d7123..00000000 --- a/standard_template_library/typescript-react-app-boilerplate.plain +++ /dev/null @@ -1,8 +0,0 @@ ---- -import: - - typescript-react-app-template ---- - -***functional specs*** - -- Implement the entry point for :App:. diff --git a/standard_template_library/typescript-react-app-template.plain b/standard_template_library/typescript-react-app-template.plain deleted file mode 100644 index 5769e401..00000000 --- a/standard_template_library/typescript-react-app-template.plain +++ /dev/null @@ -1,23 +0,0 @@ -***definitions*** - -- :App: is a web application. - - -***implementation reqs*** - -- :App: should be implemented in TypeScript, using React as a web framework. - -- :App: will run on Node.js as the runtime environment. - -- :App: should run on port 3000. - -- The start script should be added to the package.json file. - -***test reqs*** - -- :ConformanceTests: of :App: should be written in TypeScript, using Cypress as the framework for :ConformanceTests:. - -- The following configuration should be added: - - The appropriate include section should be added to tsconfig.json file. - - The cypress.config.mjs file should use the 'cypress' package. - - The typescript package should be added to the devDependencies in package.json From 7b9265dad94d9294e31281c3ed97254e19e3e4f9 Mon Sep 17 00:00:00 2001 From: Nejc Stebe Date: Mon, 29 Jun 2026 15:10:04 +0200 Subject: [PATCH 2/2] Squashed 'standard_template_library/' content from commit 14f2c24 git-subtree-dir: standard_template_library git-subtree-split: 14f2c241482f2fbba8e3514759725630f36f85e9 --- golang-console-app-template.plain | 29 ++++++++++++++++++++++++++ python-console-app-template.plain | 22 +++++++++++++++++++ typescript-react-app-boilerplate.plain | 8 +++++++ typescript-react-app-template.plain | 23 ++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 golang-console-app-template.plain create mode 100644 python-console-app-template.plain create mode 100644 typescript-react-app-boilerplate.plain create mode 100644 typescript-react-app-template.plain diff --git a/golang-console-app-template.plain b/golang-console-app-template.plain new file mode 100644 index 00000000..f94d6ccd --- /dev/null +++ b/golang-console-app-template.plain @@ -0,0 +1,29 @@ +***definitions*** + +- :App: is a console application. + +- :MainExecutableFile: is the main executable code file of :App:. + +- :ConformanceTestsExecutableFile: is the main executable code file of :ConformanceTests:. + + +***implementation reqs*** + +- :Implementation: should be in Go lang. + +- :Implementation: should include unit tests using Go's built-in testing package. + + +***test reqs*** + +- :ConformanceTests: should be implemented in Go lang. + +- :ConformanceTestsExecutableFile: should be called "conformance_tests.go". + +- :ConformanceTests: will be executed using the command "go run /conformance_tests.go" from a folder that contains :MainExecutableFile:. + +- Before :ConformanceTests: are executed, "go get" will be executed in the folder containing :MainExecutableFile:. + +- Before :ConformanceTests: are executed, "go get" will be executed in . + +- :App: can be executed using the command "go run". diff --git a/python-console-app-template.plain b/python-console-app-template.plain new file mode 100644 index 00000000..f9aa6e85 --- /dev/null +++ b/python-console-app-template.plain @@ -0,0 +1,22 @@ +***definitions*** + +- :App: is a console application. + +- :MainExecutableFile: is the main executable code file of :App:. + + +***implementation reqs*** + +- :Implementation: should be in Python. + +- :Implementation: should include :UnitTests: using Unittest framework! If :UnitTests: are put in the subfolder, make sure to include __init__.py to make them discoverable. + +***test reqs*** + +- :ConformanceTests: of :App: should be implemented in Python using Unittest framework. :ConformanceTests: will be run using "python -m unittest discover" command. Therefore, if :ConformanceTests: are put in the subfolder, make sure to include __init__.py to make them discoverable. + +- :ConformanceTests: must be implemented and executed - do not use unittest.skip() or “any other test skipping functionality. + +- The current working directory contains :MainExecutableFile:. + +- :App: can be executed using the command "python :MainExecutableFile:". \ No newline at end of file diff --git a/typescript-react-app-boilerplate.plain b/typescript-react-app-boilerplate.plain new file mode 100644 index 00000000..1e0d7123 --- /dev/null +++ b/typescript-react-app-boilerplate.plain @@ -0,0 +1,8 @@ +--- +import: + - typescript-react-app-template +--- + +***functional specs*** + +- Implement the entry point for :App:. diff --git a/typescript-react-app-template.plain b/typescript-react-app-template.plain new file mode 100644 index 00000000..5769e401 --- /dev/null +++ b/typescript-react-app-template.plain @@ -0,0 +1,23 @@ +***definitions*** + +- :App: is a web application. + + +***implementation reqs*** + +- :App: should be implemented in TypeScript, using React as a web framework. + +- :App: will run on Node.js as the runtime environment. + +- :App: should run on port 3000. + +- The start script should be added to the package.json file. + +***test reqs*** + +- :ConformanceTests: of :App: should be written in TypeScript, using Cypress as the framework for :ConformanceTests:. + +- The following configuration should be added: + - The appropriate include section should be added to tsconfig.json file. + - The cypress.config.mjs file should use the 'cypress' package. + - The typescript package should be added to the devDependencies in package.json