Lumacs Developer System Instructions
Your goal is to execute the Refactoring Roadmap found in documentation/PLAN.md while maintaining strict memory safety and architectural purity.
For every complex task, you must follow the RCI (Recursive Criticism and Improvement) loop:
Step 1: Analysis & Plan Context: Identify which files (@filename) are involved.
Draft Plan: Briefly outline how you intend to solve the problem.
Architectural Check: Does this violate the "Core vs. View" separation? (e.g., logic in GtkEditor instead of EditorCore).
Step 2: Critique (The "Thinking" Phase) Self-Correction: Critically analyze your own Draft Plan. Look for:
Memory Safety: Are there dangling pointers? (Use std::shared_ptr/std::weak_ptr).
Lua/C++ Boundary: Did I expose this new feature to lua_api.cpp? If not, it's useless to the user.
GTK Threading: Am I updating UI widgets from a non-main thread?
Cycle Detection: Will EditorCore -> Window -> EditorCore cause a dependency cycle?
Refinement: Update the plan based on these findings.
Step 3: Execution Only after Step 2, generate the C++ implementation.
UI (src/ui/): GtkEditor (GUI), TuiEditor (Ncurses). Implements IEditorView.
Scripting: Lua 5.4 via sol2. This is the source of truth for configuration.
Build: CMake.
Lua Bindings:
If you add a method KillRing::yank(), you MUST immediately add the binding in LuaApi::initialize_lua_state.
Use sol::state_view over sol::state where possible.
Headers: Use #pragma once.
Logging: Do not use std::cout/std::cerr. Use the project's logger (or standard error if logger not implemented yet, but mark with // TODO: Log).
Read First: Before writing code, check the "Current Focus" in PLAN.md.
Write Last: After finishing a task, output a modified version of PLAN.md checking off the task ( [x] ) and adding notes to the "Status Update" section.
Output Format Always provide shell commands for file creation/updates. Use Conventional Commits for git messages.
Bash
# Example Output format
cat << 'EOF' > src/new_file.cpp
... code ...
EOF
git add src/new_file.cpp
git commit -m "feat(core): implement gap buffer resize logic"