1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! DevFlow — Agent-agnostic development workflow automation.
//!
//! The core library returns structured types and performs workflow mechanics;
//! frontends such as the CLI format output for humans or machines.
//!
//! ## Logging
//!
//! DevFlow uses the [`tracing`] crate for structured, level-aware logging. All
//! log output goes to **stderr** so stdout remains available for agent output,
//! structured results, and machine-readable data.
//!
//! ### Log Levels
//!
//! Set the `RUST_LOG` environment variable to control verbosity:
//!
//! | Level | Use case |
//! |---------|----------|
//! | `error` | Fatal conditions that abort the workflow |
//! | `warn` | Unexpected but recoverable conditions (e.g., force operations) |
//! | `info` | Normal workflow events (state transitions, git operations) |
//! | `debug` | Detailed I/O and git commands |
//! | `trace` | Full tracing subscriber internals |
//!
//! ```bash
//! RUST_LOG=info devflow start --phase 3 --agent claude --mode auto # Default: shows state transitions
//! RUST_LOG=debug devflow start --phase 3 --agent claude --mode auto # Also shows git commands and file I/O
//! RUST_LOG=warn devflow status # Suppress info, show only warnings
//! ```
//!
//! The default log level is `info` when `RUST_LOG` is not set.
//!
//! ### JSON Output
//!
//! Set `DEVFLOW_LOG_FORMAT=json` for machine-readable JSON log lines on stderr:
//!
//! ```bash
//! DEVFLOW_LOG_FORMAT=json RUST_LOG=info devflow status 2>log.json
//! ```
//!
//! Each line is a JSON object with `timestamp`, `level`, `fields`, and
//! `target` keys. Structured events like `step_entered`/`step_exited` include
//! `phase` and step-name fields.
//!
//! ### Structured Events
//!
//! State machine transitions emit structured `tracing` events:
//!
//! - `step_exited` — emitted when leaving a step, with `phase` and step name
//! - `step_entered` — emitted when entering a step, with `phase` and step name
//!
//! These events are at `INFO` level and include the phase number as a named
//! field, making them filterable and parseable by external tooling.
// Re-exports for convenience.
pub use Mode;
pub use Stage;
pub use ;