Skip to content

refactor(cli): remove agent package import from send.go, attach.go, models.go#402

Open
proboscis wants to merge 1 commit intomainfrom
issue/orch-413/run-20260209-033248
Open

refactor(cli): remove agent package import from send.go, attach.go, models.go#402
proboscis wants to merge 1 commit intomainfrom
issue/orch-413/run-20260209-033248

Conversation

@proboscis
Copy link
Owner

Summary

Remove unnecessary coupling between CLI files and the agent package by:

  • Replacing agent.AgentOpenCode with "opencode" string literal in send.go and attach.go
  • Replacing agent.OpenCodeServerPortStart with local constant 4096 in models.go
  • Adding semgrep rule to prevent future agent package imports in these files

Changes Made

File Change
send.go Replaced run.Agent == string(agent.AgentOpenCode) with run.Agent == "opencode", removed agent import
attach.go Replaced resp.Agent == string(agent.AgentOpenCode) with resp.Agent == "opencode", removed agent import
models.go Replaced agent.OpenCodeServerPortStart with local constant 4096, removed agent import
.semgrep/architecture.yaml Added cli-no-agent-import-in-send-attach-models rule

Acceptance Criteria Verification

  • send.go: Replace agent.AgentOpenCode with string literal "opencode"
  • attach.go: Replace agent.AgentOpenCode with string literal "opencode"
  • models.go: Move port constant to local constant (value 4096)
  • Remove agent import from all three files
  • Add semgrep rule blocking send.go/attach.go/models.go from importing agent package
  • go build ./... passes
  • go test ./internal/... passes
  • make lint passes (semgrep 0 findings)

Evidence

Build passes

$ go build ./...
(no output - success)

Tests pass

$ go test ./internal/...
ok      github.com/s22625/orch/internal/agent     0.760s
ok      github.com/s22625/orch/internal/cli       4.883s
ok      github.com/s22625/orch/internal/config    3.896s
ok      github.com/s22625/orch/internal/daemon    3.159s
ok      github.com/s22625/orch/internal/git       9.321s
ok      github.com/s22625/orch/internal/github    0.687s
ok      github.com/s22625/orch/internal/model     1.729s
ok      github.com/s22625/orch/internal/monitor   2.353s
ok      github.com/s22625/orch/internal/multiplexer 1.338s
ok      github.com/s22625/orch/internal/notify    2.322s
ok      github.com/s22625/orch/internal/query     1.684s
ok      github.com/s22625/orch/internal/store/file 1.491s
ok      github.com/s22625/orch/internal/tmux      1.210s
ok      github.com/s22625/orch/internal/xdg       0.707s

Lint passes

$ make lint
semgrep --error --config .semgrep/ ./internal/cli/
✅ Scan completed successfully.
 • Findings: 0 (0 blocking)
 • Rules run: 8
 • Targets scanned: 29

Closes: orch-413

…odels.go

Replace agent.AgentOpenCode constant with "opencode" string literal and
agent.OpenCodeServerPortStart with local constant 4096 to reduce coupling
between CLI and agent packages.

Add semgrep rule to prevent future re-introduction of agent package imports
in these files.

Closes: orch-413
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant