-
Notifications
You must be signed in to change notification settings - Fork 10
fix(cli): support --log-level for start and restart cmds
#1623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a reusable Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant CLI as Start/Restart Command
participant Parser as parseLogLevel
participant PM2 as PM2
participant App as Unraid Process
User->>CLI: start|restart --log-level <level>
CLI->>Parser: parseLogLevel(<level>) %%{bgColor:"#E8F6EF"}%%
Parser-->>CLI: validated level
CLI->>PM2: start/restart(..., { extendEnv: true, env: { LOG_LEVEL: levelOrDefault } }) %%{bgColor:"#FFF4E6"}%%
PM2->>App: spawn process with LOG_LEVEL
PM2-->>CLI: result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes Assessment against linked issues
Out-of-scope changes(No out-of-scope functional changes detected related to the linked issue.) Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Claude finished @pujitm's task —— View job Code Review CompleteReviewing the diff/changeset for critical issues only:
Line restart.command.ts:18 - The new Line start.command.ts:53 & restart.command.ts:65 - Both commands now call Recommendation: Either handle the exception in the option parser or use Commander.js built-in choices validation instead of throwing exceptions during option parsing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
26-30: Preserve environment and use the correctlogLevelkeyThe current snippet clobbers the entire child‐process environment and reads from the wrong options property. Update as follows:
- File:
api/src/unraid-api/cli/restart.command.ts(around lines 26–30)- Replace
options['log-level']with the camelCaseoptions.logLevel- Ensure the spawned PM2 process inherits your full environment by enabling Execa’s
extendEnv(or by manually spreadingprocess.env)Suggested diff:
- { tag: 'PM2 Restart', raw: true, env: { LOG_LEVEL: options['log-level'] } }, + { + tag: 'PM2 Restart', + raw: true, + extendEnv: true, + env: { LOG_LEVEL: options.logLevel ?? 'info' } + },This guarantees that all existing environment variables are preserved and that you’re referencing the correct option name.
🧹 Nitpick comments (3)
api/src/unraid-api/cli/restart.command.ts (3)
22-22: Makeoptionsoptional to match nest-commander’srunsignatureThe second parameter is optional per the docs; marking it optional avoids potential runtime surprises if no options object is provided.
Apply this diff:
- async run(_: string[], options: RestartCommandOptions): Promise<void> { + async run(_: string[], options?: RestartCommandOptions): Promise<void> {
24-25: Optional: include the log level in the status messageHelps with operability and debugging.
Apply this diff:
- this.logger.info('Restarting the Unraid API...'); + this.logger.info(`Restarting the Unraid API (log level: ${options?.logLevel ?? 'info'})...`);
50-57: Bind the option name explicitly and enforce valid values via Commander choices
- Add
name: 'logLevel'so the parsed option is exposed asoptions.logLevel.- Use
choices: [...levels]to let Commander validate inputs and remove manual checks.Apply this diff in api/src/unraid-api/cli/restart.command.ts (around lines 50–57):
@Option({ - flags: `--log-level <${levels.join('|')}>`, + flags: '-l, --log-level <level>', description: 'log level to use', defaultValue: 'info', + name: 'logLevel', + choices: [...levels], }) - parseLogLevel(val: string): LogLevel { - return levels.includes(val as LogLevel) ? (val as LogLevel) : 'info'; - } + parseLogLevel(val: string): LogLevel { + // Commander guarantees val ∈ levels + return val as LogLevel; + }To verify locally, build and test the CLI:
#!/bin/bash set -e # 1) Build project npm run build # 2) Valid log-level should succeed node dist/main.js restart --log-level debug --help >/dev/null # 3) Invalid log-level should exit non-zero if node dist/main.js restart --log-level verbose; then echo "❌ Invalid value was accepted" exit 1 else echo "✅ Invalid value correctly rejected" fi(Or, without building, run via ts-node:
npx ts-node api/src/unraid-api/cli/restart.command.ts restart --log-level debug --help)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
api/src/unraid-api/cli/restart.command.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
TypeScript source files must use import specifiers with .js extensions for ESM compatibility
Files:
api/src/unraid-api/cli/restart.command.ts
api/src/unraid-api/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place new API source files in api/src/unraid-api/ rather than legacy locations
Prefer adding new files to the Nest repo at api/src/unraid-api/ instead of legacy code
Files:
api/src/unraid-api/cli/restart.command.ts
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid unnecessary or obvious comments; only add comments when needed for clarity
Files:
api/src/unraid-api/cli/restart.command.ts
🧬 Code graph analysis (1)
api/src/unraid-api/cli/restart.command.ts (1)
api/src/core/log.ts (2)
levels(6-6)LogLevel(8-8)
🔇 Additional comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
1-4: ESM import specifiers look correctInternal imports use .js extensions and type-only import is used for LogLevel. No action needed.
js abuse 🥲
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
9-11: Fix option key: uselogLevel?: LogLevelinstead of'log-level'?: string.Commander maps
--log-leveltologLevel. Reading'log-level'will be undefined at runtime and loses type safety.Apply this diff:
interface RestartCommandOptions { - 'log-level'?: string; + logLevel?: LogLevel; }
🧹 Nitpick comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
50-57: Option parsing is solid; add a short alias and tighten types (optional).
- Add
-lalias for ergonomics.- Current parser is fine; keeping both
defaultValue: 'info'and the fallback inparseLogLevelis defensive. No change required, but you could rely on just one source of default to reduce duplication.Apply this diff for the alias:
@Option({ - flags: `--log-level <${levels.join('|')}>`, + flags: `-l, --log-level <${levels.join('|')}>`, description: 'log level to use', defaultValue: 'info', }) parseLogLevel(val: string): LogLevel { return levels.includes(val as LogLevel) ? (val as LogLevel) : 'info'; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
api/src/unraid-api/cli/restart.command.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
TypeScript source files must use import specifiers with .js extensions for ESM compatibility
Files:
api/src/unraid-api/cli/restart.command.ts
api/src/unraid-api/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place new API source files in api/src/unraid-api/ rather than legacy locations
Prefer adding new files to the Nest repo at api/src/unraid-api/ instead of legacy code
Files:
api/src/unraid-api/cli/restart.command.ts
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid unnecessary or obvious comments; only add comments when needed for clarity
Files:
api/src/unraid-api/cli/restart.command.ts
🧬 Code graph analysis (1)
api/src/unraid-api/cli/restart.command.ts (1)
api/src/core/log.ts (2)
levels(6-6)LogLevel(8-8)
🔇 Additional comments (3)
api/src/unraid-api/cli/restart.command.ts (3)
1-1: ESM-compatible imports look good.Third-party import is fine, and the rest of the file uses .js extensions for internal modules per our ESM guideline.
3-4: Good use of type-only import and .js specifier.Importing
LogLevelas a type and using.json the alias path aligns with our ESM rules.
22-22: run signature matches nest-commander’s contract.Accepts
args?: string[]andoptions?: Record<string, unknown>; no issues spotted.
--log-level--log-level for start and restart cmds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
api/src/unraid-api/cli/start.command.ts (1)
46-50: Same issue: removedefaultValue: 'info'to allow env fallback.Otherwise Start will always force
info, ignoringLOG_LEVEL.@Option({ flags: `--log-level <${levels.join('|')}>`, - description: 'log level to use', - defaultValue: 'info', + description: 'log level to use', })
♻️ Duplicate comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
27-27: Great:extendEnv: trueprevents clobbering the inherited env.This addresses earlier feedback about preserving
PATHand other vars.
🧹 Nitpick comments (5)
api/src/unraid-api/cli/restart.command.ts (1)
25-25: Precedence is right, but casing may vary across sources.You’re mixing lowercase CLI values with uppercase
LOG_LEVEL. Downstream normalizes viatoUpperCase()(environment.ts), so behavior is correct. Optional: normalize here for clarity.Possible tweak:
-const env = { LOG_LEVEL: options.logLevel ?? LOG_LEVEL }; +const env = { LOG_LEVEL: (options.logLevel ?? LOG_LEVEL) as string };(or normalize explicitly to lower/upper consistently)
api/src/unraid-api/cli/start.command.ts (2)
4-4: Avoid type coupling between commands; moveLogLevelOptionsto a shared module.Even as a type-only import, referencing another command is fragile. Consider exporting
LogLevelOptionsfrom@app/core/log.js(or@app/unraid-api/cli/types.js) and import from there.Apply (example):
-import type { LogLevelOptions } from '@app/unraid-api/cli/restart.command.js'; +import type { LogLevelOptions } from '@app/core/log.js';
37-39: Use consistent log level for stdout messages.Restart uses
info; Start useslog. Prefer consistency.- if (stdout) { - this.logger.log(stdout.toString()); - } + if (stdout) { + this.logger.info(stdout.toString()); + }api/docs/public/cli.md (2)
27-31: Clarify precedence with env vs flag.Add a note that the flag overrides
LOG_LEVELwhen provided; otherwise the service usesLOG_LEVEL(or defaults per environment).Proposed patch:
-Alternative: You can also set the log level using the `LOG_LEVEL` environment variable: +Note: If `--log-level` is provided it takes precedence. Otherwise the service uses the `LOG_LEVEL` environment variable (falling back to its built-in default). + +You can set the log level using the `LOG_LEVEL` environment variable:
58-59: Mirror the precedence note in Restart section.Maintain consistency with Start docs.
-Alternative: You can also set the log level using the `LOG_LEVEL` environment variable: +Note: If `--log-level` is provided it takes precedence. Otherwise the service uses the `LOG_LEVEL` environment variable (falling back to its built-in default). + +You can set the log level using the `LOG_LEVEL` environment variable:
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
api/docs/public/cli.md(2 hunks)api/src/unraid-api/cli/restart.command.ts(3 hunks)api/src/unraid-api/cli/start.command.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
TypeScript source files must use import specifiers with .js extensions for ESM compatibility
Files:
api/src/unraid-api/cli/start.command.tsapi/src/unraid-api/cli/restart.command.ts
api/src/unraid-api/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place new API source files in api/src/unraid-api/ rather than legacy locations
Prefer adding new files to the Nest repo at api/src/unraid-api/ instead of legacy code
Files:
api/src/unraid-api/cli/start.command.tsapi/src/unraid-api/cli/restart.command.ts
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid unnecessary or obvious comments; only add comments when needed for clarity
Files:
api/src/unraid-api/cli/start.command.tsapi/src/unraid-api/cli/restart.command.ts
🧬 Code graph analysis (2)
api/src/unraid-api/cli/start.command.ts (2)
api/src/unraid-api/cli/restart.command.ts (1)
LogLevelOptions(9-11)api/src/environment.ts (1)
LOG_LEVEL(90-94)
api/src/unraid-api/cli/restart.command.ts (2)
api/src/environment.ts (1)
LOG_LEVEL(90-94)api/src/core/log.ts (2)
levels(6-6)LogLevel(8-8)
🔇 Additional comments (5)
api/src/unraid-api/cli/restart.command.ts (3)
3-5: ESM-ready imports look correct (.js extensions).Good use of type-only import and .js extensions for ESM compatibility.
22-22: Run signature + default options: LGTM.Accepting
options = {}is safe and keeps the command backward-compatible.
56-58: Parser is fine; tighten return type via the option interface change.Once
LogLevelOptions.logLevelis typed toLogLevel, you can drop casts at call sites.api/src/unraid-api/cli/start.command.ts (2)
27-33: Env precedence wiring is good; preserve inherited env.Using
options.logLevel ?? LOG_LEVELandextendEnv: truemirrors Restart and avoids env loss.
51-53: Parser OK; alignoptionstyping toLogLevel.After moving
LogLevelOptionsand typinglogLevel?: LogLevel, this stays correct.
|
@pujitm the outstanding coderabbit suggestions seem smart but this is a great change to get in :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
22-31: Only set LOG_LEVEL when the flag is provided; otherwise rely on inherited envToday we always pass a value for
LOG_LEVEL, which can unintentionally override an existing, correct setting. Buildenvconditionally sopm2 --update-envinherits the caller’sLOG_LEVELwhen the flag is omitted.- const env = { LOG_LEVEL: options.logLevel }; + const env = options.logLevel ? { LOG_LEVEL: options.logLevel } : undefined; const { stderr, stdout } = await this.pm2.run( - { tag: 'PM2 Restart', raw: true, extendEnv: true, env }, + { tag: 'PM2 Restart', raw: true, extendEnv: true, env }, 'restart', ECOSYSTEM_PATH, '--update-env' );
♻️ Duplicate comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
51-55: Remove defaultValue; it prevents true env fallback and may case-mismatchWith a default here,
options.logLevelis always defined, so we never fall back to the existing environment. Also,LOG_LEVELfrom environment is uppercase (e.g.,INFO) while CLI levels are lowercase; the mismatch can lead to silent coercion later.@Option({ flags: `--log-level <${levels.join('|')}>`, description: 'log level to use', - defaultValue: LOG_LEVEL, })
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
api/docs/public/cli.md(2 hunks)api/src/unraid-api/cli/restart.command.ts(3 hunks)api/src/unraid-api/cli/start.command.ts(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- api/docs/public/cli.md
- api/src/unraid-api/cli/start.command.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
TypeScript source files must use import specifiers with .js extensions for ESM compatibility
Files:
api/src/unraid-api/cli/restart.command.ts
api/src/unraid-api/**
📄 CodeRabbit inference engine (CLAUDE.md)
Place new API source files in api/src/unraid-api/ rather than legacy locations
Prefer adding new files to the Nest repo at api/src/unraid-api/ instead of legacy code
Files:
api/src/unraid-api/cli/restart.command.ts
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid unnecessary or obvious comments; only add comments when needed for clarity
Files:
api/src/unraid-api/cli/restart.command.ts
🧬 Code graph analysis (1)
api/src/unraid-api/cli/restart.command.ts (2)
api/src/core/log.ts (2)
LogLevel(8-8)levels(6-6)api/src/environment.ts (1)
LOG_LEVEL(90-94)
🔇 Additional comments (2)
api/src/unraid-api/cli/restart.command.ts (2)
1-5: ESM imports look correctUsing .js specifiers and colocated module paths matches our ESM guideline.
9-11: Good: option type is preciseTyping
logLevelasLogLevelprevents invalid strings at compile-time.
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
api/src/unraid-api/cli/restart.command.ts (1)
59-66: Remove the default to avoid overriding existing LOG_LEVEL; fail fast remains intact.With a default, the option is always defined and you always inject a value, which prevents true fallback to an already-configured PM2/env value. This reiterates a prior comment, but it still applies with
LOG_LEVEL.toLowerCase().@Option({ flags: `--log-level <${levels.join('|')}>`, description: 'log level to use', - defaultValue: LOG_LEVEL.toLowerCase(), }) parseLogLevel(val: string): LogLevel { return parseLogLevelOption(val); }If you apply this, also remove the now-unused
LOG_LEVELimport.
🧹 Nitpick comments (3)
api/src/unraid-api/cli/restart.command.ts (3)
3-5: ESM import specifiers look good; consider droppingLOG_LEVELimport if not used.If you remove the default from the option (see comment below),
LOG_LEVELimport becomes unnecessary here.
13-19: Trim the value before normalizing.Handles accidental whitespace in flags or env, e.g.,
--log-level " debug ".Apply:
-export function parseLogLevelOption(val: string, allowedLevels: string[] = [...levels]): LogLevel { - const normalized = val.toLowerCase() as LogLevel; +export function parseLogLevelOption(val: string, allowedLevels: string[] = [...levels]): LogLevel { + const normalized = val.trim().toLowerCase() as LogLevel; if (allowedLevels.includes(normalized)) { return normalized; } throw new Error(`Invalid --log-level "${val}". Allowed: ${allowedLevels.join(', ')}`); }
30-36: Optional: log the effective level for observability.Helps confirm which level PM2 received during troubleshooting.
- const { stderr, stdout } = await this.pm2.run( + if (level) this.logger.info(`Using log level: ${level}`); + const { stderr, stdout } = await this.pm2.run(
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
api/src/unraid-api/cli/restart.command.ts(3 hunks)api/src/unraid-api/cli/start.command.ts(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- api/src/unraid-api/cli/start.command.ts
🧰 Additional context used
📓 Path-based instructions (3)
api/src/unraid-api/**
📄 CodeRabbit inference engine (.cursor/rules/api-rules.mdc)
Prefer adding new files to the Nest repo at api/src/unraid-api/ instead of legacy code
Files:
api/src/unraid-api/cli/restart.command.ts
api/src/**
📄 CodeRabbit inference engine (CLAUDE.md)
Prefer adding new files to the NestJS code at api/src/unraid-api/ instead of legacy code
Files:
api/src/unraid-api/cli/restart.command.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
In TypeScript files, use .js extensions in import specifiers for ESM compatibility
Files:
api/src/unraid-api/cli/restart.command.ts
🧬 Code graph analysis (1)
api/src/unraid-api/cli/restart.command.ts (2)
api/src/core/log.ts (2)
LogLevel(8-8)levels(6-6)api/src/environment.ts (1)
LOG_LEVEL(90-94)
🔇 Additional comments (2)
api/src/unraid-api/cli/restart.command.ts (2)
9-11: Typed option shape is correct.
logLevel?: LogLevelaligns with Commander’s camelCase mapping and the allowed values.
30-36: No action:startmatchesrestart’s env/log-level handling.
| async run(_?: string[], options: LogLevelOptions = {}): Promise<void> { | ||
| try { | ||
| this.logger.info('Restarting the Unraid API...'); | ||
| const env = { LOG_LEVEL: options.logLevel }; | ||
| const { stderr, stdout } = await this.pm2.run( | ||
| { tag: 'PM2 Restart', raw: true }, | ||
| { tag: 'PM2 Restart', raw: true, extendEnv: true, env }, | ||
| 'restart', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Don’t clobber existing PM2 env when flag is omitted; only set LOG_LEVEL when present.
Currently we always pass LOG_LEVEL, which can override the process’s saved/env-configured level. Respect “fallback to existing LOG_LEVEL” by conditionally setting it.
async run(_?: string[], options: LogLevelOptions = {}): Promise<void> {
try {
this.logger.info('Restarting the Unraid API...');
- const env = { LOG_LEVEL: options.logLevel };
+ // Use explicit flag if provided; else use shell env if set; else don't override PM2 env.
+ const level =
+ options.logLevel ??
+ (process.env.LOG_LEVEL ? parseLogLevelOption(process.env.LOG_LEVEL) : undefined);
+ const env: NodeJS.ProcessEnv | undefined = level ? { LOG_LEVEL: level } : undefined;
const { stderr, stdout } = await this.pm2.run(
- { tag: 'PM2 Restart', raw: true, extendEnv: true, env },
+ { tag: 'PM2 Restart', raw: true, extendEnv: true, ...(env ? { env } : {}) },
'restart',
ECOSYSTEM_PATH,
'--update-env'
);Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In api/src/unraid-api/cli/restart.command.ts around lines 30 to 36, the code
always passes a LOG_LEVEL key to PM2 which can overwrite a saved/previous
LOG_LEVEL; change the env construction to add LOG_LEVEL only when
options.logLevel is non-null/undefined (e.g., conditionally set env.LOG_LEVEL or
build env via a spread when options.logLevel is present) and only include the
env parameter in the pm2.run call when that env object is non-empty so existing
PM2 process env values are preserved when the flag is omitted.
🤖 I have created a release *beep* *boop* --- ## [4.18.0](v4.17.0...v4.18.0) (2025-09-02) ### Features * **api:** enhance OIDC redirect URI handling in service and tests ([#1618](#1618)) ([4e945f5](4e945f5)) ### Bug Fixes * api key creation cli ([#1637](#1637)) ([c147a6b](c147a6b)) * **cli:** support `--log-level` for `start` and `restart` cmds ([#1623](#1623)) ([a1ee915](a1ee915)) * confusing server -> status query ([#1635](#1635)) ([9d42b36](9d42b36)) * use unraid css variables in sonner ([#1634](#1634)) ([26a95af](26a95af)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Resolve #1614
Summary by CodeRabbit
New Features
Documentation