|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Debug Adapter Protocol (DAP) debugger for Lucee CFML. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is a step debugger that lets you set breakpoints, inspect variables, and step through CFML code in VS Code. |
| 8 | + |
| 9 | +Two modes: |
| 10 | + |
| 11 | +- **Extension mode** (Lucee 7.1+) - Native debugger hooks, no Java agent required |
| 12 | +- **Agent mode** (older Lucee) - Java agent with JDWP, bytecode instrumentation |
| 13 | + |
| 14 | +## Repository Structure |
| 15 | + |
| 16 | +``` |
| 17 | +extension-debugger/ |
| 18 | +├── source/java/ # Main Java source (extension + shared code) |
| 19 | +├── agent/ # Agent-specific build (shaded JAR) |
| 20 | +├── vscode-client/ # VS Code extension (TypeScript) |
| 21 | +├── test/ # CFML integration tests |
| 22 | +└── .github/workflows/ # CI - tests against Lucee 7.0 and 7.1 |
| 23 | +``` |
| 24 | + |
| 25 | +## Building |
| 26 | + |
| 27 | +```bash |
| 28 | +# Extension (.lex) |
| 29 | +mvn clean install -Dgoal=install |
| 30 | + |
| 31 | +# Agent (shaded JAR) |
| 32 | +cd agent && mvn clean package |
| 33 | +``` |
| 34 | + |
| 35 | +## Key Classes |
| 36 | + |
| 37 | +- `DapServer` - DAP protocol handler (lsp4j) |
| 38 | +- `ExtensionActivator` - Lucee startup hook (extension mode) |
| 39 | +- `Agent` - Java agent premain (agent mode) |
| 40 | +- `NativeLuceeVm` - 7.1+ native debugger integration |
| 41 | +- `LuceeVm` - Agent mode with JDWP/bytecode instrumentation |
| 42 | +- `DebugManager` - Breakpoint and stepping logic |
| 43 | + |
| 44 | +## Testing |
| 45 | + |
| 46 | +CFML integration tests run via GitHub Actions against: |
| 47 | + |
| 48 | +- Lucee 7.1 (extension mode) |
| 49 | +- Lucee 7.0, 6.2 (agent mode) |
| 50 | + |
| 51 | +The test architecture uses two separate Lucee instances: |
| 52 | + |
| 53 | +- **Debuggee**: Lucee Express (Tomcat) with luceedebug installed, DAP on port 10000, HTTP on 8888 |
| 54 | +- **Test runner**: `lucee/script-runner` instance running TestBox specs that connect to the debuggee via DAP |
| 55 | + |
| 56 | +Tests set breakpoints, trigger HTTP requests to the debuggee, and verify the debugger stops at the right places. |
| 57 | + |
| 58 | +### Debugging GitHub Actions Failures |
| 59 | + |
| 60 | +When a workflow fails, download logs locally for inspection: |
| 61 | + |
| 62 | +```bash |
| 63 | +# Create test-output folder (already in .gitignore) |
| 64 | +mkdir -p test-output |
| 65 | + |
| 66 | +# Download all logs from a failed run |
| 67 | +gh run view <RUN_ID> --repo lucee/extension-debugger --log > test-output/run-<RUN_ID>.log |
| 68 | + |
| 69 | +# Or download artifacts (contains debuggee logs on failure) |
| 70 | +gh run download <RUN_ID> --repo lucee/extension-debugger --dir test-output/ |
| 71 | + |
| 72 | +# Search logs locally |
| 73 | +grep -E "ERROR|Exception|Failed" test-output/run-<RUN_ID>.log |
| 74 | +``` |
| 75 | + |
| 76 | +Always use `test-output/` for workflow logs - it's gitignored so won't pollute the repo. |
| 77 | + |
| 78 | +## Code Style |
| 79 | + |
| 80 | +- Java 11+ |
| 81 | +- No Guava - use JDK or custom utils in `util/` package |
| 82 | +- Tabs for indentation |
| 83 | +- Fail fast - avoid defensive null checks |
0 commit comments