diff --git a/CLAUDE.md b/CLAUDE.md index b176a44f..152f5772 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,15 +4,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Overview -This is **codeplain**, a Python CLI tool that renders code from `***plain` specification files using the Codeplain API. The tool acts as a client that: +This is **codeplain**, a Python CLI tool that regenerates code from `***plain` specification files using the Codeplain API. The tool acts as a client that: 1. Parses `***plain` spec files (a domain-specific language for software specifications) 2. Sends specs to the Codeplain API (LLM-based code generation service) -3. Manages an iterative state-machine-driven render process with testing and refactoring cycles +3. Manages an iterative state-machine-driven regeneration process with testing and refactoring cycles 4. Outputs generated code to a build folder The codebase serves two audiences: - **End users**: developers who write `***plain` specs and run `plain2code.py` to generate code -- **Internal devs**: maintaining the renderer itself (this codebase) +- **Internal devs**: maintaining the regeneration engine itself (this codebase) ### Related Repository: codeplain-api @@ -59,13 +59,13 @@ Hook is located at `.git/hooks/pre-push`. ### Running the Tool ```bash -# Basic usage - render a .plain file +# Basic usage - regenerate code from a .plain file python plain2code.py path/to/file.plain # Display account status (user info, credits, API key label) python plain2code.py --status -# Dry run (parse and validate .plain files without rendering code) +# Dry run (parse and validate .plain files without regenerating code) # This parses the spec files, resolves imports/requires, but doesn't generate code python plain2code.py path/to/file.plain --dry-run @@ -75,8 +75,8 @@ python plain2code.py path/to/file.plain --log-to-file # Headless mode (no TUI, logs to file only) python plain2code.py path/to/file.plain --headless -# Render specific functionality range -python plain2code.py file.plain --render-range add-task,delete-task # Render add-task through delete-task +# Regenerate specific functionality range +python plain2code.py file.plain --render-range add-task,delete-task # Regenerate add-task through delete-task python plain2code.py file.plain --render-from delete-task # Resume from delete-task # Run with examples @@ -125,27 +125,27 @@ black . --check && isort . --check-only && flake8 . && mypy . --check-untyped-de ### High-Level Flow 1. **Entry Point** (`plain2code.py`): CLI argument parsing, logging setup, TUI initialization 2. **Module Loading** (`plain_modules.py`, `plain_file.py`): Parse `.plain` files into `PlainModule` objects with dependency trees -3. **Rendering Orchestration** (`module_renderer.py`): Coordinates render process across modules -4. **State Machine** (`render_machine/`): Hierarchical state machine drives the render lifecycle +3. **Regeneration Orchestration** (`module_renderer.py`): Coordinates regeneration process across modules +4. **State Machine** (`render_machine/`): Hierarchical state machine drives the regeneration lifecycle 5. **API Communication** (`codeplain_REST_api.py`): HTTP client for Codeplain API -6. **Code Generation** (`render_machine/code_renderer.py`): Main code renderer class that orchestrates the code generation workflow using a hierarchical state machine -7. **TUI** (`tui/`): Textual-based terminal UI showing render progress -8. **CLI Output** (`cli_output/`): Non-interactive terminal output formatting for status, dry-run, and render summaries +6. **Code Generation** (`render_machine/code_renderer.py`): Main `CodeRenderer` class that orchestrates the code generation workflow using a hierarchical state machine +7. **TUI** (`tui/`): Textual-based terminal UI showing regeneration progress +8. **CLI Output** (`cli_output/`): Non-interactive terminal output formatting for status, dry-run, and regeneration summaries ### Key Concepts -**Plain Modules**: A `.plain` file can `import` other `.plain` files, creating a module dependency tree. The renderer processes required modules first (depth-first), then the top module. +**Plain Modules**: A `.plain` file can `import` other `.plain` files, creating a module dependency tree. The regeneration engine processes required modules first (depth-first), then the top module. -**Functionalities (FRIDs)**: Each functional requirement in a `.plain` file has a unique ID (FRID), the func-id of its `# ` heading. The renderer processes them sequentially. State is checkpointed after each FRID. +**Functionalities (FRIDs)**: Each functional requirement in a `.plain` file has a unique ID (FRID), the func-id of its `# ` heading. The regeneration engine processes them sequentially. State is checkpointed after each FRID. -**Render State Machine** (`render_machine/states.py`): Hierarchical FSM with states like: +**Regeneration State Machine** (`render_machine/states.py`): Hierarchical FSM with states like: - `IMPLEMENTING_FRID` → `PROCESSING_UNIT_TESTS` → `REFACTORING_CODE` → `PROCESSING_CONFORMANCE_TESTS` - Transitions handled by triggers in `render_machine/triggers.py` - Config in `render_machine/state_machine_config.py` -**Memory Management** (`memory_management.py`): Tracks previously rendered code to provide context to the LLM for incremental changes. Uses git commits to persist checkpoints. +**Memory Management** (`memory_management.py`): Tracks previously regenerated code to provide context to the LLM for incremental changes. Uses git commits to persist checkpoints. -**Partial Rendering** (`partial_rendering.py`): Detects when specs or code changed and determines the optimal starting point to resume rendering (avoids full re-renders). +**Partial Regeneration** (`partial_rendering.py`): Detects when specs or code changed and determines the optimal starting point to resume regeneration (avoids full regenerations). **Event Bus** (`event_bus.py`): Pub/sub for UI updates. Events defined in `plain2code_events.py` (e.g., `LogMessageEmitted`, `RenderCompleted`). @@ -157,7 +157,7 @@ black . --check && isort . --check-only && flake8 . && mypy . --check-untyped-de - `plain_modules.py` - Module dependency resolution - `plain_file.py` - `.plain` file parser - `plain_spec.py` - Spec extraction and FRID utilities -- `module_renderer.py` - Orchestrates render for a module +- `module_renderer.py` - Orchestrates regeneration for a module - `render_machine/` - State machine implementation - `code_renderer.py` - Generates code via templates - `states.py` - State name constants @@ -170,7 +170,7 @@ black . --check && isort . --check-only && flake8 . && mypy . --check-untyped-de - `cli_output/` - Non-interactive CLI output formatting - `status.py` - Status display (`--status` flag) - `dry_run.py` - Dry run output (`--dry-run` flag) - - `render_summary.py` - Render completion summary + - `render_summary.py` - Regeneration completion summary - `codeplain_REST_api.py` - API client - `memory_management.py` - Context tracking - `git_utils.py` - Git operations for checkpointing @@ -178,7 +178,7 @@ black . --check && isort . --check-only && flake8 . && mypy . --check-untyped-de - `concept_utils.py` - Concept validation (***plain language feature) - `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) +- `plain2code_state.py` - Runtime state (regeneration ID, counters, timing) - `standard_template_library/` - Built-in `.plain` templates (git subtree from `plainlang-examples`) - `examples/` - Sample `.plain` projects @@ -187,7 +187,7 @@ black . --check && isort . --check-only && flake8 . && mypy . --check-untyped-de Tests are in `tests/` and cover: - `test_plain_modules.py` - Module loading, dependency resolution, metadata - `test_plainfileparser.py` - `.plain` syntax parsing -- `test_partial_rendering.py` - Render resumption logic +- `test_partial_rendering.py` - Regeneration resumption logic - `test_git_utils.py` - Git checkpoint/restore operations - `test_imports.py`, `test_requires.py` - Module dependency resolution @@ -196,7 +196,7 @@ No integration tests hit the actual Codeplain API (would require API key + netwo ### Logging Two logging modes: -1. **Console (TUI)**: Logs displayed in TUI with relative timestamps `[HH:MM:SS]` (elapsed since render start, accounts for pauses) +1. **Console (TUI)**: Logs displayed in TUI with relative timestamps `[HH:MM:SS]` (elapsed since regeneration start, accounts for pauses) 2. **File**: Same format as TUI, written to `codeplain.log` in the `.plain` file's directory `ElapsedTimeFormatter` (in `plain2code_logger.py`) uses `RunState` to calculate elapsed time. Format: `[HH:MM:SS] LEVEL logger_name: message` @@ -212,12 +212,12 @@ Two logging modes: ### Code Generation Process - Templates in `standard_template_library/` use Liquid2 syntax - Template search order: (1) `.plain` file dir, (2) `--template-dir`, (3) built-in standard lib -- Each module renders into its own tree under the build folder (configurable via `--build-folder`, default `plain_modules/`): +- Each module is regenerated into its own tree under the build folder (configurable via `--build-folder`, default `plain_modules/`): - `//code/` — implementation code (its own git repo) - `//tests/` — conformance tests (its own git repo; only created when a conformance tests script is configured) - `//.codeplain/` — module metadata (`module_metadata.json`), not tracked in git - `//.memory/` — conformance test memory, not tracked in git -- Each FRID render produces a git commit in the `code/` and `tests/` repos for rollback capability +- Each FRID regeneration produces a git commit in the `code/` and `tests/` repos for rollback capability ### Configuration - `config.yaml` can be placed in `.plain` file dir or CWD diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f71fe304..0095f0b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ This provides a real `.plain` project for verifying the change in an actual Code Run the tests relevant to your change before opening a pull request. -For changes that affect the CLI, rendering, or test execution, also test the change by running the relevant Codeplain command from the terminal. +For changes that affect the CLI, regeneration, or test execution, also test the change by running the relevant Codeplain command from the terminal. Check that: diff --git a/README.md b/README.md index 108bba1a..d5883b76 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# *codeplain renderer +# *codeplain regeneration engine ## What is \*codeplain? \*codeplain platform makes coding agents better by having them write and maintain specifications instead of code. It extends coding agents with agentic skills for working at the specification layer, and with tools that convert specifications into tested and validated implementation code. -This repository is the renderer that powers that last step, turning \*\*\*plain specs into software using the *codeplain API. +This repository is the regeneration engine that powers that last step, turning \*\*\*plain specs into software using the *codeplain API. The result is a software development workflow centered on specifications, which are faster and more efficient for AI to produce and easier for developers to review and maintain than raw code. -Schematic overview of the *codeplain's code rendering: +Schematic overview of the *codeplain's code regeneration: @@ -43,7 +43,7 @@ export CODEPLAIN_API_KEY="your_actual_api_key_here" ### 2. Let your agent work in specs, not code -You describe what you want in plain English, an agent helps you write a spec in \*\*\*plain language, and \*codeplain renders the actual code. This is what [plain-forge](https://github.com/Codeplain-ai/plain-forge) sets up: a toolkit of skills, rules, and docs that plugs into your AI coding agent of choice — Claude Code, Codex, ForgeCode, OpenCode, or any other agent that reads from a standard skills directory — and turns a conversation into a complete `.plain` spec, then keeps maintaining it across the lifetime of the project. +You describe what you want in plain English, an agent helps you write a spec in \*\*\*plain language, and \*codeplain regenerates the actual code. This is what [plain-forge](https://github.com/Codeplain-ai/plain-forge) sets up: a toolkit of skills, rules, and docs that plugs into your AI coding agent of choice — Claude Code, Codex, ForgeCode, OpenCode, or any other agent that reads from a standard skills directory — and turns a conversation into a complete `.plain` spec, then keeps maintaining it across the lifetime of the project. If you didn't install it during step 1, run it any time using your favorite Node package runner: @@ -97,7 +97,7 @@ You can immediately test the system with a simple "Hello World" example: codeplain hello_world_python.plain ``` - _Note: Rendering will take a few minutes to complete._ + _Note: Regeneration will take a few minutes to complete._ - The system will generate a Python application in the `dist` directory. You can run it with: ```bash diff --git a/cli_output/dry_run.py b/cli_output/dry_run.py index 206e5100..4a1f6e51 100644 --- a/cli_output/dry_run.py +++ b/cli_output/dry_run.py @@ -20,7 +20,7 @@ def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[st functional_requirement_text = specifications[plain_spec.FUNCTIONAL_REQUIREMENTS][-1] console.info( "-------------------------------------\n" - f"Rendering functionality {with_position(frid, functionality_position(frids, frid))}:\n" + f"Regenerating functionality {with_position(frid, functionality_position(frids, frid))}:\n" f"{functional_requirement_text}\n" "-------------------------------------\n" ) @@ -34,7 +34,7 @@ def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[st else: console.info( "-------------------------------------\n" - f"Skipping rendering iteration: {with_position(frid, functionality_position(frids, frid))}\n" + f"Skipping regeneration round: {with_position(frid, functionality_position(frids, frid))}\n" "-------------------------------------" ) diff --git a/cli_output/render_summary.py b/cli_output/render_summary.py index 6b62e33c..a588ba6f 100644 --- a/cli_output/render_summary.py +++ b/cli_output/render_summary.py @@ -16,12 +16,12 @@ def print_exit_summary( console.quiet = False if run_state.render_succeeded: - msg = "\n[#79FC96]✓ rendering completed\n\n" + msg = "\n[#79FC96]✓ regeneration completed\n\n" elif run_state.render_cancelled: - msg = "\n[#FFFFFF]— rendering canceled\n\n" + msg = "\n[#FFFFFF]— regeneration canceled\n\n" else: - msg = "\n[#FF6B6B]✗ rendering failed\n\n" - msg += f" [#8E8F91]render id:\t\t\t[#FFFFFF]{run_state.render_id}\n" + msg = "\n[#FF6B6B]✗ regeneration failed\n\n" + msg += f" [#8E8F91]regeneration id:\t\t[#FFFFFF]{run_state.render_id}\n" msg += f" [#8E8F91]input file:\t\t\t[#FFFFFF]{spec_filename}\n" msg += f" [#8E8F91]generated code folder:\t[#FFFFFF]{run_state.render_generated_code_path or '-'}\n\n" msg += format_usage_summary(run_state.rendered_functionalities, run_state.render_time_accumulated) + "\n" diff --git a/cli_output/status.py b/cli_output/status.py index fb9d3c07..f9902edb 100644 --- a/cli_output/status.py +++ b/cli_output/status.py @@ -110,7 +110,7 @@ def _display_status_message(plan_credits: Optional[dict], purchased_credits: lis if not has_remaining: console.print( - f"\nNo rendering credits remaining. Upgrade to the PRO plan at {PLANS_URL} to continue rendering." + f"\nNo regeneration credits remaining. Upgrade to the PRO plan at {PLANS_URL} to continue regenerating." ) else: console.print(f"\nTo manage your plan navigate to {PLANS_URL}") @@ -151,8 +151,8 @@ def print_status(api_key: str, api_url: str, client_version: str) -> None: console.print(f"Organization owner: {org_owner or 'N/A'}") console.print(f"API key label: {api_key_label}\n") - # Display rendering credits section - console.print("Rendering credits:") + # Display regeneration credits section + console.print("Regeneration credits:") # Display plan credits (free credits or subscription) if plan_credits: diff --git a/codeplain_REST_api.py b/codeplain_REST_api.py index 42aed426..c09f96d0 100644 --- a/codeplain_REST_api.py +++ b/codeplain_REST_api.py @@ -160,7 +160,7 @@ def _handle_retry_logic( "Connection error: Failed to connect to API server.\n\nPlease check that your internet connection is working." ) if isinstance(error, RequestException): - raise Exception(f"Error rendering plain code: {error}\n") from error + raise Exception(f"Error regenerating code: {error}\n") from error raise error def _raise_for_error_code(self, response_json): @@ -217,7 +217,7 @@ def post_request( response_json = response.json() except requests.exceptions.JSONDecodeError as e: self.console.debug(f"Failed to decode JSON response: {e}. Response text: {response.text}") - raise Exception(f"Error rendering plain code: Failed to decode API response ({e}).\n") from e + raise Exception(f"Error regenerating code: Failed to decode API response ({e}).\n") from e if response.status_code == requests.codes.bad_request and "error_code" in response_json: self._raise_for_error_code(response_json) diff --git a/docs/plain2code_cli.md b/docs/plain2code_cli.md index 157c6af9..7f8ad086 100644 --- a/docs/plain2code_cli.md +++ b/docs/plain2code_cli.md @@ -6,7 +6,7 @@ usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER] [--log-to-file | --no-log-to-file] [--log-file-name LOG_FILE_NAME] [--config-name CONFIG_NAME] - [--render-range RENDER_RANGE | --render-from RENDER_FROM] + [--render-range RENDER_RANGE | --render-from RENDER_FROM | --regenerate REGENERATE] [--force-render] [--unittests-script UNITTESTS_SCRIPT] [--conformance-tests-script CONFORMANCE_TESTS_SCRIPT] [--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT] @@ -23,19 +23,20 @@ usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER] [--status] [--version] [filename] -Render plain code to target code. Path arguments resolve based on where they -were written: values given on the command line are resolved against the +Regenerate target code from plain code. Path arguments resolve based on where +they were written: values given on the command line are resolved against the current working directory, values read from config.yaml are resolved against the config file's directory, and defaults are resolved against the directory containing the plain file. Absolute paths (and paths starting with '~') are used as-is. positional arguments: - filename Path to the plain file to render. The directory - containing this file has highest precedence for - template loading, so you can place custom templates - here to override the defaults. See --template-dir for - more details about template loading. + filename Path to the plain file to regenerate code from. The + directory containing this file has highest precedence + for template loading, so you can place custom + templates here to override the defaults. See + --template-dir for more details about template + loading. options: -h, --help show this help message and exit @@ -52,20 +53,29 @@ options: a file already exists at the resolved path, it will be overwritten by the current logs. --render-range RENDER_RANGE - Specify a range of functionalities to render (e.g. + Specify a range of functionalities to regenerate (e.g. `add-task`, `add-task,list-tasks`). Use comma to separate start and end IDs. If only one functionality - ID is provided, only that functionality is rendered. - Range is inclusive of both start and end IDs. + ID is provided, only that functionality is + regenerated. Range is inclusive of both start and end + IDs. The code is first reset to the functionality + before the range. To regenerate one functionality and + keep the functionalities after it, use --regenerate. --render-from RENDER_FROM Continue generation starting from this specific functionality (e.g. `add-task`). The functionality with this ID will be included in the output. The functionality ID must match one of the functionalities in your plain file. - --force-render Render every module of the project again, from the + --regenerate REGENERATE + Regenerate a single functionality (e.g. `add-task`) + that a full regeneration has already finished. The + other functionalities stay as they are. The + functionality ID must match one of the functionalities + in your plain file. + --force-render Regenerate every module of the project again, from the first one. The client does not ask where to start and - the code rendered before is replaced. + the code regenerated before is replaced. --unittests-script UNITTESTS_SCRIPT Shell script to run unit tests on generated code. Receives the module's code folder path as its first @@ -93,12 +103,13 @@ options: --full-plain Full preview ***plain specification before code generation. Use when you want to preview context of all ***plain primitives that are going to be included - in order to render the given module. + in order to regenerate the given module. --dry-run Dry run preview of the code generation (without actually making any changes). --replay-with REPLAY_WITH --job-tag JOB_TAG Tag sent to the server with every request and attached - to the render's LangSmith traces (max 300 characters). + to the regeneration's LangSmith traces (max 300 + characters). --template-dir TEMPLATE_DIR Path to a custom template directory. Templates are searched in the following order: 1) Directory @@ -109,16 +120,16 @@ options: Folder scanned for test plain files; repeat the option for more than one. Defaults to 'tests' next to the plain file. - --copy-build If set, copy the rendered contents of code in `--base- - folder` folder to `--build-dest` folder after - successful rendering. + --copy-build If set, copy the regenerated contents of code in + `--base-folder` folder to `--build-dest` folder after + successful regeneration. --build-dest BUILD_DEST - Target folder to copy rendered contents of code to + Target folder to copy regenerated contents of code to (used only if --copy-build is set). --copy-conformance-tests If set, copy the module's conformance tests (from `//tests`) to `--conformance- - tests-dest` folder after successful rendering. + tests-dest` folder after successful regeneration. Requires --conformance-tests-script. --conformance-tests-dest CONFORMANCE_TESTS_DEST Target folder to copy conformance tests of code to @@ -133,16 +144,16 @@ options: Used automatically when stdin, stdout or stderr is not a terminal. --exit-when-done, --no-exit-when-done - Close the terminal interface as soon as rendering + Close the terminal interface as soon as regeneration stops, instead of keeping it open until you press - Enter. The render summary is printed to the terminal - as usual. Use --no-exit-when-done to keep the + Enter. The regeneration summary is printed to the + terminal as usual. Use --no-exit-when-done to keep the interface open when config.yaml turns this on. - Headless rendering always ends by itself, so the + Headless regeneration always ends by itself, so the option changes nothing there. --status Display account status including user information, API - key label, and rendering credits. Does not render any - code. + key label, and regeneration credits. Does not + regenerate any code. --version Display the client version and exit. configuration: diff --git a/docs/starting_a_plain_project_from_scratch.md b/docs/starting_a_plain_project_from_scratch.md index c5e6225c..481ac5af 100644 --- a/docs/starting_a_plain_project_from_scratch.md +++ b/docs/starting_a_plain_project_from_scratch.md @@ -5,7 +5,7 @@ It assumes you have already: ✅ Met all [prerequisites](../README.md#prerequisites), ✅ Completed the [installation steps](../README.md/#installation-steps), -✅ Successfully rendered your [first example](../README.md#quick-start). +✅ Successfully regenerated your [first example](../README.md#quick-start). If you haven't done so yet, please refer to [README](../README.md). @@ -97,4 +97,4 @@ verbose: true codeplain my_app.plain ``` -After rendering is completed the generated code will be available in build/ folder. +After regeneration is completed the generated code will be available in build/ folder. diff --git a/install/bash/examples.sh b/install/bash/examples.sh index 92dfe938..1171144c 100755 --- a/install/bash/examples.sh +++ b/install/bash/examples.sh @@ -146,7 +146,7 @@ if [ "$SKIP_DOWNLOAD" = false ]; then echo "" echo -e " ${GRAY}Example folder:${NC} ${WHITE}cd ${EXTRACTED_DIR}/hello-world/python${NC}" echo "" - echo -e " ${GRAY}Render the example:${NC} ${WHITE}codeplain hello-world-python.plain${NC}" + echo -e " ${GRAY}Regenerate the example:${NC} ${WHITE}codeplain hello-world-python.plain${NC}" echo "" echo -e " ${GRAY}See hello-world/python/README.md for details.${NC}" echo "" diff --git a/install/bash/walkthrough.sh b/install/bash/walkthrough.sh index 7536860c..1807890a 100644 --- a/install/bash/walkthrough.sh +++ b/install/bash/walkthrough.sh @@ -143,12 +143,12 @@ echo "" PROMPT=$(printf '%b' " Press ${WHITE}[Enter]${NC} to continue...") read -r -p "$PROMPT" < /dev/tty -# Onboarding Step 5: Rendering Code +# Onboarding Step 5: Regenerating Code clear echo "" echo -e " ${WHITE}${BOLD}***plain specification language intro${NC} (5/5)" echo "" -echo -e " ${WHITE}${BOLD}RENDERING CODE${NC} - Generate your app" +echo -e " ${WHITE}${BOLD}REGENERATING CODE${NC} - Generate your app" echo "" echo -e " Once you have a ***plain file, generate code with:" echo "" diff --git a/install/powershell/examples.ps1 b/install/powershell/examples.ps1 index c9b0f3e2..5ed04fc0 100644 --- a/install/powershell/examples.ps1 +++ b/install/powershell/examples.ps1 @@ -141,7 +141,7 @@ if (-not $SKIP_DOWNLOAD) { Write-Host "" Write-Host " ${GRAY}Example folder:${NC} ${WHITE}cd ${EXTRACTED_DIR}\hello-world\python${NC}" Write-Host "" - Write-Host " ${GRAY}Render the example:${NC} ${WHITE}codeplain hello-world-python.plain${NC}" + Write-Host " ${GRAY}Regenerate the example:${NC} ${WHITE}codeplain hello-world-python.plain${NC}" Write-Host "" Write-Host " ${GRAY}See hello-world/python/README.md for details.${NC}" Write-Host "" diff --git a/install/powershell/walkthrough.ps1 b/install/powershell/walkthrough.ps1 index a8216958..99ac8d14 100644 --- a/install/powershell/walkthrough.ps1 +++ b/install/powershell/walkthrough.ps1 @@ -150,12 +150,12 @@ Write-Host " Here, it simply displays `"hello, world`"." Write-Host "" Read-Host " Press ${WHITE}[Enter]${NC} to continue..." -# Onboarding Step 5: Rendering Code +# Onboarding Step 5: Regenerating Code Clear-Host Write-Host "" Write-Host " ${WHITE}${BOLD}***plain specification language intro${NC} (5/5)" Write-Host "" -Write-Host " ${WHITE}${BOLD}RENDERING CODE${NC} - Generate your app" +Write-Host " ${WHITE}${BOLD}REGENERATING CODE${NC} - Generate your app" Write-Host "" Write-Host " Once you have a ***plain file, generate code with:" Write-Host "" diff --git a/partial_rendering.py b/partial_rendering.py index 01803da0..86578064 100644 --- a/partial_rendering.py +++ b/partial_rendering.py @@ -99,11 +99,11 @@ def _check_last_rendered_frid(module: PlainModule, last_rendered_frid: str | Non return raise MissingPreviousFunctionalitiesError( - f"The build folder of module {module.module_name} was rendered for functionality " + f"The build folder of module {module.module_name} was regenerated for functionality " f"'{last_rendered_frid}', which the module does not have. Its functionalities are: " f"{', '.join(frids)}.\n\n" - "A build folder rendered by a client that numbered the functionalities cannot be continued. " - f"Remove {module.build_folder} and render again." + "A build folder regenerated by a client that numbered the functionalities cannot be continued. " + f"Remove {module.build_folder} and regenerate again." ) @@ -134,7 +134,7 @@ def get_plain_module_render_state( if found_module is None: raise ModuleDoesNotExistError( - f"Last rendered module {last_rendered_module_name} not found in {[rmodule.module_name for rmodule in all_required_modules]}" + f"Last regenerated module {last_rendered_module_name} not found in {[rmodule.module_name for rmodule in all_required_modules]}" ) module = found_module @@ -274,7 +274,7 @@ def _resume_render_choice( if not pr.last_render_module.is_module_fully_rendered(): if not pr.last_render_frid: - raise ValueError("Last render FRID is not set for a non-initial module") + raise ValueError("Last regenerated FRID is not set for a non-initial module") next_frid, next_module = plain_module.get_next_frid(pr.last_render_frid, pr.last_render_module.module_name) render_range = plain_spec.get_render_range_from(next_frid, next_module.plain_source) diff --git a/plain2code.py b/plain2code.py index eba459d6..39de03b5 100644 --- a/plain2code.py +++ b/plain2code.py @@ -293,7 +293,7 @@ def warn_about_functionalities_without_scenarios(plain_module) -> None: console.warning( f"No conformance scenario is written for {', '.join(functionalities)}, " - "so each one is rendered without conformance tests." + "so each one is regenerated without conformance tests." ) @@ -317,8 +317,8 @@ def warn_if_scenarios_without_conformance_script(plain_module, args) -> None: module_names = ", ".join(module_names_with_scenarios) console.warning( f"Test scenarios were found ({module_names}) but no conformance tests script is configured, " - "so no scenario is rendered. Set --conformance-tests-script or 'conformance_tests_script' " - "in the config file to render them." + "so no test is regenerated for them. Set --conformance-tests-script or 'conformance_tests_script' " + "in the config file to regenerate the tests." ) @@ -419,7 +419,7 @@ def render( # noqa: C901 render_choice = None if render_choice is not None and render_range is not None: - raise Exception("Partial rendering and render range cannot be used together") + raise Exception("Partial regeneration and a regeneration range cannot be used together") module_renderer = ModuleRenderer( codeplainAPI, @@ -447,7 +447,7 @@ def run_render(): event_bus.publish(RenderFailed(error_message=user_error_message(e))) if args.headless: - console.info(f"Render started. Render ID: {run_state.render_id}") + console.info(f"Regeneration started. Regeneration ID: {run_state.render_id}") try: module_renderer.render_module() except RenderCancelledError: @@ -574,7 +574,7 @@ def main(): # noqa: C901 default_log_level = setup_logging(args, event_bus, run_state, args.log_to_file, args.log_file_name, args.headless) if no_terminal: - console.info("No terminal attached, so rendering without the TUI, as with --headless.") + console.info("No terminal attached, so regenerating without the TUI, as with --headless.") initialize_telemetry() diff --git a/plain2code_arguments.py b/plain2code_arguments.py index b1ff7f14..4d5656a5 100644 --- a/plain2code_arguments.py +++ b/plain2code_arguments.py @@ -265,7 +265,7 @@ def create_parser(): """Create the argument parser without parsing arguments.""" parser = argparse.ArgumentParser( description=( - "Render plain code to target code. " + "Regenerate target code from plain code. " "Path arguments resolve based on where they were written: " "values given on the command line are resolved against the current working " "directory, values read from config.yaml are resolved against the config " @@ -279,7 +279,7 @@ def create_parser(): "filename", type=str, nargs="?", - help="Path to the plain file to render. The directory containing this file has highest precedence for template loading, " + help="Path to the plain file to regenerate code from. The directory containing this file has highest precedence for template loading, " "so you can place custom templates here to override the defaults. See --template-dir for more details about template loading.", ) @@ -335,9 +335,10 @@ def create_parser(): render_range_group, "--render-range", type=frid_range_string, - help="Specify a range of functionalities to render (e.g. `add-task`, `add-task,list-tasks`). " - "Use comma to separate start and end IDs. If only one functionality ID is provided, only that functionality is rendered. " - "Range is inclusive of both start and end IDs.", + help="Specify a range of functionalities to regenerate (e.g. `add-task`, `add-task,list-tasks`). " + "Use comma to separate start and end IDs. If only one functionality ID is provided, only that functionality is regenerated. " + "Range is inclusive of both start and end IDs. The code is first reset to the functionality before the range. " + "To regenerate one functionality and keep the functionalities after it, use --regenerate.", ) _add_arg( render_range_group, @@ -349,7 +350,8 @@ def create_parser(): render_range_group.add_argument( "--regenerate", type=frid_string, - help="Regenerate a single already-rendered functionality (e.g. `add-task`). " + help="Regenerate a single functionality (e.g. `add-task`) that a full regeneration has already finished. " + "The other functionalities stay as they are. " "The functionality ID must match one of the functionalities in your plain file.", ) @@ -358,8 +360,8 @@ def create_parser(): "--force-render", action="store_true", default=False, - help="Render every module of the project again, from the first one. " - "The client does not ask where to start and the code rendered before is replaced.", + help="Regenerate every module of the project again, from the first one. " + "The client does not ask where to start and the code regenerated before is replaced.", ) _add_arg( @@ -414,7 +416,7 @@ def create_parser(): "--full-plain", action="store_true", help="Full preview ***plain specification before code generation. " - "Use when you want to preview context of all ***plain primitives that are going to be included in order to render the given module.", + "Use when you want to preview context of all ***plain primitives that are going to be included in order to regenerate the given module.", ) _add_arg( parser, @@ -435,7 +437,7 @@ def create_parser(): "--job-tag", type=job_tag_string, default=None, - help=f"Tag sent to the server with every request and attached to the render's LangSmith traces " + help=f"Tag sent to the server with every request and attached to the regeneration's LangSmith traces " f"(max {MAX_JOB_TAG_LENGTH} characters).", ) @@ -464,14 +466,14 @@ def create_parser(): "--copy-build", action="store_true", default=True, - help="If set, copy the rendered contents of code in `--base-folder` folder to `--build-dest` folder after successful rendering.", + help="If set, copy the regenerated contents of code in `--base-folder` folder to `--build-dest` folder after successful regeneration.", ) _add_arg( parser, "--build-dest", type=non_empty_string, default=DEFAULT_BUILD_DEST, - help="Target folder to copy rendered contents of code to (used only if --copy-build is set).", + help="Target folder to copy regenerated contents of code to (used only if --copy-build is set).", path=True, ) _add_arg( @@ -479,7 +481,7 @@ def create_parser(): "--copy-conformance-tests", action="store_true", default=False, - help="If set, copy the module's conformance tests (from `//tests`) to `--conformance-tests-dest` folder after successful rendering. Requires --conformance-tests-script.", + help="If set, copy the module's conformance tests (from `//tests`) to `--conformance-tests-dest` folder after successful regeneration. Requires --conformance-tests-script.", ) _add_arg( parser, @@ -522,18 +524,18 @@ def create_parser(): "--exit-when-done", action=argparse.BooleanOptionalAction, default=False, - help="Close the terminal interface as soon as rendering stops, instead of keeping it open " - "until you press Enter. The render summary is printed to the terminal as usual. " + help="Close the terminal interface as soon as regeneration stops, instead of keeping it open " + "until you press Enter. The regeneration summary is printed to the terminal as usual. " "Use --no-exit-when-done to keep the interface open when config.yaml turns this on. " - "Headless rendering always ends by itself, so the option changes nothing there.", + "Headless regeneration always ends by itself, so the option changes nothing there.", ) parser.add_argument( "--status", action="store_true", default=False, - help="Display account status including user information, API key label, and rendering credits. " - "Does not render any code.", + help="Display account status including user information, API key label, and regeneration credits. " + "Does not regenerate any code.", ) parser.add_argument( diff --git a/plain2code_cli.md b/plain2code_cli.md index 0a400434..afa9f1a4 100644 --- a/plain2code_cli.md +++ b/plain2code_cli.md @@ -9,12 +9,12 @@ [--status] [--version] [filename] -Render plain code to target code. Path arguments resolve based on where they were written: values given on the command line are resolved against the current working directory, values read +Regenerate target code from plain code. Path arguments resolve based on where they were written: values given on the command line are resolved against the current working directory, values read from config.yaml are resolved against the config file's directory, and defaults are resolved against the directory containing the plain file. Absolute paths (and paths starting with '~') are used as-is. positional arguments: - filename Path to the plain file to render. The directory containing this file has highest precedence for template loading, so you can place custom templates here to override + filename Path to the plain file to regenerate code from. The directory containing this file has highest precedence for template loading, so you can place custom templates here to override the defaults. See --template-dir for more details about template loading. options: @@ -29,12 +29,12 @@ are used as-is. --log-file-name LOG_FILE_NAME Name of the log file. Defaults to 'codeplain.log'. If a file already exists at the resolved path, it will be overwritten by the current logs. --render-range RENDER_RANGE - Specify a range of functionalities to render (e.g. `1` , `2`, `3`). Use comma to separate start and end IDs. If only one functionality ID is provided, only that - functionality is rendered. Range is inclusive of both start and end IDs. + Specify a range of functionalities to regenerate (e.g. `1` , `2`, `3`). Use comma to separate start and end IDs. If only one functionality ID is provided, only that + functionality is regenerated. Range is inclusive of both start and end IDs. --render-from RENDER_FROM Continue generation starting from this specific functionality (e.g. `2`). The functionality with this ID will be included in the output. The functionality ID must match one of the functionalities in your plain file. - --force-render Force re-render of all the required modules. + --force-render Force regeneration of all the required modules. --unittests-script UNITTESTS_SCRIPT Shell script to run unit tests on generated code. Receives the module's code folder path as its first argument (e.g. `plain_modules/module_name/code`). --conformance-tests-script CONFORMANCE_TESTS_SCRIPT @@ -47,17 +47,17 @@ are used as-is. --api [API] Alternative base URL for the API. Default: `https://api.codeplain.ai` --api-key API_KEY API key used to access the API. If not provided, the `CODEPLAIN_API_KEY` environment variable is used. --full-plain Full preview ***plain specification before code generation. Use when you want to preview context of all ***plain primitives that are going to be included in order - to render the given module. + to regenerate the given module. --dry-run Dry run preview of the code generation (without actually making any changes). --replay-with REPLAY_WITH --template-dir TEMPLATE_DIR Path to a custom template directory. Templates are searched in the following order: 1) Directory containing the plain file, 2) Custom template directory (if provided through this argument), 3) Built-in standard_template_library directory - --copy-build If set, copy the rendered contents of code in `--base-folder` folder to `--build-dest` folder after successful rendering. + --copy-build If set, copy the regenerated contents of code in `--base-folder` folder to `--build-dest` folder after successful regeneration. --build-dest BUILD_DEST - Target folder to copy rendered contents of code to (used only if --copy-build is set). + Target folder to copy regenerated contents of code to (used only if --copy-build is set). --copy-conformance-tests - If set, copy the module's conformance tests (from `//tests`) to `--conformance-tests-dest` folder after successful rendering. Requires + If set, copy the module's conformance tests (from `//tests`) to `--conformance-tests-dest` folder after successful regeneration. Requires --conformance-tests-script. --conformance-tests-dest CONFORMANCE_TESTS_DEST Target folder to copy conformance tests of code to (used only if --copy-conformance-tests is set). @@ -65,8 +65,8 @@ are used as-is. If set, render the state machine graph. --logging-config-path LOGGING_CONFIG_PATH Path to the logging configuration file. - --headless Run in headless mode: no TUI, no terminal output except a single render-started message. All logs are written to the log file. - --status Display account status including user information, API key label, and rendering credits. Does not render any code. + --headless Run in headless mode: no TUI, no terminal output except a single regeneration-started message. All logs are written to the log file. + --status Display account status including user information, API key label, and regeneration credits. Does not regenerate any code. --version Display the client version and exit. configuration: diff --git a/plain_modules.py b/plain_modules.py index 128f8a12..c97d8b06 100644 --- a/plain_modules.py +++ b/plain_modules.py @@ -542,15 +542,15 @@ def _ensure_module_folders_exist(self, first_render_frid: str, render_conformanc if not os.path.exists(self.module_build_folder): raise MissingPreviousFunctionalitiesError( - f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the source code folder does not exist.\n\n" - f"To fix this, please render the module from the beginning by running:\n" + f"Cannot start regeneration from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the source code folder does not exist.\n\n" + f"To fix this, please regenerate the module from the beginning by running:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION}" ) if not os.path.exists(self.module_conformance_tests_folder) and render_conformance_tests: raise MissingPreviousFunctionalitiesError( - f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the conformance tests folder does not exist.\n\n" - f"To fix this, please render the module from the beginning by running:\n" + f"Cannot start regeneration from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the conformance tests folder does not exist.\n\n" + f"To fix this, please regenerate the module from the beginning by running:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION}" ) @@ -578,8 +578,8 @@ def _ensure_frid_commit_exists( # Check in build folder if not git_utils.has_commit_for_frid(self.module_build_folder, frid, self.module_name): raise MissingPreviousFunctionalitiesError( - f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the implementation of the previous functionality ({self._frid_label(frid)}) hasn't been completed yet.\n\n" - f"To fix this, please render the missing functionality ({self._frid_label(frid)}) first by running:\n" + f"Cannot start regeneration from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the implementation of the previous functionality ({self._frid_label(frid)}) hasn't been completed yet.\n\n" + f"To fix this, please regenerate from the missing functionality ({self._frid_label(frid)}) first by running:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION} --render-from {frid}" ) @@ -587,8 +587,8 @@ def _ensure_frid_commit_exists( if render_conformance_tests: if not git_utils.has_commit_for_frid(self.module_conformance_tests_folder, frid, self.module_name): raise MissingPreviousFunctionalitiesError( - f"Cannot start rendering from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the conformance tests for the previous functionality ({self._frid_label(frid)}) haven't been completed yet.\n\n" - f"To fix this, please render the missing functionality ({self._frid_label(frid)}) first by running:\n" + f"Cannot start regeneration from functionality {self._frid_label(first_render_frid)} for module '{self.module_name}' because the conformance tests for the previous functionality ({self._frid_label(frid)}) haven't been completed yet.\n\n" + f"To fix this, please regenerate from the missing functionality ({self._frid_label(frid)}) first by running:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION} --render-from {frid}" ) @@ -606,15 +606,15 @@ def ensure_frid_can_be_regenerated(self, frid: str, render_conformance_tests: bo self.module_build_folder, frid, self.module_name ): raise MissingPreviousFunctionalitiesError( - f"Cannot regenerate functionality {frid} because it has not been fully rendered yet. " - f"Please render all functionalities first by running:\n" + f"Cannot regenerate functionality {frid} alone because a full regeneration has not finished it yet. " + f"Please regenerate all functionalities first by running:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION}" ) if render_conformance_tests and not os.path.exists(self.module_conformance_tests_folder): raise MissingPreviousFunctionalitiesError( - f"Cannot regenerate functionality {frid} because module {self.module_name} was rendered " - f"without conformance tests. Render the module again with conformance tests:\n" + f"Cannot regenerate functionality {frid} alone because module {self.module_name} was regenerated " + f"without conformance tests. Regenerate the whole module again with conformance tests:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION}" ) @@ -643,9 +643,10 @@ def ensure_render_from_keeps_regenerations(self, start_frid: str) -> None: if regenerated_frid is None: return raise MissingPreviousFunctionalitiesError( - f"Cannot render from functionality {start_frid} of module {self.module_name}. " - f"Functionality {regenerated_frid} was regenerated, and a render from functionality {start_frid} " - f"would remove that regeneration. Render from functionality {regenerated_frid} instead:\n" + f"Cannot regenerate from functionality {start_frid} of module {self.module_name}. " + f"Functionality {regenerated_frid} was regenerated alone with --regenerate, and a regeneration from " + f"functionality {start_frid} would remove that change. " + f"Regenerate from functionality {regenerated_frid} instead:\n" f" codeplain {self.module_name}{plain_file.PLAIN_SOURCE_FILE_EXTENSION} --render-from {regenerated_frid}" ) diff --git a/render_machine/actions/create_dist.py b/render_machine/actions/create_dist.py index 9a1dfd4d..27f3d4cc 100644 --- a/render_machine/actions/create_dist.py +++ b/render_machine/actions/create_dist.py @@ -21,6 +21,8 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | render_context.conformance_tests.get_module_conformance_tests_folder(render_context.module_name), render_context.conformance_tests_dest, ) - console.info(f"✓ Render of module {render_context.module_name} completed successfully.", color=SUCCESS_COLOR) + console.info( + f"✓ Regeneration of module {render_context.module_name} completed successfully.", color=SUCCESS_COLOR + ) return self.SUCCESSFUL_OUTCOME, None diff --git a/render_machine/actions/exit_with_error.py b/render_machine/actions/exit_with_error.py index 645f70ac..83a7c3b8 100644 --- a/render_machine/actions/exit_with_error.py +++ b/render_machine/actions/exit_with_error.py @@ -27,11 +27,11 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any | run_state=render_context.run_state, ) console.info( - f"To continue rendering from the last successfully rendered functionality, " + f"To continue regeneration from the last successfully regenerated functionality, " f"provide the --render-from {render_context.frid_context.frid} flag." ) if render_context.run_state.render_id is not None: - console.info(f"Render ID: {render_context.run_state.render_id}") + console.info(f"Regeneration ID: {render_context.run_state.render_id}") return self.SUCCESSFUL_OUTCOME, RenderError.encode(message=error_message).to_payload() diff --git a/render_machine/actions/fix_conformance_test.py b/render_machine/actions/fix_conformance_test.py index c50c9fec..2312876a 100644 --- a/render_machine/actions/fix_conformance_test.py +++ b/render_machine/actions/fix_conformance_test.py @@ -48,7 +48,7 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any | if ctx.fix_attempts >= MAX_CONFORMANCE_TEST_FIX_ATTEMPTS: ctx.conformance_fix_agents = None if ctx.conformance_tests_render_attempts >= MAX_CONFORMANCE_TEST_RERENDER_ATTEMPTS: - error_msg = f"The renderer was unable to produce an implementation that passes conformance tests for functionality '{render_context.frid_context.frid}' after many attempts. Please review and rewrite the specification. (Render ID: {render_context.run_state.render_id})" + error_msg = f"The regeneration engine was unable to produce an implementation that passes conformance tests for functionality '{render_context.frid_context.frid}' after many attempts. Please review and rewrite the specification. (Regeneration ID: {render_context.run_state.render_id})" render_context.last_error_message = error_msg return ( self.LIMIT_EXCEEDED_OUTCOME, diff --git a/render_machine/actions/prepare_repositories.py b/render_machine/actions/prepare_repositories.py index 16217dcc..610963e4 100644 --- a/render_machine/actions/prepare_repositories.py +++ b/render_machine/actions/prepare_repositories.py @@ -66,7 +66,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | render_context.plain_module.module_memory_folder, ) else: - console.debug("Initializing git repositories for the render folders.") + console.debug("Initializing git repositories for the regeneration folders.") git_utils.init_git_repo( render_context.build_folder, @@ -106,8 +106,8 @@ def _prepare_regenerate(self, render_context: RenderContext): if not git_utils.has_commit_for_frid(render_context.build_folder, frid, render_context.module_name): return self._regenerate_not_possible( render_context, - f"Cannot regenerate functionality {frid} because it has not been fully rendered yet. " - f"Please render all functionalities first by running: " + f"Cannot regenerate functionality {frid} alone because a full regeneration has not finished it yet. " + f"Please regenerate all functionalities first by running: " f"codeplain {render_context.module_name}.plain", ) @@ -117,7 +117,7 @@ def _prepare_regenerate(self, render_context: RenderContext): if not module_metadata or "functionalities" not in module_metadata: return self._regenerate_not_possible( render_context, - "module_metadata.json is missing or incomplete. Please re-render the module from the beginning.", + "module_metadata.json is missing or incomplete. Please regenerate the module from the beginning.", ) stored_functionalities = module_metadata["functionalities"] @@ -126,7 +126,7 @@ def _prepare_regenerate(self, render_context: RenderContext): return self._regenerate_not_possible( render_context, f"module_metadata.json holds no functionality {frid}. " - "Please re-render the module from the beginning.", + "Please regenerate the module from the beginning.", ) render_context.old_frid_spec = old_functionality["markdown"] diff --git a/render_machine/actions/render_conformance_tests.py b/render_machine/actions/render_conformance_tests.py index 78b85786..2ba7c3ff 100644 --- a/render_machine/actions/render_conformance_tests.py +++ b/render_machine/actions/render_conformance_tests.py @@ -200,7 +200,9 @@ def _render_acceptance_test(self, render_context: RenderContext): # asks for a scenario that already has a test. Rendering it again costs a call and lets the # render write a second test for the one scenario. if scenario["id"] in ctx.rendered_acceptance_scenarios: - console.warning(f"The acceptance scenario {scenario['id']} already has a test. It is not rendered again.") + console.warning( + f"The acceptance scenario {scenario['id']} already has a test. It is not regenerated again." + ) return self.SUCCESSFUL_OUTCOME, None _, existing_files_content = ImplementationCodeHelpers.fetch_existing_files(render_context.build_folder) diff --git a/render_machine/actions/render_functional_requirement.py b/render_machine/actions/render_functional_requirement.py index cb0b7fc2..172466b1 100644 --- a/render_machine/actions/render_functional_requirement.py +++ b/render_machine/actions/render_functional_requirement.py @@ -23,7 +23,7 @@ def functionality_heading(render_context) -> str: """The block logged when a functionality starts: its module, its ID, and where it stands.""" msg = "-------------------------------------\n" msg += f"Module: {render_context.module_name}\n" - msg += f"Rendering functionality {render_context.frid_context.frid}" + msg += f"Regenerating functionality {render_context.frid_context.frid}" position = render_context.current_functionality_position() if position: msg += f" ({position})" @@ -39,7 +39,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | functionality = render_context.functionality_label() error_msg = ( f"Functionality {functionality}: unit tests still fail after " - f"{MAX_CODE_GENERATION_RETRIES} render attempts, {MAX_UNITTEST_FIX_ATTEMPTS} fix rounds each." + f"{MAX_CODE_GENERATION_RETRIES} regeneration attempts, {MAX_UNITTEST_FIX_ATTEMPTS} fix rounds each." ) last_output_path = render_context.script_execution_history.latest_unit_test_output_path if last_output_path: @@ -51,8 +51,8 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | if render_context.frid_context.functional_requirement_render_attempts > 1: console.info( - f"↻ Unittests could not be fixed after rendering the functionality. " - f"Restarting rendering functionality " + f"↻ Unittests could not be fixed after regenerating the functionality. " + f"Restarting regeneration of functionality " f"{render_context.functionality_label()} from scratch.", color=RETRY_COLOR, ) diff --git a/render_machine/render_context.py b/render_machine/render_context.py index 1ae04399..d703f600 100644 --- a/render_machine/render_context.py +++ b/render_machine/render_context.py @@ -351,7 +351,7 @@ def _on_unit_test_limit_exceeded_in_conformance_tests(self): console.info( f"↻ Failed to adjust the unit tests after implementation code was updated while fixing the " f"conformance tests for functionality {functionality}. " - f"Restarting rendering the functionality {functionality} from scratch.", + f"Restarting regeneration of the functionality {functionality} from scratch.", color=RETRY_COLOR, ) self.machine.dispatch(triggers.RESTART_FRID_PROCESSING) diff --git a/render_machine/render_types.py b/render_machine/render_types.py index 6f2f00c0..f65eb178 100644 --- a/render_machine/render_types.py +++ b/render_machine/render_types.py @@ -315,7 +315,7 @@ def get_display_message(cls, payload: Any, fallback_message: str | None = None) return fallback_message # Priority 3: Default fallback - return "✗ Rendering failed\nPress Ctrl+L to view logs for more details" + return "✗ Regeneration failed\nPress Ctrl+L to view logs for more details" @classmethod def from_payload(cls, payload: Any) -> "RenderError | None": diff --git a/tests/test_cli_output.py b/tests/test_cli_output.py index fcd43db2..1c723d26 100644 --- a/tests/test_cli_output.py +++ b/tests/test_cli_output.py @@ -219,7 +219,7 @@ def test_has_active_plan_credits(self, mock_console): mock_console.print.assert_called_once() call_args = mock_console.print.call_args[0][0] assert "To manage your plan" in call_args - assert "No rendering credits remaining" not in call_args + assert "No regeneration credits remaining" not in call_args @patch("cli_output.status.console") def test_has_active_purchased_credits(self, mock_console): @@ -235,7 +235,7 @@ def test_has_active_purchased_credits(self, mock_console): mock_console.print.assert_called_once() call_args = mock_console.print.call_args[0][0] assert "To manage your plan" in call_args - assert "No rendering credits remaining" not in call_args + assert "No regeneration credits remaining" not in call_args @patch("cli_output.status.console") def test_has_active_promo_credits(self, mock_console): @@ -251,7 +251,7 @@ def test_has_active_promo_credits(self, mock_console): mock_console.print.assert_called_once() call_args = mock_console.print.call_args[0][0] assert "To manage your plan" in call_args - assert "No rendering credits remaining" not in call_args + assert "No regeneration credits remaining" not in call_args @patch("cli_output.status.console") def test_no_credits_remaining(self, mock_console): @@ -264,7 +264,7 @@ def test_no_credits_remaining(self, mock_console): mock_console.print.assert_called_once() call_args = mock_console.print.call_args[0][0] - assert "No rendering credits remaining" in call_args + assert "No regeneration credits remaining" in call_args assert "https://platform.codeplain.ai/plans" in call_args @patch("cli_output.status.console") @@ -278,7 +278,7 @@ def test_expired_plan_credits(self, mock_console): mock_console.print.assert_called_once() call_args = mock_console.print.call_args[0][0] - assert "No rendering credits remaining" in call_args + assert "No regeneration credits remaining" in call_args @patch("cli_output.status.console") def test_null_plan_credits_and_empty_purchased(self, mock_console): @@ -287,7 +287,7 @@ def test_null_plan_credits_and_empty_purchased(self, mock_console): mock_console.print.assert_called_once() call_args = mock_console.print.call_args[0][0] - assert "No rendering credits remaining" in call_args + assert "No regeneration credits remaining" in call_args @patch("cli_output.status.datetime", FrozenDatetime) @@ -474,7 +474,7 @@ def test_promo_credit_buckets(self, mock_console, mock_api_class): promo_calls = [c for c in calls if "Promo" in c] assert len(promo_calls) == 1 # Active credits remain, so no "no credits remaining" warning - assert not any("No rendering credits remaining" in c for c in calls) + assert not any("No regeneration credits remaining" in c for c in calls) @patch("cli_output.status.codeplain_api.CodeplainAPI") @patch("cli_output.status.console") diff --git a/tests/test_functionality_position.py b/tests/test_functionality_position.py index 463a2b0c..94898d4b 100644 --- a/tests/test_functionality_position.py +++ b/tests/test_functionality_position.py @@ -77,14 +77,14 @@ def _log_heading(frids, frid, attempts=1): def test_the_log_heading_carries_the_position(): - assert "Rendering functionality add-login-button (1/3):" in _log_heading(FRIDS, "add-login-button") + assert "Regenerating functionality add-login-button (1/3):" in _log_heading(FRIDS, "add-login-button") def test_the_log_heading_keeps_the_attempt_after_the_position(): heading = _log_heading(FRIDS, "add-login-button", attempts=2) - assert "Rendering functionality add-login-button (1/3), attempt number 2/" in heading + assert "Regenerating functionality add-login-button (1/3), attempt number 2/" in heading def test_the_log_heading_without_a_position_reads_as_before(): - assert "Rendering functionality add-login-button:" in _log_heading([], "add-login-button") + assert "Regenerating functionality add-login-button:" in _log_heading([], "add-login-button") diff --git a/tests/test_plain2code.py b/tests/test_plain2code.py index b01ddd7d..93abdf04 100644 --- a/tests/test_plain2code.py +++ b/tests/test_plain2code.py @@ -38,7 +38,7 @@ def test_warns_when_scenarios_present_and_no_conformance_script(): mock_console.warning.assert_called_once() warning_message = mock_console.warning.call_args.args[0] assert "top" in warning_message - assert "no scenario is rendered" in warning_message + assert "no test is regenerated for them" in warning_message def test_no_warning_when_conformance_script_configured(): diff --git a/tests/test_regenerate_checks.py b/tests/test_regenerate_checks.py index ebe58e69..56abe742 100644 --- a/tests/test_regenerate_checks.py +++ b/tests/test_regenerate_checks.py @@ -59,7 +59,9 @@ def test_a_functionality_after_the_rendered_ones_cannot_be_regenerated(solo_modu with pytest.raises(MissingPreviousFunctionalitiesError) as error: solo_module.ensure_frid_can_be_regenerated("solo-three", render_conformance_tests=False) - assert str(error.value).startswith("Cannot regenerate functionality solo-three because it has not been") + assert str(error.value).startswith( + "Cannot regenerate functionality solo-three alone because a full regeneration has not" + ) assert "--render-from" not in str(error.value) @@ -67,7 +69,9 @@ def test_a_module_that_was_never_rendered_cannot_be_regenerated(solo_module): with pytest.raises(MissingPreviousFunctionalitiesError) as error: solo_module.ensure_frid_can_be_regenerated("solo-one", render_conformance_tests=False) - assert str(error.value).startswith("Cannot regenerate functionality solo-one because it has not been") + assert str(error.value).startswith( + "Cannot regenerate functionality solo-one alone because a full regeneration has not" + ) def test_a_module_rendered_without_conformance_tests_cannot_be_regenerated_with_them(solo_module): @@ -78,7 +82,7 @@ def test_a_module_rendered_without_conformance_tests_cannot_be_regenerated_with_ solo_module.ensure_frid_can_be_regenerated("solo-one", render_conformance_tests=True) assert str(error.value).startswith( - "Cannot regenerate functionality solo-one because module pr_solo was rendered without conformance tests." + "Cannot regenerate functionality solo-one alone because module pr_solo was regenerated without conformance tests." ) @@ -126,7 +130,7 @@ def test_a_render_from_that_removes_an_earlier_regeneration_is_stopped(solo_modu solo_module.ensure_render_from_keeps_regenerations("solo-three") assert str(error.value).startswith( - "Cannot render from functionality solo-three of module pr_solo. Functionality solo-one was regenerated" + "Cannot regenerate from functionality solo-three of module pr_solo. Functionality solo-one was regenerated" ) assert "--render-from solo-one" in str(error.value) diff --git a/tests/test_render_stop_reason.py b/tests/test_render_stop_reason.py index c0a3cec8..d9ea73d8 100644 --- a/tests/test_render_stop_reason.py +++ b/tests/test_render_stop_reason.py @@ -120,7 +120,7 @@ def test_unit_tests_failing_after_the_last_attempt_name_the_cause(workspace, fix assert last_output_path is not None and os.path.exists(last_output_path) expected_message = ( - f"Functionality pr_solo:solo-one (1/3): unit tests still fail after {MAX_CODE_GENERATION_RETRIES} render attempts, " + f"Functionality pr_solo:solo-one (1/3): unit tests still fail after {MAX_CODE_GENERATION_RETRIES} regeneration attempts, " f"{MAX_UNITTEST_FIX_ATTEMPTS} fix rounds each. Last unit tests output: {last_output_path}" ) assert error_log_messages(caplog) == [expected_message] @@ -226,8 +226,8 @@ def test_regenerating_a_functionality_that_was_not_rendered_names_the_cause(work code_renderer.run() expected_message = ( - "Cannot regenerate functionality solo-two because it has not been fully rendered yet. " - "Please render all functionalities first by running: codeplain pr_solo.plain" + "Cannot regenerate functionality solo-two alone because a full regeneration has not finished it yet. " + "Please regenerate all functionalities first by running: codeplain pr_solo.plain" ) assert render_context.state == States.RENDER_FAILED.value assert error_log_messages(caplog) == [expected_message] diff --git a/tests/test_tui_components.py b/tests/test_tui_components.py index 49af567b..e6000150 100644 --- a/tests/test_tui_components.py +++ b/tests/test_tui_components.py @@ -78,7 +78,7 @@ async def scenario(): display_success_message(app, "out/[weird] path") await pilot.pause() - assert "rendering completed!" in str(status.content) + assert "regeneration completed!" in str(status.content) assert "generated code folder: out/[weird] path" in str(status.content) display_error_message(app, "Error: [Errno 2] No such file: run_tests.sh [b") diff --git a/tests/test_tui_usage.py b/tests/test_tui_usage.py index 08f4c64a..4211dbd9 100644 --- a/tests/test_tui_usage.py +++ b/tests/test_tui_usage.py @@ -61,7 +61,7 @@ async def scenario(): text = _usage_text(app) assert "functionalities [#FFFFFF]3" in text assert "used credits [#FFFFFF]3" in text - assert "render time [#FFFFFF]5m 49s" in text + assert "regeneration time [#FFFFFF]5m 49s" in text asyncio.run(scenario()) @@ -74,19 +74,19 @@ async def scenario(): async with app.run_test(): _set_live_render_time(run_state, 10) app._refresh_usage_summary() - assert "render time [#FFFFFF]10s" in _usage_text(app) + assert "regeneration time [#FFFFFF]10s" in _usage_text(app) # While paused, a refresh must not sample the render time again. app._usage_paused = True _set_live_render_time(run_state, 999) # 16m 39s app._refresh_usage_summary() - assert "render time [#FFFFFF]10s" in _usage_text(app) + assert "regeneration time [#FFFFFF]10s" in _usage_text(app) assert "16m 39s" not in _usage_text(app) # Resuming samples again. app._usage_paused = False app._refresh_usage_summary() - assert "render time [#FFFFFF]16m 39s" in _usage_text(app) + assert "regeneration time [#FFFFFF]16m 39s" in _usage_text(app) asyncio.run(scenario()) @@ -103,13 +103,13 @@ async def scenario(): await pilot.pause() status = _status_text(app) - assert "rendering completed!" in status + assert "regeneration completed!" in status assert "generated code folder: plain_modules/hello_world_python/" in status usage = _usage_text(app) assert "functionalities [#FFFFFF]6" in usage assert "used credits [#FFFFFF]6" in usage - assert "render time [#FFFFFF]5m 49s" in usage + assert "regeneration time [#FFFFFF]5m 49s" in usage assert app._render_finished is True # The live value is captured onto the run state so the console summary matches. assert run_state.render_time_accumulated == 349 @@ -140,7 +140,7 @@ async def scenario(): assert "functionalities [#FFFFFF]2" in usage assert "used credits [#FFFFFF]2" in usage # Regression: this was "0s" because the summary trusted the unfinalized state. - assert "render time [#FFFFFF]5m 49s" in usage + assert "regeneration time [#FFFFFF]5m 49s" in usage assert app._render_finished is True assert run_state.render_time_accumulated == 349 @@ -162,7 +162,7 @@ async def scenario(): usage = _usage_text(app) assert "functionalities [#FFFFFF]0" in usage assert "used credits [#FFFFFF]0" in usage - assert "render time [#FFFFFF]0s" in usage + assert "regeneration time [#FFFFFF]0s" in usage asyncio.run(scenario()) diff --git a/tests/test_usage_summary.py b/tests/test_usage_summary.py index 6c8022a8..35958c6e 100644 --- a/tests/test_usage_summary.py +++ b/tests/test_usage_summary.py @@ -8,19 +8,19 @@ def test_used_credits_equals_functionalities(self): line = format_usage_summary(6, 349) assert "functionalities [#FFFFFF]6" in line assert "used credits [#FFFFFF]6" in line - assert "render time [#FFFFFF]5m 49s" in line + assert "regeneration time [#FFFFFF]5m 49s" in line def test_zero_usage(self): line = format_usage_summary(0, 0) assert "functionalities [#FFFFFF]0" in line assert "used credits [#FFFFFF]0" in line - assert "render time [#FFFFFF]0s" in line + assert "regeneration time [#FFFFFF]0s" in line def test_labels_use_muted_color(self): line = format_usage_summary(3, 10) assert line.startswith("[#8E8F91]functionalities") assert "[#8E8F91]used credits" in line - assert "[#8E8F91]render time" in line + assert "[#8E8F91]regeneration time" in line def test_custom_colors(self): line = format_usage_summary(2, 5, label_color="#111111", value_color="#222222") diff --git a/tui/components.py b/tui/components.py index 841d2241..ee79daec 100644 --- a/tui/components.py +++ b/tui/components.py @@ -72,7 +72,7 @@ def compose(self): self._footer_text_widget = Static(footer_rendering_text, classes="custom-footer-text") yield self._footer_text_widget if self.render_id: - yield Static(f"render id: {self.render_id} ", classes="custom-footer-render-id", markup=False) + yield Static(f"regeneration id: {self.render_id} ", classes="custom-footer-render-id", markup=False) def update_footer_state(self, state: Literal["rendering", "pausing", "paused", "finished"]) -> None: self.remove_class("footer-state-default") @@ -500,7 +500,7 @@ def on_mount(self) -> None: def compose(self): yield RenderingInfoBox() - yield Static("rendering status", classes="frid-state-machine-title") + yield Static("regeneration status", classes="frid-state-machine-title") with Vertical(classes="frid-state-machine-box"): yield ProgressItem( self.IMPLEMENTING_FUNCTIONALITY_TEXT, diff --git a/tui/plain2code_tui.py b/tui/plain2code_tui.py index dcd992a7..232caac9 100644 --- a/tui/plain2code_tui.py +++ b/tui/plain2code_tui.py @@ -187,7 +187,7 @@ def compose(self) -> ComposeResult: show_testing_env=self.prepare_environment_script is not None, ) yield Static( - "[#FFFFFF]Rendering in progress...[/#FFFFFF]", + "[#FFFFFF]Regeneration in progress...[/#FFFFFF]", id=TUIComponents.RENDER_STATUS_WIDGET.value, ) yield Static( @@ -257,7 +257,7 @@ def on_render_module_started(self, event: RenderModuleStarted): info_box = frid_progress.query_one(RenderingInfoBox) info_box.update_module(f"{FRIDProgress.RENDERING_MODULE_TEXT}{event.module_name}") except Exception as e: - log_to_widget(self, "WARNING", f"Error updating render module name: {type(e).__name__}: {e}") + log_to_widget(self, "WARNING", f"Error updating regeneration module name: {type(e).__name__}: {e}") def on_render_module_completed(self, event: RenderModuleCompleted): """Update TUI based on the current state machine state.""" diff --git a/tui/plain_module_render_choice_tui.py b/tui/plain_module_render_choice_tui.py index 2e4837a6..657c4a31 100644 --- a/tui/plain_module_render_choice_tui.py +++ b/tui/plain_module_render_choice_tui.py @@ -43,9 +43,9 @@ def get_msg_from_choice(self, render_choice: RenderChoice) -> str: if render_choice.choice_type == "module_start": if render_choice.module.module_name == self.plain_module.module_name: if render_choice.module.is_module_fully_rendered(): - return f"Re-render the current module ([#5593FF]{render_choice.module.module_name}[/])" + return f"Regenerate the current module again ([#5593FF]{render_choice.module.module_name}[/])" else: - return f"Start rendering the current module ([#5593FF]{render_choice.module.module_name}[/])" + return f"Start regenerating the current module ([#5593FF]{render_choice.module.module_name}[/])" else: return f"Start from module [#5593FF]{render_choice.module.module_name}[/]" elif render_choice.choice_type == "render_from_change": @@ -54,7 +54,7 @@ def get_msg_from_choice(self, render_choice: RenderChoice) -> str: start_frid = render_choice.render_range[0] quote = self._short_functionality_quote(render_choice.module, start_frid) return ( - f"Render from changed functionality [#5593FF]{start_frid}[/]" + f"Regenerate from changed functionality [#5593FF]{start_frid}[/]" f" in module [#5593FF]{render_choice.module.module_name}[/]" f": [#888]{quote}[/]" ) @@ -62,7 +62,8 @@ def get_msg_from_choice(self, render_choice: RenderChoice) -> str: assert render_choice.module is not None assert render_choice.render_range is not None return ( - f"Render from regenerated functionality [#5593FF]{render_choice.render_range[0]}[/]" + f"Regenerate from functionality [#5593FF]{render_choice.render_range[0]}[/]" + " (regenerated alone with --regenerate)" f" in module [#5593FF]{render_choice.module.module_name}[/]" ) elif render_choice.choice_type == "rerender_affected" and self.plain_module_render_state.change is not None: @@ -72,11 +73,11 @@ def get_msg_from_choice(self, render_choice: RenderChoice) -> str: module_names = ", ".join([m.module_name for m in all_affected_modules]) if len(all_affected_modules) == 1: - return f"Re-render module [#5593FF]{module_names}[/] from scratch" - return f"Re-render affected modules ([#5593FF]{module_names}[/]) from scratch" + return f"Regenerate module [#5593FF]{module_names}[/] from scratch" + return f"Regenerate affected modules ([#5593FF]{module_names}[/]) from scratch" elif render_choice.choice_type == "rerender_from_first": - return f"Re-render from first module ([#5593FF]{render_choice.module.module_name}[/])" + return f"Regenerate from first module ([#5593FF]{render_choice.module.module_name}[/])" elif render_choice.choice_type == "continue_from_frid": msg = "Continue from" next_frid = render_choice.render_range[0] if render_choice.render_range else None @@ -113,7 +114,7 @@ def on_mount(self) -> None: info_box.mount(Label(f"Module: {pr.last_render_module.module_name}", classes="rendering-info-row")) if pr.last_render_module.is_module_fully_rendered(): - info_box.mount(Label("Module fully rendered", classes="rendering-info-row")) + info_box.mount(Label("Module fully regenerated", classes="rendering-info-row")) elif pr.last_render_frid is not None: frid = pr.last_render_frid specifications, _ = plain_spec.get_specifications_for_frid(pr.last_render_module.plain_source, frid) @@ -139,7 +140,7 @@ def on_mount(self) -> None: change_box.mount( Label( "The .module archive has no conformance tests but testing is enabled; " - "the module must be re-rendered (its .module file will be removed).", + "the module must be regenerated (its .module file will be removed).", classes="rendering-info-title", ) ) @@ -160,7 +161,7 @@ def on_mount(self) -> None: ) elif pr.last_render_module.is_module_fully_rendered(): - change_box.mount(Label("The current module is fully rendered.", classes="rendering-info-title")) + change_box.mount(Label("The current module is fully regenerated.", classes="rendering-info-title")) else: interrupted_module = pr.last_render_module interrupted_frid = plain_spec.get_first_frid(interrupted_module.plain_source) @@ -173,7 +174,7 @@ def on_mount(self) -> None: interrupted_module = next_module interrupted = qualified_frid(interrupted_module.module_name, interrupted_frid) - msg = f"--- Rendering interrupted during [#5593FF]functionality {interrupted}[/] ---" + msg = f"--- Regeneration interrupted during [#5593FF]functionality {interrupted}[/] ---" change_box.mount(Label(msg, classes="rendering-info-row")) @@ -187,7 +188,7 @@ def on_mount(self) -> None: else: change_box.mount( Label( - "Resume from the last successfully rendered functionality or start over.", + "Resume from the last successfully regenerated functionality or start over.", classes="rendering-info-title", ) ) diff --git a/tui/state_handlers.py b/tui/state_handlers.py index cb842ab6..12f4c170 100644 --- a/tui/state_handlers.py +++ b/tui/state_handlers.py @@ -195,9 +195,11 @@ def handle(self, segments: list[str], snapshot: RenderContextSnapshot, previous_ if segments[2] != States.POSTPROCESSING_CONFORMANCE_TESTS.value: if segments[2] == States.CONFORMANCE_TESTING_INITIALISED.value: phase = snapshot.conformance_tests_running_context.acceptance_test_phase - # Rendering full conformance tests (if there are no acceptance tests available or haven't been started yet) + # Regenerating full conformance tests (if there are no acceptance tests available or haven't been started yet) if phase == AcceptanceTestPhase.NOT_STARTED or phase == AcceptanceTestPhase.NOT_APPLICABLE: - rendering_text = f"Rendering conformance tests for functionality {_testing_functionality(snapshot)}" + rendering_text = ( + f"Regenerating conformance tests for functionality {_testing_functionality(snapshot)}" + ) update_progress_item_substates( self.tui, TUIComponents.FRID_PROGRESS_CONFORMANCE_TEST.value, @@ -206,9 +208,9 @@ def handle(self, segments: list[str], snapshot: RenderContextSnapshot, previous_ else: scenario = snapshot.conformance_tests_running_context.get_current_acceptance_scenario() acceptance_test_text = ( - f"Rendering acceptance test for scenario {scenario['id']}" + f"Regenerating acceptance test for scenario {scenario['id']}" if scenario - else "Rendering acceptance test" + else "Regenerating acceptance test" ) update_progress_item_substates( self.tui, diff --git a/tui/widget_helpers.py b/tui/widget_helpers.py index 3bb46403..85177cd7 100644 --- a/tui/widget_helpers.py +++ b/tui/widget_helpers.py @@ -93,7 +93,7 @@ def display_success_message(tui, rendered_code_path: str): # rendered_code_path is user-controlled and may contain square brackets, so build the # message as Content instead of interpolating it into a markup string. message = Content.assemble( - ("✓ rendering completed!", "#79FC96"), + ("✓ regeneration completed!", "#79FC96"), " ", ("(press enter to exit)", "#888888"), "\n", diff --git a/usage_summary.py b/usage_summary.py index 6a4bea51..cadd2af2 100644 --- a/usage_summary.py +++ b/usage_summary.py @@ -26,5 +26,5 @@ def format_usage_summary( return ( f"[{label_color}]functionalities [{value_color}]{functionalities} " f"[{label_color}]used credits [{value_color}]{used_credits} " - f"[{label_color}]render time [{value_color}]{format_duration_hms(render_time_seconds)}" + f"[{label_color}]regeneration time [{value_color}]{format_duration_hms(render_time_seconds)}" )