# IncludeCPP Changelog

## v4.9.14 (2026-02-06)

### Critical Fix: CsslLang Instance Methods

**Fixed:** All 20 new API functions from v4.9.12 are now accessible as **instance methods** on `CsslLang`.

Previously, the functions were only available as module-level functions:
```python
# v4.9.12 - Module-level only (still works):
from includecpp import CSSL
CSSL.async_console()
CSSL.profile("code")
```

Now they also work as instance methods:
```python
# v4.9.13 - Instance methods (NEW):
cssl = CSSL.CsslLang()
cssl.async_console()
cssl.profile("code")
cssl.watch("variable", callback)
cssl.validate("code")
# ... all 20 functions
```

All instance methods operate on `self` rather than a global singleton, allowing multiple isolated `CsslLang` instances with independent state.

### Windows Long Path Fix (WinError 206)

**Fixed:** Automatic short path handling for Windows systems without long path support.

Previously, users on Windows 11 Home (without `LongPathsEnabled` registry key) would get:
```
CSSL Error: [WinError 206] Der Dateiname oder die Erweiterung ist zu lang
```

Now IncludeCPP automatically:
1. Detects if Windows long paths are enabled via registry check
2. If not enabled, uses short build paths at `C:\icpp\{hash}` instead of `%APPDATA%\{project}-gcc-build-proj`
3. Uses MD5 hash of project name + path for unique short directory names

No user action required - works automatically on Windows 11 Home and other systems without long path support.

### Parser Fix: Generic Types in Parameters

**Fixed:** Generic type syntax like `vector<dynamic>` now works in class and function parameters.
```cssl
class Animal(string name, int age, vector<dynamic> genetics) {
    // Now parses correctly
}
```

### Type Guard Fix: `[!type]` Negated Type Checking

**Fixed:** The `[!type]` syntax in type guards now correctly performs type checking instead of value comparison.

Previously, `[!list]*[fallback]value` would compare `value` against the evaluated result of `list` identifier (usually `None` or undefined), causing the guard to always trigger the fallback.

Now it correctly checks if the value is NOT of the specified type:
```cssl
sorted = fast_list.fast_sort([1, 2, 3])
// Guard: if NOT a list, use fallback
safe = [!list]*[{0}]sorted  // Returns sorted (because it IS a list)

// Works with all type names:
[!string]*[fallback]value   // if NOT string, use fallback
[!int]*[fallback]value      // if NOT int, use fallback
[!dict]*[fallback]value     // if NOT dict, use fallback
```

### `python::csslize()` Enhancement

**Fixed:** `python::csslize()` now properly converts Python basic types to CSSL native types:

- Python `list` → CSSL `List` (recognized by type guards)
- Python `dict` → CSSL `Dictionary`
- Python `tuple` → CSSL `List`
- Primitives (`int`, `float`, `str`, `bool`) → returned as-is

```cssl
// Before (v4.9.12): Type guard failed on C++ module results
sorted = fast_list.fast_sort([1, 2, 3])
[!list]*[fallback]sorted  // Would incorrectly use fallback

// After (v4.9.13): Works correctly
sorted = python::csslize(fast_list.fast_sort([1, 2, 3]))
[!list]*[fallback]sorted  // Correctly recognizes as list
```

### Consistent Type Checking

**Fixed:** Type checking is now consistent across all CSSL features:

- `typeof()` function
- Type guards (`[!type]`, `[type]`, `*[type]`)
- Return type assertions
- Variable type checks

All type checks now recognize both Python native types (`list`, `dict`) AND CSSL native types (`List`, `Array`, `Vector`, `Dictionary`, `Map`, `Stack`).

### New Feature: `cast()` Type Conversion

**Added:** The `cast(value, type)` function for explicit type conversion with validation.

**Two Syntax Forms:**
```cssl
// Explicit type argument
float f = cast(n, float);
string s = cast(n, string);
byte b = cast(n, byte);

// Type-inferred from declaration (cleaner syntax)
int n = 100;
float cast(n) floated_n;     // floated_n = 100.0
string cast(n) str_n;        // str_n = "100"
byte cast(n) byte_n;         // byte_n = binary value
```

