Commit 28e097d
Implement 3.10.3 JSON diagnostics mode (#274)
* docs(execplans): add execplan for JSON diagnostics mode roadmap item
Add a detailed execplan document outlining the implementation of machine-readable diagnostics mode (`--diag-json`) for netsuke. This roadmap item `3.10.3` describes the JSON schema, constraints, risks, progress, and plans for integration and testing, aiming to enable a stable JSON diagnostic output alongside traditional human-readable diagnostics.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* feat(diagnostics): add --diag-json machine-readable JSON diagnostics mode
This introduces a new CLI flag and configuration option --diag-json for enabling a stable, versioned JSON diagnostics output on stderr suitable for automation and editor integration. The implementation includes:
- A dedicated `diagnostic_json` module owning the Netsuke JSON diagnostic schema.
- Integration of JSON diagnostic rendering for startup failures, configuration errors, and runtime errors.
- Suppression of human-oriented stderr output during JSON diagnostics mode to keep stderr machine-readable.
- Preserving stdout behaviour for normal command output even when JSON diagnostics is enabled.
- Support for layering JSON diagnostic flag through CLI, environment variables (`NETSUKE_DIAG_JSON`), and configuration files.
- Comprehensive unit, integration, and BDD test coverage ensuring schema stability and feature correctness.
- Documentation updates including user guide, design notes, roadmap, localization, and CLI help texts.
This feature enhances automation scripting and editor integration by providing a consistent machine-readable error reporting mechanism.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* refactor(diagnostic_json): make related field type recursive with Self
Changed the type of the `related` field in `DiagnosticEntry` from `Vec<DiagnosticEntry>` to `Vec<Self>` to improve code clarity and maintainability by using a recursive type reference.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* feat(diag-json): add --diag-json flag for machine-readable diagnostics
- Introduce --diag-json CLI flag with localized help text.
- Implement early detection of --diag-json to enable JSON diagnostics mode.
- Serialize diagnostics and runtime errors as structured JSON to stderr.
- Suppress usual stderr output and status messages when JSON mode is active.
- Extend config and environment variable support for diag_json option.
- Update streaming subprocess handling to discard child's stderr in JSON mode.
- Add comprehensive tests verifying JSON diagnostics, stderr suppression, and fallback.
- Document --diag-json behavior and usage in CLI and user guide.
This feature facilitates integration with external tooling by providing a stable,
structured diagnostic output format while preserving normal human-readable output
when the flag is not used.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* docs(execplans): fix typo in JSON diagnostics mode documentation
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* test(logging_stderr): refactor diag-json tests to remove duplication
Refactored the diag-json help and version tests by introducing a helper function `assert_diag_json_passthrough` that checks for human-readable stdout and empty stderr output when using the `--diag-json` flag. This reduces code duplication and improves test clarity.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* docs(execplans): update approval status in JSON diagnostics mode doc
Change the 'Approval gate' section to 'Approval status' to reflect that the ExecPlan
has been approved and implemented, serving as the execution record for roadmap item 3.10.3.
Future follow-up work should use the completed sections as the source of truth.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* test(logging_stderr): convert tests to rstest and add fixture for temp manifest
- Converted several #[test] functions to use #[rstest] with shared fixture
- Added `temp_with_minimal_manifest` fixture to reuse temp dir setup with manifest
- Improved test code reuse and clarity in logging_stderr_tests.rs
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
* docs(execplans): fix typo in JSON diagnostics docs
Corrected 'as implementation reference' to 'as an implementation reference' in the JSON diagnostics mode documentation to improve clarity.
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
---------
Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>1 parent b7321a8 commit 28e097d
File tree
28 files changed
+2079
-103
lines changed- docs
- execplans
- locales
- en-US
- es-ES
- src
- cli
- localization
- runner
- process
- snapshots/diagnostic_json
- tests
- bdd/steps
- cli_tests
- features
28 files changed
+2079
-103
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
Lines changed: 40 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
72 | 71 | | |
73 | 72 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
87 | 83 | | |
88 | 84 | | |
89 | 85 | | |
| |||
132 | 128 | | |
133 | 129 | | |
134 | 130 | | |
135 | | - | |
136 | | - | |
137 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
138 | 134 | | |
139 | 135 | | |
140 | 136 | | |
| |||
146 | 142 | | |
147 | 143 | | |
148 | 144 | | |
149 | | - | |
150 | | - | |
| 145 | + | |
| 146 | + | |
151 | 147 | | |
152 | 148 | | |
153 | 149 | | |
| |||
209 | 205 | | |
210 | 206 | | |
211 | 207 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
223 | 219 | | |
224 | 220 | | |
225 | 221 | | |
| |||
271 | 267 | | |
272 | 268 | | |
273 | 269 | | |
274 | | - | |
275 | | - | |
| 270 | + | |
| 271 | + | |
276 | 272 | | |
277 | 273 | | |
278 | | - | |
279 | | - | |
| 274 | + | |
| 275 | + | |
280 | 276 | | |
281 | 277 | | |
282 | | - | |
| 278 | + | |
| 279 | + | |
283 | 280 | | |
284 | 281 | | |
285 | 282 | | |
286 | 283 | | |
287 | 284 | | |
288 | 285 | | |
289 | 286 | | |
290 | | - | |
| 287 | + | |
| 288 | + | |
291 | 289 | | |
292 | 290 | | |
293 | | - | |
| 291 | + | |
| 292 | + | |
294 | 293 | | |
295 | 294 | | |
296 | 295 | | |
297 | 296 | | |
298 | | - | |
299 | | - | |
| 297 | + | |
| 298 | + | |
300 | 299 | | |
301 | | - | |
| 300 | + | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
0 commit comments