Nibiru Framework — LoRA Augmentation Corpus Summary
=====================================================

Source:    /home/stephan/PhpstormProjects/Nibiru/docs/scripts/extraction/framework-reference-v2.md
Output:    /home/stephan/PhpstormProjects/Nibiru/docs/scripts/extraction/lora-augmentation.jsonl
Format:    JSONL (one record per line)
Records:   323

Validation
----------
All 323 lines are valid JSON. All records carry the required keys:
instruction, input, output, metadata.{language, source, section, kind, citations}.
(Verified with `jq` schema check — 0 records failed.)

Breakdown by `kind`
-------------------
code-recall   121
workflow       97
inikey         29
comparison     26
gotcha         16
debug          16
edge-case      15
refactor        3

Coverage
--------
All 14 top-level sections of the v2 reference are exercised:
- §0  Executive Summary
- §1  Namespace Map
- §2  Singletons & Factories (Config, Pdo, Db, Form, Controller, View)
- §3  Database Layer (drivers, autogenerator pipeline, multi-database)
- §4  Module System (structure, registry, loading flow, plugin pattern, lifecycle)
- §5  Form System (architecture, substitution, type classes, ordering, div wrap, assembly, production usage)
- §6  Request/Response Lifecycle
- §7  INI Key Reference
- §8  Namespace Conventions
- §9  Constants
- §10 Production Patterns NOT in Core
- §11 Gotchas & Footguns
- §12 Request Handling Trace
- Appendices: File Index, Quick Reference

Cross-section workflow / debug / refactor records (~30) cover full-stack scenarios:
adding a new module, adding a new table, switching DB sections per model,
debugging Postgres-mode mask footgun, end-to-end form-to-DB save flow, etc.

Sample records (3 for sanity-check)
-----------------------------------

Sample 1 (kind=code-recall, line 14):
{"instruction":"Show me the exact `__construct()` body the autogenerator produces for a MySQL model.","input":"","output":"```php\npublic function __construct()\n{\n    Pdo::settingsSection('DATABASE');\n    self::initTable( self::TABLE );\n}\n```\nFrom `loach.mssql.database-connection/application/model/WarehouseLoach/timeanddate.php:30-34`. The first line writes the static `Pdo::$section`; the second registers the table schema with the adapter's static `$table` array.","metadata":{"language":"en","source":"framework-reference-v2","section":"2.2 Pdo","kind":"code-recall","citations":["loach.mssql.database-connection/application/model/WarehouseLoach/timeanddate.php:30-34","framework-reference-v2.md §2.2"]}}

Sample 2 (kind=inikey, line 100):
{"instruction":"Which INI key sets the PHP timezone?","input":"","output":"`[SETTINGS][timezone]`. Read by `Dispatcher::run()`. Defaults to `UTC`. From `framework-reference-v2.md §7 [SETTINGS]`.","metadata":{"language":"en","source":"framework-reference-v2","section":"7 INI [SETTINGS]","kind":"inikey","citations":["framework-reference-v2.md §7"]}}

Sample 3 (kind=workflow, line 220):
{"instruction":"How does the autogenerator handle a brand-new application with zero existing model files?","input":"","output":"`Model::createOutFolder()` at `core/c/model.php:28` does `mkdir -p` (chmod 0777) for the target folder, then `createClassFiles()` at line 37 loops through scanned tables (or one table if `--table=` was passed) and calls `generateClassByTableName($table)` for each. For each class file:\n1. If overwrite mode, `unlink` existing.\n2. Otherwise `fopen('w'); fclose()` to create an empty stub.\n3. Build template, do all 8 placeholder substitutions plus driver/odbc switching.\n4. Write file and chmod 0777.\n\nSo zero existing files becomes a full set of generated models on the first request. From `framework-reference-v2.md §3.2`.","metadata":{"language":"en","source":"framework-reference-v2","section":"3.2 Autogenerator Pipeline","kind":"workflow","citations":["core/c/model.php:28","core/c/model.php:37","core/c/model.php:53","framework-reference-v2.md §3.2"]}}

Notes for downstream merge
--------------------------
- Every record has a real file:line citation OR a quoted code block.
- Code blocks are quoted from the v2 reference; nothing is invented.
- Phrasing varies across natural developer styles ("Walk me through…",
  "Quick question:…", "Why does…", "I'm trying to…", "Show me…",
  "I'm getting `Class … not found`…", etc.).
- The `kind` taxonomy follows the spec: edge-case, comparison, workflow,
  debug, refactor, code-recall, inikey, gotcha.