**Supported Conversions:**

| From | To |
|------|-----|
| `int` | `float`, `string`, `byte`, `bit`, `bool` |
| `float` | `int`, `string`, `bool` |
| `string` | `list`, `byte`, `bool`, `int`*, `float`* |
| `bool` | `int`, `string` |
| `list` | `tuple`, `stack`, `array`, `vector`, `string`, `dict` |
| `tuple` | `list`, `stack`, `array`, `vector`, `string` |
| `stack` | `list`, `tuple`, `array`, `vector` |
| `array` | `list`, `tuple`, `stack`, `vector` |
| `vector` | `list`, `tuple`, `stack`, `array` |
| `dict` | `json`, `list` |
| `byte` | `int`, `string`, `bit`, `list` |
| `bit` | `byte`, `int`, `bool` |

*\* String to int/float requires valid numeric string*

**Invalid casts raise helpful errors:**
```cssl
cast("hello", int);  // Error: Cannot cast 'hello' to int: invalid value
cast(5, stack);      // Error: Invalid cast: cannot convert int to stack. Supported: float, string, byte, bit, bool
```

### Fix: `execute()` Multiple Statements

**Fixed:** `execute()` now correctly handles multiple statements and return values.

Previously, `execute()` only executed the first statement:
```cssl
execute("printl('hi'); printl('hi2')");  // Only printed "hi"
```

Now all statements execute correctly:
```cssl
execute("printl('hi'); printl('hi2')");  // Prints both "hi" and "hi2"
result = execute("x = 5; y = 10; return x + y");  // Returns 15
```

---

## v4.9.12 (2026-02-05)

### Extended CsslLang Python API - 20 New Professional Features

Major expansion of the CSSL Python bridge (`includecpp.CSSL`) with comprehensive developer tools for debugging, profiling, async execution, and code analysis.

#### 1. Developer Console (`async_console()`)
Live debugging GUI with tkinter-based multi-line CSSL editor.
```python
import asyncio
from includecpp import CSSL

CSSL.share(player, "player")
asyncio.run(CSSL.async_console())
```
- Multi-line code editor with syntax highlighting
- API Tree showing all `share()`'d objects
- Output panel with colored output (green/red/cyan)
- History navigation, Ctrl+Enter to execute
- Double-click API tree items to insert

#### 2. Async/Await Support
Native asyncio integration for asynchronous CSSL execution.
```python
result = await CSSL.async_run('return expensive_calc();', timeout=5.0)

# Or fire-and-forget:
future_id = CSSL.start_async('long_task();')
# ... do other work ...
result = CSSL.await_result(future_id)
```
- `async_run()` - Async execution with timeout
- `start_async()` / `await_result()` - Fire-and-forget pattern
- `is_async_done()` / `cancel_async()` - Status and cancellation

#### 3. Variable Watching (`watch()`)
Live variable monitoring with change callbacks.
```python
def on_change(old, new):
    print(f"Health changed: {old} -> {new}")

watch_id = CSSL.watch("$player.health", on_change, interval=0.1)
CSSL.unwatch(watch_id)
```

#### 4. Debug Stepping (`breakpoint_add()`, `step()`, `continue_debug()`)
Debugger API for step-by-step code execution.
```python
CSSL.breakpoint_add("script.cssl", 10)
state = CSSL.step()  # Execute one step
print(state['scope'])  # Current variables
CSSL.continue_debug()
```

#### 5. Performance Profiling (`profile()`)
Detailed execution timing and hotspot analysis.
```python
result = CSSL.profile('slow_function(); slow_function();')
print(result.time_per_function)  # {'slow_function': 150.5}
print(result.hotspots)  # Top 10 by time
```

#### 6. Code Validation (`validate()`)
Syntax checking without execution.
```python
result = CSSL.validate('printl("Hello"')  # Missing )
if not result.valid:
    for error in result.errors:
        print(f"Line {error['line']}: {error['message']}")
```

