Repository navigation
feat: make workspace path configurable via CLI flag - #98
Conversation
Add --workspace flag and DOCSCLAW_WORKSPACE env var to the serve command, allowing operators to override the workspace directory without editing the ConfigMap. Priority: agent-config.yaml > flag/env > default (/workspace). Unifies workspace resolution into a single resolveWorkspace function, replacing two ad-hoc inline resolution blocks. Closes #96 Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR makes the ChangesWorkspace override flow
Estimated code review effort: 2 (Simple) | ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
- Clarify DOCSCLAW_WORKSPACE comment in deployment manifest to note it is a fallback, not an override, when agent-config.yaml sets tools.workspace - Trim whitespace in resolveWorkspace to reject blank strings Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
docs/agent-config-guide.md (1)
102-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFix dangling sentence fragment.
Static analysis flags a missing subject: "Can also be set via
--workspaceflag..." reads as a fragment.✏️ Proposed fix
-| `workspace` | `string` | `/workspace` | Root directory for `read_file` and `write_file`. The agent cannot access files outside this path. Can also be set via `--workspace` flag or `DOCSCLAW_WORKSPACE` env var (config file takes precedence). | +| `workspace` | `string` | `/workspace` | Root directory for `read_file` and `write_file`. The agent cannot access files outside this path. It can also be set via the `--workspace` flag or `DOCSCLAW_WORKSPACE` env var (config file takes precedence). |🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/agent-config-guide.md` at line 102, The `workspace` description in the docs reads as a dangling fragment because the sentence starts with “Can also be set…”. Update the text in the table entry so it has an explicit subject, using the same `workspace` option description to make it a complete sentence while preserving the note about `--workspace`, `DOCSCLAW_WORKSPACE`, and config-file precedence.Source: Linters/SAST tools
internal/cmd/workspace_test.go (1)
170-190: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider adding a whitespace-trimming test case.
The commit message notes blank/whitespace-only workspace values are trimmed and rejected, but no test here exercises
resolveWorkspace(" ", "/from-flag")or similar to lock in that behavior.func TestResolveWorkspaceWhitespaceConfigIgnored(t *testing.T) { result := resolveWorkspace(" ", "/from-flag") if result != "/from-flag" { t.Fatalf("expected /from-flag, got %q", result) } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/cmd/workspace_test.go` around lines 170 - 190, Add a whitespace-trimming test for resolveWorkspace to lock in the blank-value behavior: create a test like TestResolveWorkspaceWhitespaceConfigIgnored alongside TestResolveWorkspaceConfigWins, TestResolveWorkspaceFlagFallback, and TestResolveWorkspaceDefault, and verify that a config value containing only spaces is treated as empty so the flag value is returned instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@docs/agent-config-guide.md`:
- Line 102: The `workspace` description in the docs reads as a dangling fragment
because the sentence starts with “Can also be set…”. Update the text in the
table entry so it has an explicit subject, using the same `workspace` option
description to make it a complete sentence while preserving the note about
`--workspace`, `DOCSCLAW_WORKSPACE`, and config-file precedence.
In `@internal/cmd/workspace_test.go`:
- Around line 170-190: Add a whitespace-trimming test for resolveWorkspace to
lock in the blank-value behavior: create a test like
TestResolveWorkspaceWhitespaceConfigIgnored alongside
TestResolveWorkspaceConfigWins, TestResolveWorkspaceFlagFallback, and
TestResolveWorkspaceDefault, and verify that a config value containing only
spaces is treated as empty so the flag value is returned instead.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: d49eaed1-ca6f-4f6c-82eb-f28b64f6be2e
📒 Files selected for processing (4)
deploy/standalone-agent.yamldocs/agent-config-guide.mdinternal/cmd/serve.gointernal/cmd/workspace_test.go
- Reword workspace table entry to a complete sentence - Add whitespace-trimming test for resolveWorkspace Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Summary
--workspaceflag andDOCSCLAW_WORKSPACEenv var to theservecommandagent-config.yamltools.workspace>--workspaceflag/env > default (/workspace)resolveWorkspacefunction, replacing two inline resolution blocksCloses #96
Test plan
/workspacewhen both are emptygolangci-lint run ./internal/cmd/...— zero issuesmake test— no regressionsNote:
make linthas pre-existing failures indemo/batch/andinternal/logger/— unrelated to this change.Assisted-By: Claude (Anthropic AI) [email protected]
Summary by CodeRabbit