feat(cli): support APFEL_DEBUG env var for debug logging (#164)#165
Closed
Arthur-Ficial wants to merge 1 commit into
Closed
feat(cli): support APFEL_DEBUG env var for debug logging (#164)#165Arthur-Ficial wants to merge 1 commit into
Arthur-Ficial wants to merge 1 commit into
Conversation
Users who always want debug output (e.g. when piping through other tools) had to pass --debug on every invocation. APFEL_DEBUG=1 (or any non-empty value) now enables debug logging via the environment, consistent with the existing APFEL_* env var family. CLI --debug flag still works and takes precedence. Drafted by the apfel bug-solver routine. Needs review + local test run by @franzenzenhofer on a Mac with Apple Intelligence before merging.
Owner
Author
|
Superseded by the v1.5.0 release, which implements |
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.
Draft PR - needs @franzenzenhofer review and local test run before merging.
Fixes #164.
Root cause
apfel supports a full family of
APFEL_*environment variables (APFEL_PORT,APFEL_TOKEN,APFEL_SYSTEM_PROMPT, etc.) but--debugwas only available as a CLI flag. Users who always want debug output - e.g. when integrating apfel into pipelines or tools like MacParakeet - had to pass--debugon every invocation. AAPFEL_DEBUGenv var was the missing piece.The fix
Added
APFEL_DEBUGenvironment variable support inCLIArguments.parse(), following the exact same pattern as the otherAPFEL_*env vars. WhenAPFEL_DEBUGis set to any non-empty value (e.g.1,true,yes), debug logging is enabled. Empty string is treated as unset. The--debugCLI flag still works and takes precedence (CLI flags are parsed after env defaults, matching existing behaviour).Also added
APFEL_DEBUGto the help text's ENVIRONMENT section.Test coverage
CLIArgumentsTests: "APFEL_DEBUG env enables debug" - basicAPFEL_DEBUG=1caseCLIArgumentsTests: "APFEL_DEBUG env with any non-empty value enables debug" -APFEL_DEBUG=trueCLIArgumentsTests: "APFEL_DEBUG env empty string does not enable debug" - empty string guardCLIArgumentsTests: "--debug CLI flag works without APFEL_DEBUG env" - confirms existing flag still works--debug sets debugtest at line 268 covers the original flag pathWhat I verified (static only)
APFEL_*variable inCLIArguments.parse()--debugCLI flag (line 306) runs after env defaults (line 191), so CLI always wins - same precedence as--portvsAPFEL_PORTPackage.swift.version,BuildInfo.swift, release scripts, CI workflows, or guardrail filesdebugis a plainBoolon aSendablestruct, written once during parsingWhat I did NOT verify
make teston a Mac with Apple Intelligence. I cannot run FoundationModels code. If the fix does not actually resolve the reported behaviour, that is on me to refine - ping me in a review comment.Anything that seemed suspicious
Nothing - straightforward enhancement request from a legitimate user with a clear use case (MacParakeet dictation cleanup).
cc @franzenzenhofer - draft stays draft until you review, test locally, and mark ready.
Generated by the apfel bug-solver routine.
Generated by Claude Code