#### 7. Code Transpilation (`transpile()`)
Convert CSSL to Python, C++, or JavaScript.
```python
py_code = CSSL.transpile('int x = 5; printl(x * 2);', 'python')
cpp_code = CSSL.transpile(code, 'cpp')
js_code = CSSL.transpile(code, 'js')
```

#### 8. State Serialization (`serialize()`, `deserialize()`)
Save and restore complete runtime state.
```python
state = CSSL.serialize()  # Pickle all globals
CSSL.save_state("state.pkl")  # Save to file
CSSL.load_state("state.pkl")  # Restore
```

#### 9. Hot Reload (`hot_reload()`, `enable_hot_reload()`)
Live code updates without restart.
```python
CSSL.enable_hot_reload("./scripts", ['.cssl', '.cssl-pl'])
# Files are auto-reloaded when modified
```

#### 10. Event System (`on()`, `emit()`, `off()`)
Pub/sub events between Python and CSSL.
```python
def on_damage(amount, source):
    print(f"Took {amount} damage from {source}")

CSSL.on("player_damage", on_damage)
CSSL.emit("player_damage", 10, "enemy")
CSSL.once("level_up", lambda: print("Level up!"))  # One-time listener
```

#### 11. Pipeline Chaining (`pipe()`)
Functional composition of CSSL functions.
```python
CSSL.run('define double(x) { return x * 2; }')
CSSL.run('define addTen(x) { return x + 10; }')

pipeline = CSSL.pipe("double", "addTen", "double")
result = pipeline(5)  # (5 * 2 + 10) * 2 = 40
```

#### 12. Sandbox Execution (`sandbox()`)
Secure code execution with restrictions.
```python
result = CSSL.sandbox(code, {
    'no_io': True,       # Disable file I/O
    'no_network': True,  # Disable network
    'no_exec': True,     # Disable exec/system
    'max_time': 5.0      # Timeout in seconds
})
```

#### 13. Timeout Execution (`run_with_timeout()`)
Execute with automatic timeout.
```python
result = CSSL.run_with_timeout('infinite_loop();', timeout=2.0)
# Raises TimeoutError after 2 seconds
```

#### 14. Memory Statistics (`memory_stats()`)
Heap analysis and allocation tracking.
```python
stats = CSSL.memory_stats()
print(f"Objects: {stats.objects}")
print(f"Addresses: {stats.addresses}")
print(f"Shared: {stats.shared}")
for alloc in stats.top_allocations:
    print(f"  {alloc['type']}: {alloc['count']}")
```

#### 15. Symbol Export (`export_symbols()`)
Extract all defined symbols from code or runtime.
```python
symbols = CSSL.export_symbols('''
    int x = 5;
    define greet(name) { printl("Hello " + name); }
    class Person { string name; }
    enum Color { RED, GREEN, BLUE }
''')
# {'functions': ['greet'], 'classes': ['Person'], 'enums': ['Color'], 'variables': ['x']}
```

#### 16. Function Hooks (`hook()`, `unhook()`)
Intercept function calls with before/after callbacks.
```python
def log_before(args, kwargs):
    print(f"Calling with: {args}")

def log_after(result, args, kwargs):
    print(f"Returned: {result}")

hook_id = CSSL.hook("myFunction", before=log_before, after=log_after)
```

#### 17. Code Injection (`inject()`)
Inject code into existing functions.
```python
CSSL.run('define greet() { printl("Hello"); }')
CSSL.inject("greet", 'printl("Before!");', "before")
CSSL.run('greet();')  # Prints: Before! Hello
```

#### 18. Code Formatting (`format_code()`)
Automatic code formatting.
```python
formatted = CSSL.format_code(messy_code, {
    'indent': 4,
    'line_width': 100,
    'brace_style': 'k&r',
    'space_around_ops': True
})
```

#### 19. Benchmarking (`benchmark()`)
Performance testing over multiple iterations.
```python
result = CSSL.benchmark('x = 1 + 2 * 3;', iterations=10000)
print(f"Average: {result.avg_ms:.4f}ms")
print(f"Min: {result.min_ms:.4f}ms")
print(f"Max: {result.max_ms:.4f}ms")
print(f"Std Dev: {result.std_dev:.4f}ms")
```

