feat(segkit): leveled logger with color + reports artifact (MVP-0.1)#86
Draft
abueide wants to merge 5 commits into
Draft
feat(segkit): leveled logger with color + reports artifact (MVP-0.1)#86abueide wants to merge 5 commits into
abueide wants to merge 5 commits into
Conversation
Establish the standard used going forward: one type per commit (feat/bug/docs/tests/gen), scope, and an epic reference in the title. Isolate generated/mechanical churn (formatting, lock files, codegen) into dedicated gen commits, and keep each commit under ~600 lines so reviewers can skim the noise and read the real work top-to-bottom. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the three-function ANSI logger with debug/info/warn/error
levels mirroring the shell side's "[LEVEL] [segkit] message" prefix so
combined CI logs read uniformly.
- debug is gated on SEGKIT_DEBUG=1 or DEBUG=1, matching the shell flags.
- logs are diagnostics, so they go to stderr (color-coded per level when
stderr is a terminal), leaving stdout clean for program data; color is
suppressed when piped/redirected or when NO_COLOR is set.
- every line is also appended, uncolored by construction, to
${REPORTS_DIR:-reports}/segkit.log for CI to upload as a historical
artifact (reuses the REPORTS_DIR root delegate.rs already writes to).
- info/warn/err keep their names as thin wrappers so callers don't churn.
- hand-rolled, zero new dependencies.
- wire the first debug caller into delegate::run so the new level is
exercised on the delegation hot path.
Inline unit tests cover the prefix format, the uncolored-file invariant,
tag-only coloring, distinct per-level colors, and SEGKIT_DEBUG/DEBUG
gating.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…VP-0.1) Add segkit/README.md covering the four log levels, the SEGKIT_DEBUG/DEBUG gate, terminal color behavior (NO_COLOR-aware), the uncolored reports/segkit.log historical artifact that CI uploads, and the stderr-for-diagnostics / stdout-for-data split (including subprocess stream pass-through). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mechanical `cargo fmt` reflow of files surfaced by the current pinned rustfmt (1.94) but untouched by this epic. Isolated here so the formatting churn is skimmable and segkit:fmt:check passes on this branch. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The current pinned clippy (1.94) flags pre-existing code this epic otherwise leaves alone; segkit:clippy runs with -D warnings, so CI is red until they're cleared. Fixes, no behavior change: - collapse nested if / if-let into let-chains (collapsible_if) in init_cmd, uninstall, and xcconfig. - replace XCConfig's inherent to_string with a Display impl (inherent_to_string); the single caller's .to_string() still works via the blanket ToString impl. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First slice of MVP-0 (fundamentals): a leveled Rust logger for segkit and the commit/PR conventions we follow going forward. Implements epic 0.1 from
notes/segkit-milestones/mvp/mvp-0-fundamentals.md.Changes
util/log.rs):debug/info/warn/errorlevels with the shell-matching[LEVEL] [segkit]prefix.debuggated onSEGKIT_DEBUG=1orDEBUG=1.info/warn/errkept as thin wrappers (no caller churn); hand-rolled, zero new deps; 8 inline unit tests.NO_COLOR-aware), leaving stdout for program data; every line is also appended uncolored to${REPORTS_DIR:-reports}/segkit.logas a CI-uploadable historical artifact.CONTRIBUTING.md): one type per commit (feat/bug/docs/tests/gen), scope + epic reference in the title, generated/mechanical churn isolated intogencommits, ≤600-line reviewable chunks.segkit/README.md): logging levels, color behavior, reports artifact, and the stderr/stdout split incl. subprocess stream pass-through.gen=cargo fmton pre-existing files;bug= clippy lints surfaced by the current pinned toolchain (-D warnings). These unblock CI, which was red on pre-existing debt independent of this change.Why
Logging and conventions are MVP-0 foundations every later epic builds on. The shell-consistent prefix keeps interleaved CI logs readable across Rust and shell, and the
reports/sink gives CI a uniform place to collect run history.segkit:check(fmt + clippy + 16 tests) is fully green.Review notes
docs(conventions) →feat(logger) →docs(README) →gen(fmt churn) →bug(clippy fixes).gen/bugcleanup commits are pre-existing debt fixed to get this PR's CI green (clippy/rustfmt bump since main's last segkit run); they can be split to a separate branch if you'd prefer 0.1 kept pristine.🤖 Generated with Claude Code