Enhance user configuration management and logging
- Introduced user configuration command to set API key. - Updated README and documentation for user config and logging paths. - Refactored logging to support user-specific log files. - Added tests for user configuration and logging behavior.
This commit is contained in:
14
docs/PRD.md
14
docs/PRD.md
@@ -53,7 +53,8 @@ The proxy defaults to Opus because this deployment is intended for users whose N
|
||||
|
||||
## User Stories
|
||||
|
||||
- As a developer, I can store my Nexus key in ignored local config or set `NEXUS_API_KEY`, then run `nexus-claude-api start --claude-code` to get a Claude Code launch command.
|
||||
- As a developer, I can store my Nexus key in user config with `nexus-claude-api config set --api-key <key>` or set `NEXUS_API_KEY`, then run `nexus-claude-api start --claude-code` to get a Claude Code launch command.
|
||||
- As a contributor working from the repository, I can pass `--dev` to use current-directory development config and logs.
|
||||
- As a Claude Code user, I can run coding workflows through local `http://127.0.0.1:4141`.
|
||||
- As a Claude Code user, I can receive streaming model output.
|
||||
- As a Claude Code user, I can use tool calls and tool results.
|
||||
@@ -63,7 +64,12 @@ The proxy defaults to Opus because this deployment is intended for users whose N
|
||||
## Acceptance Criteria
|
||||
|
||||
- `uv run nexus-claude-api start --port 4141 --claude-code` starts a local server.
|
||||
- `nexus-claude-api config set --api-key <key>` writes user config to `~/.config/nexus-claude-api/config.json`.
|
||||
- The server binds to `127.0.0.1` by default.
|
||||
- Default startup reads credentials from user config before environment variables.
|
||||
- `--dev` startup reads current-directory `nexus-claude-api.local.json` instead of user config.
|
||||
- Default logs are written to `~/.config/nexus-claude-api/logs/nexus-claude-api.log`.
|
||||
- `--dev` logs are written to current-directory `logs/nexus-claude-api.log`.
|
||||
- Missing Nexus credentials fail fast with a clear error.
|
||||
- `GET /health` returns healthy status.
|
||||
- `GET /v1/models` returns the supported Claude models.
|
||||
@@ -76,8 +82,10 @@ The proxy defaults to Opus because this deployment is intended for users whose N
|
||||
|
||||
## Security Requirements
|
||||
|
||||
- Do not persist API keys automatically.
|
||||
- If the user chooses hardcoded local configuration, keep it in ignored `nexus-claude-api.local.json`.
|
||||
- Do not persist API keys automatically during startup.
|
||||
- Persist API keys only when the user explicitly runs `nexus-claude-api config set --api-key <key>` or manually writes a config file.
|
||||
- Store normal user configuration in `~/.config/nexus-claude-api/config.json`.
|
||||
- Use ignored current-directory `nexus-claude-api.local.json` only for explicit `--dev` repository-local development mode.
|
||||
- Do not print or log API keys.
|
||||
- Redact authorization headers in debug logs.
|
||||
- Bind locally by default.
|
||||
|
||||
Reference in New Issue
Block a user