#### 20. Context Manager (`context()`)
Temporary execution context with isolated scope.
```python
with CSSL.context(player=my_player, debug=True) as ctx:
    ctx.run("$player.health = 100")
    result = ctx.run("return $player.health")
```

### New Data Classes
- `ValidationResult` - Code validation results
- `ProfileResult` - Profiling results
- `BenchmarkResult` - Benchmark statistics
- `MemoryStats` - Memory analysis
- `CSSLPipeline` - Function pipeline
- `CSSLContext` - Execution context
- `CSSLDevConsole` - Developer console GUI
- `SecurityError` - Sandbox violation exception

### Parser Fixes
- Fixed cross-line `(` chaining that merged statements across lines
- Fixed `this->` inside `*[guard]` brackets
- Fixed `this->member = null` in class body not registering members

### Full Windows & Linux Support
All 20 new features work on both Windows and Linux platforms with proper threading, async, and GUI handling.

---

## v4.9.7 (2026-01-29)

### CSSL MessageBox Fixes (`cssl-gui.MessageBox`)

- **Blocking `show()` by default**: `msg.show()` now blocks until the user clicks a button. Use `msg.show(wait=false)` for non-blocking behavior
- **`fmt::` color support in buttons**: Button text with ANSI color codes (e.g., `fmt::green("Accept")`) now renders with the correct foreground color
- **Standalone window**: MessageBox now uses a standalone `tk.Tk()` window instead of hidden root + Toplevel, fixing the instant-disappear bug
- **Null-safe event loop**: Fixed `NoneType` error when button click destroys window during `update()` call
- **`tk.Button` for color support**: Switched from `ttk.Button` to `tk.Button` to enable `fg` color parameter

### CLI

- **REPL prompt**: Changed from `cpp>` to `cssl>` to match the language name

---

## v4.9.6 (2026-01-28)

### CSSL GUI Framework (`cssl-gui`)

Native GUI framework built into CSSL with tkinter backend.

#### Widgets
- **`CsslWidget`**: Main window container with title, size, background color
  ```cssl
  include("cssl-gui");

  widget = CsslWidget("My App", 800, 600, "#1a1a2e");
  widget.show();
  widget.mainloop();
  ```

- **`CsslLabel`**: Text/image display with positioning
  ```cssl
  label = CsslLabel(widget, "Hello World", CsslGui::BigTitle);
  label.setPosition(CsslGui::Center);
  label.setColor("#ffffff");
  ```

- **`CsslButton`**: Clickable buttons with event handling
  ```cssl
  btn = CsslButton(widget, "Click Me", CsslGui::SmallTitle);
  btn.onClick(<<== {
      printl("Button clicked!");
  });
  ```

- **`CsslPicture`**: Image display with scaling
  ```cssl
  pic = CsslPicture(widget, "image.png", 200, 200);
  pic.setPosition(CsslGui::TopLeft);
  ```

- **`CsslSound`**: Audio playback (pygame backend)
  ```cssl
  sound = CsslSound("music.mp3");
  sound.play();
  sound.setVolume(0.5);
  ```

- **`CsslToolbar`**: Horizontal button toolbar
  ```cssl
  toolbar = CsslToolbar(widget);
  toolbar.addButton("Save", <<== { save(); });
  toolbar.addButton("Load", <<== { load(); });
  ```

- **`CsslInputField`**: Text input with filters
  ```cssl
  input = CsslInputField(widget, "Enter name...", CsslGui::SmallTitle);
  input.setFilter(CsslInputField::Alphabets);
  input.onChange(<<== { validate(); });
  ```

#### Position Constants
- `CsslGui::BigTitle`, `CsslGui::MediumTitle`, `CsslGui::SmallTitle` - Font sizes
- `CsslGui::Center`, `CsslGui::TopLeft`, `CsslGui::TopRight`, `CsslGui::BottomLeft`, `CsslGui::BottomRight` - Positioning

