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