Motivation
Currently, configuring persistent default behaviors for sem across different execution environments (such as CI pipelines, editor integration, or AI agent workflows) requires either passing long flags on every invocation or maintaining custom shell wrappers around specific subcommands.
For example, in agent-driven code reviews, running sem diff --verbose --format markdown provides an ideal balance—it keeps the entity-level classification alongside concrete inline diffs, which is significantly more useful for an agent than a summary-only output or a huge JSON payload. However, repeating these options across frequent invocations is inconvenient.
Possible Approach
To avoid cross-command collisions (since options like --format might accept different values depending on the subcommand), one intuitive design could be command-scoped environment variables.
For instance, mapping to sem diff:
| Environment variable |
Equivalent CLI option |
Example value |
SEM_DIFF_FORMAT |
--format |
md |
SEM_DIFF_VERBOSE |
--verbose |
1 |
SEM_DIFF_COLOR |
--color |
never |
SEM_DIFF_NO_COSMETICS |
--no-cosmetics |
1 |
SEM_DIFF_FILE_EXTS |
--file-exts |
.py,.rs |
Note: The pattern above (SEM_<COMMAND>_<OPTION>) is just one suggestion to handle scoping cleanly. I’d love to hear any other thoughts.
The other commands can be handled in the similar way.
Open Question: Handling Boolean Flags
For boolean switches like --verbose (which currently act as binary presence flags rather than key-value pairs), overriding a set environment variable through flag is logically impossible when an environment variable is set (e.g., SEM_DIFF_VERBOSE=1).
A few non-breaking approaches that come to mind, one of this is allowing explicit value assignments**: Accept --verbose=false or --verbose=0 to override an enabled environment default, while keeping bare --verbose acting as true, or just adding description in docs to suggest user to use inline env overrides SEM_DIFF_VERBOSE=0 sem diff.
English is not my first language — sorry if any phrasing sounds unnatural.
Motivation
Currently, configuring persistent default behaviors for
semacross different execution environments (such as CI pipelines, editor integration, or AI agent workflows) requires either passing long flags on every invocation or maintaining custom shell wrappers around specific subcommands.For example, in agent-driven code reviews, running
sem diff --verbose --format markdownprovides an ideal balance—it keeps the entity-level classification alongside concrete inline diffs, which is significantly more useful for an agent than a summary-only output or a huge JSON payload. However, repeating these options across frequent invocations is inconvenient.Possible Approach
To avoid cross-command collisions (since options like
--formatmight accept different values depending on the subcommand), one intuitive design could be command-scoped environment variables.For instance, mapping to
sem diff:SEM_DIFF_FORMAT--formatmdSEM_DIFF_VERBOSE--verbose1SEM_DIFF_COLOR--colorneverSEM_DIFF_NO_COSMETICS--no-cosmetics1SEM_DIFF_FILE_EXTS--file-exts.py,.rsNote: The pattern above (
SEM_<COMMAND>_<OPTION>) is just one suggestion to handle scoping cleanly. I’d love to hear any other thoughts.The other commands can be handled in the similar way.
Open Question: Handling Boolean Flags
For boolean switches like
--verbose(which currently act as binary presence flags rather than key-value pairs), overriding a set environment variable through flag is logically impossible when an environment variable is set (e.g.,SEM_DIFF_VERBOSE=1).A few non-breaking approaches that come to mind, one of this is allowing explicit value assignments**: Accept
--verbose=falseor--verbose=0to override an enabled environment default, while keeping bare--verboseacting astrue, or just adding description in docs to suggest user to use inline env overridesSEM_DIFF_VERBOSE=0 sem diff.English is not my first language — sorry if any phrasing sounds unnatural.