#### Input Filters
- `CsslInputField::All`, `CsslInputField::Alphabets`, `CsslInputField::Numbers`, `CsslInputField::Alphanumeric`

### CSSL Keyboard Framework (`cssl-keyboard`)

Cross-platform keyboard handling with pynput backend.

#### Features
- **Global key listening**: Monitor keyboard events system-wide
  ```cssl
  include("cssl-keyboard");

  keyboard = CsslKeyboardController();
  keyboard.listen(<<== key {
      printl("Key pressed: " + key);
  });
  ```

- **Hotkey registration**: Register global hotkeys
  ```cssl
  keyboard.hotkey("ctrl+s", <<== {
      printl("Save triggered!");
  });
  ```

- **Key state checking**: Check if specific keys are pressed
  ```cssl
  if (keyboard.isPressed("shift")) {
      printl("Shift is held down");
  }

  state = keyboard.getState("ctrl");
  ```

- **Controller methods**: `start()`, `stop()`, `isListening()`, `clearHotkeys()`

### Event System

#### CodeInfusion Event Handler (`<<==`)
- GUI and keyboard events support CSSL's `<<==` operator for inline code blocks
- Events receive context variables automatically (e.g., `key` for keyboard events)

---

## v4.9.5 (2026-01-27)

### Variable Modifiers

#### `local`, `static`, `freezed` Keywords
- **`local`**: Forbids global reference access (`@var` returns null), allows snapshots (`%var`)
  ```cssl
  local int privateCounter = 0;
  @privateCounter;  // Returns null (cannot access via @)
  snapshot(privateCounter);
  %privateCounter;  // Works normally
  ```

- **`static`**: Allows global reference access (`@var`), forbids snapshots (`%var` returns null)
  ```cssl
  static int cachedValue = 42;
  @cachedValue;     // Works normally
  %cachedValue;     // Returns null (cannot snapshot)
  ```

- **`local static`**: Forbids both `@` and `%` access
  ```cssl
  local static int internalOnly = 100;
  @internalOnly;    // Returns null
  %internalOnly;    // Returns null
  ```

- **`freezed`**: Creates immutable variables (reassignment returns null)
  ```cssl
  freezed string constant = "immutable";
  constant = "new value";  // Returns null (no change made)
  ```

### Function Modifier Fixes

#### `undefined` and `super` Error Handling
- **Per-statement error handling**: `undefined` and `super` modifiers now catch errors on each statement and continue execution
  ```cssl
  undefined define SafeFunc() {
      d = ?nonexistent;  // Error swallowed, continues
      x = 2;             // Executes
      return x;          // Returns 2
  }
  ```

### Generator Enhancements

#### send() Support with Yield Expressions
- **`received = yield value`**: Capture sent values in generators
  ```cssl
  generator<int> define Counter() {
      int value = 0;
      while (true) {
          received = yield value;
          if (received != null) {
              value = received;
          } else {
              value = value + 1;
          }
      }
  }

  counter = Counter();
  printl(counter.next());   // 0
  printl(counter.next());   // 1
  counter.send(100);        // Resume with value 100
  printl(counter.next());   // 101
  ```

- **`take(n)`**: Safely get first n values from any generator (including infinite)
- **`skip(n)`**: Skip n values and continue iteration
- **`send(value)`**: Send a value into the generator, becomes result of yield expression

### Bug Fixes
- Fixed generator scope management for proper variable updates in while loops
- Fixed `yield_expr` detection for generator function identification

---

## v4.9.3 (2026-01-27)

### New Features - Full Async/Await System

#### Async Functions
- **`async` function modifier**: Define async functions that return Futures
  ```cssl
  async define fetchData(string url) {
      result = http.get(url);
      return result;
  }

  // Calling returns Future immediately
  future f = fetchData("http://example.com");
  data = await f;
  ```

#### Await Keyword
- **`await`**: Wait for async operations to complete
  ```cssl
  data = await asyncFunction();
  result = await future;
  ```

#### Generator Functions with Yield
- **`yield` statement**: Create lazy iterators
  ```cssl
  generator<int> define Range(int n) {
      int i = 0;
      while (i < n) {
          yield i;
          i = i + 1;
      }
  }

  gen = Range(5);
  while (gen.has_next()) {
      printl(gen.next());  // 0, 1, 2, 3, 4
  }
  ```

#### Async Module (`async::` / `Async::`)
- **`async.run(func, *args)`**: Run function asynchronously, returns Future
- **`async.stop(future)`**: Cancel async operation
- **`async.wait(future, timeout?)`**: Wait for Future with optional timeout
- **`async.all(futures, timeout?)`**: Wait for all Futures to complete
- **`async.race(futures, timeout?)`**: Return first completed Future's result
- **`async.sleep(ms)`**: Async sleep for milliseconds

#### New Types
- **`CSSLFuture`**: Represents result of async operation
  - States: `pending`, `running`, `completed`, `cancelled`, `failed`
  - Methods: `result()`, `is_done()`, `cancel()`, `then(callback)`
- **`CSSLGenerator`**: Lazy iteration via yield
  - Methods: `next()`, `has_next()`, `send(val)`, `to_list()`, `take(n)`, `skip(n)`
- **`CSSLAsyncFunction`**: Wrapper for async-defined functions

### Parser Enhancements
- Added `async`, `yield`, `generator`, `future` keywords
- Added `async` to function modifiers
- Added `generator` and `future` to generic type keywords

### Type Stubs
- Updated `cssl_builtins.pyi` with full async type documentation
- Added `CSSLFuture`, `CSSLGenerator`, `AsyncModule` stubs

### Documentation
- Added comprehensive Async/Await section to CSSL documentation
- Added generator function examples and patterns

---

## v4.9.2 (2026-01-26)

### New Features - Builtin Function Hooks & Introspection

#### Builtin Function Hooks (`&builtin ++`)
- **Hook into any builtin function** with append mode:
  ```cssl
  embedded define __hook_print(msg) &printl ++ {
      printl("LOG: " + _result);  // _result has original's return value
  }

  // Now all printl calls trigger the hook AFTER original runs
  printl("Hello");  // Prints: "Hello" then "LOG: null"
  ```

- **Append mode semantics**: Original runs first, then hook body executes
- **`_result` variable**: Automatically contains the original function's return value
- **`local::` references**: Access hook context variables
  ```cssl
  local::_result   // Original's return value
  local::0         // First positional argument
  local::_args     // All positional arguments
  local::_kwargs   // All keyword arguments
  ```

#### New Builtins
- **`destroy(target)`**: Destroy object and free memory
  ```cssl
  list data = [1, 2, 3];
  destroy(data);  // Clears the list
  ```

- **`execute(code, context?)`**: Execute CSSL code string inline
  ```cssl
  result = execute("return 5 + 3;");  // Returns 8
  execute("printl(name);", {"name": "World"});  // With context
  ```

#### Parser Enhancements
- **Position syntax for hooks**: `&name[-1]` (places hook at specific position)
- **`local::varname`** token type for accessing hooked function locals

### Bug Fixes
- Fixed infinite recursion when hook body calls the hooked builtin
- Fixed `skip` keyword argument error in builtin hooks
- Fixed hook execution order (original now runs before hook body in append mode)

### Syntax Highlighting
- Added `local::` reference highlighting
- Added `_result`, `_args`, `_kwargs` special variable highlighting
- Added `destroy` and `execute` builtin highlighting

---

## v4.9.0 (2026-01-25)

### New Features - CSSL Language Enhancements

#### Binary Data Types
- **`bit`**: Single binary value (0 or 1)
  ```cssl
  bit flag = 1;
  flag.switch();    // Toggle: 1 -> 0
  flag.set(1);      // Set to 1
  flag.clear();     // Set to 0
  bit copy = flag.copy();
  ```

- **`byte`**: 8-bit value with `x^y` notation
  ```cssl
  byte b = 1^200;           // base^weight notation
  printl(b.value());        // 200
  printl(b.to_str());       // "11001000" (binary)
  b.switch(7);              // Toggle bit 7
  b.set(0, 1);              // Set bit 0 to 1
  printl(b.info());         // Full info dict
  byte r = b.reverse();     // Reverse bit order
  ```

- **`address`**: Memory reference (pointer-like)
  ```cssl
  string text = "Hello";
  address addr = address(text);  // Get address
  obj = addr.reflect();          // Dereference
  obj = reflect(addr);           // Also works

  // Use in functions
  define useAddress() {
      string val = reflect(addr);  // Access from anywhere
  }
  ```

#### Pointer Syntax (`?`)
- **`?name = obj`**: Create pointer to object (simple C-like syntax)
- **`?name`**: Dereference pointer to get object
  ```cssl
  string text = "Hello";
  ?ptr = text;                   // Create pointer

  define usePointer() {
      string val = ?ptr;         // Dereference: "Hello"
      printl(val);
  }
  usePointer();
  ```

#### Memory Functions
- **`address(obj)`**: Shortcut for `memory(obj).get("address")`
- **`reflect(addr)`**: Dereference an address to get the original object
- **`memory()`**: Now registers objects for later reflection

#### Snapshot Assignment
- **`%var = value`**: Direct snapshot assignment syntax
  ```cssl
  string greeting = "Hello";
  %savedGreeting = greeting;
  greeting = "Changed";
  printl(%savedGreeting);  // "Hello"
  ```

### Bug Fixes
- Fixed bit/byte method calls returning null in CSSL runtime
- Fixed parser not recognizing bit/byte as type keywords
- Fixed typed declarations for bit/byte/address types

### Syntax Highlighting
- Added `bit`, `byte`, `address` type highlighting
- Updated `%variable` snapshot highlighting (% pink, variable blue-pink)

---

## v4.6.7 (2026-01-14)

### New Features
- **HomeServer**: Local storage server for modules, projects and files
  - `includecpp server install` - Install and auto-start HomeServer
  - `includecpp server start/stop` - Manual server control
  - `includecpp server status` - Check server status
  - `includecpp server upload/download` - File and project management
  - `includecpp server list` - List stored items
  - `includecpp server delete` - Remove items
  - `includecpp server port` - Change server port
  - `includecpp server deinstall` - Remove HomeServer completely
- Server runs in background (no terminal window)
- Auto-start support on Windows
- SQLite database for metadata storage
- Default port: 2007

---

## v4.6.6 (2026-01-14)

### New Features
- **ENUM support**: Expose C++ enums to Python via `ENUM(EnumName) CLASS { values... }` syntax
- **Multiple SOURCE support**: `SOURCE(file1) && SOURCE(file2)` in .cp files
- **FIELD_ARRAY support**: C-style arrays now properly bound as read-only `bytes` properties
- Automatic detection of array fields in plugin command

### Bug Fixes
- Fixed signed/unsigned comparison warning from pybind11 enum bindings
- Removed SIGNED_UNSIGNED from error catalog (was a warning, not error)
- Fixed array fields causing `invalid array assignment` error
- Version display now shows X.X format in build output

### Breaking Changes
- Array fields in structs are now read-only (accessible as `bytes`)

---

## v4.3.2 (2026-01-08)

### New Features
- `embedded` keyword now supports enums: `embedded NewName &OldEnum { ... }`
- Enum values can be any expression (strings, numbers, etc.)
- `bytearrayed` list pattern matching: `case { ["read", "write"] }` matches list return values
- `bytearrayed` function references with parameters: `&checkAccess(10);`
- `bytearrayed` simulation mode: analyzes return values without executing function body (no side effects)
- `bytearrayed` now correctly handles conditional return paths (if/else)

### Bug Fixes
- Fixed `global` variables in namespaced payloads not being accessible via `@`
- Fixed `@module.function()` calls on `include()` results (ServiceDefinition support)
- Fixed `bytearrayed` case body return statements (CSSLReturn exception handling)
- Fixed embedded open define syntax: both `open embedded define` and `embedded open define` now work
- Fixed `switch(variable)` with param conditions: auto-detects param_switch when case uses `&` or `not`
- Fixed `bytearrayed` pattern parsing for boolean values (`true`/`false`)
- Enhanced param_switch conditions: `a & b`, `a & not b`, `a || b`, `a & !b` all supported
- param_switch now checks both kwargs AND OpenFind variables (positional args work with `case text:`)

---

## v4.3.0 (2026-01-08)

### New Features
- Payload namespace support: `payload("mylib", "libname")` loads definitions into `libname::`
- Auto-extension for payloads: `payload("engine")` finds `engine.cssl-pl`
- Namespaced class instantiation: `new Engine::GameEngine()`

### Bug Fixes
- Fixed try/catch parsing (catch was interpreted as function call)
- Added finally block support for try/catch
- Division by zero now throws error instead of returning 0
- Modulo by zero now throws error
- List index out of bounds now throws error with helpful message
- Dict key not found now throws error
- try/catch now catches Python exceptions
- Fixed `embedded &$PyObject::method` replacement (this-> now works)

---

## v4.2.5 (2026-01-08)

### New Features
- Added `embedded` keyword for immediate function/class replacement
- Added `switch` for open parameters with pattern matching

### Bug Fixes
- Fixed `OpenFind<type, "name">` returning function reference instead of value

---

## v4.2.4 (2026-01-08)

### Bug Fixes
- Fixed `%name` priority for `&function` overrides

---

## v4.2.3 (2026-01-08)

### Bug Fixes
- Removed pagination from CLI documentation
- Fixed `&builtin` function override

---

## v4.2.2 (2026-01-08)

### Bug Fixes
- Fixed bidirectional `lang$Instance` mutations

---

## v4.2.1 (2026-01-08)

### CLI Improvements
- `--doc` and `--changelog` now load from local files
- Added `--changelog --N` and `--changelog --all` options

---

## v4.2.0 (2026-01-08)

### New Features
- Multi-language support with `libinclude()` and `supports` keyword
- Cross-language instance sharing with `lang$InstanceName` syntax
- Language transformers for Python, JavaScript, Java, C#, C++
- SDK packages for C++, Java, C#, JavaScript
- Default parameter values in CSSL functions

### CLI
- Added `includecpp cssl sdk <lang>` command
- Added `--doc "searchterm"` for documentation search

---

## v4.1.0 (2024-12-15)

### New Features
- CodeInfusion system with `<<==` and `+<<==` operators
- Class `overwrites` keyword
- `super()` and `super::method()` calls
- New containers: `combo<T>`, `iterator<T>`, `datastruct<T>`
- `python::pythonize()` for returning CSSL classes to Python

---

## v4.0.3 (2024-11-20)

### New Features
- Universal instances with `instance<"name">`
- Python API: `getInstance()`, `createInstance()`, `deleteInstance()`
- Method injection with `+<<==`

---

## v4.0.2 (2024-11-01)

### New Features
- Simplified API: `CSSL.run()`, `CSSL.module()`, `CSSL.script()`
- Shared objects with `cssl.share(obj, "name")` and `$name` syntax

---

## v4.0.0 (2024-10-15)

### Major Release
- Complete rewrite of CSSL parser and runtime
- Generic container types: `stack<T>`, `vector<T>`, `map<K,V>`
- Class system with constructors and inheritance
- BruteInjection operators: `<==`, `+<==`, `-<==`
- Global variables with `@name`, captured variables with `%name`

---

## v3.2.0 (2024-09-01)

### New Features
- CPPY code conversion (`includecpp cppy convert`)
- AI-assisted conversion with `--ai` flag
- Fast incremental builds with `--fast` flag

---

## v3.1.0 (2024-08-01)

### New Features
- `includecpp auto` and `includecpp fix` commands
- `DEPENDS()` for module dependencies
- `TEMPLATE_FUNC()` for template instantiation

---

## v3.0.0 (2024-07-01)

### Initial Release
- C++ to Python binding generation
- CSSL scripting language
- Plugin file format (.cp)
- CMake-based build system
- Cross-platform support (Windows, Linux, Mac)
