Skip to content

refactor: expose tools, prompts, resources, argo via pkg/#170

Merged
Joibel merged 1 commit intomainfrom
refactor/expose-tools-as-pkg
May 5, 2026
Merged

refactor: expose tools, prompts, resources, argo via pkg/#170
Joibel merged 1 commit intomainfrom
refactor/expose-tools-as-pkg

Conversation

@Joibel
Copy link
Copy Markdown
Collaborator

@Joibel Joibel commented May 5, 2026

Summary

  • Promotes internal/{argo,tools,prompts,resources} to pkg/ so other MCP servers can import them. The four packages keep their existing public shape (tools.RegisterAll(s, client), prompts.RegisterAll, resources.RegisterAll, argo.ClientInterface).
  • internal/{server,config,version} stay internal — they're binary-specific glue.
  • Embedded pkg/resources/docs/*.md continues to work via //go:embed, so downstream consumers ship the same Argo docs/examples.
  • Updated Makefile test target, .golangci.yml, .coderabbit.yaml, CLAUDE.md, docs/RESOURCES.md, and the two .claude/agents/*.md files to point at the new paths.

Notes

  • The API surface is intentionally not v1 yet — downstream consumers should expect breaking changes.
  • All file moves used git mv, so blame/history is preserved.

Test plan

  • make all passes (fmt, vet, lint 0 issues, tests across all packages, linux/amd64 build)
  • pkg/argo 51.6%, pkg/prompts 65.4%, pkg/resources 86.2%, pkg/tools 91.9%, internal/server 91.2% — all unchanged from before the move
  • E2E tests (make test-e2e) — not run locally; CI will exercise these

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Restructured project packages to expose Argo client and workflow tools as public APIs under the pkg/ directory, enabling external integration and reusability of core components.

Promotes the four packages downstream MCP servers need to consume to
pkg/, so they can be imported directly. server, config, and version
remain in internal/ as binary-specific glue.

API surface remains pre-v1 and volatile.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b57f3c97-e199-440b-b8f1-8e24cdb2f130

📥 Commits

Reviewing files that changed from the base of the PR and between cde64e5 and 7567f01.

⛔ Files ignored due to path filters (33)
  • .claude/agents/mcp-tool-implementer.md is excluded by !.claude/**, !**/*.md
  • .claude/agents/testing.md is excluded by !.claude/**, !**/*.md
  • CLAUDE.md is excluded by !**/*.md
  • docs/RESOURCES.md is excluded by !**/*.md
  • pkg/resources/docs/artifacts.md is excluded by !**/*.md
  • pkg/resources/docs/cluster_workflow_template_schema.md is excluded by !**/*.md
  • pkg/resources/docs/cron_workflow_schema.md is excluded by !**/*.md
  • pkg/resources/docs/examples_artifacts.md is excluded by !**/*.md
  • pkg/resources/docs/examples_conditionals.md is excluded by !**/*.md
  • pkg/resources/docs/examples_dag_diamond.md is excluded by !**/*.md
  • pkg/resources/docs/examples_exit_handlers.md is excluded by !**/*.md
  • pkg/resources/docs/examples_hello_world.md is excluded by !**/*.md
  • pkg/resources/docs/examples_loops.md is excluded by !**/*.md
  • pkg/resources/docs/examples_multi_step.md is excluded by !**/*.md
  • pkg/resources/docs/examples_parameters.md is excluded by !**/*.md
  • pkg/resources/docs/examples_resource_management.md is excluded by !**/*.md
  • pkg/resources/docs/examples_retries.md is excluded by !**/*.md
  • pkg/resources/docs/examples_timeout_limits.md is excluded by !**/*.md
  • pkg/resources/docs/examples_volumes.md is excluded by !**/*.md
  • pkg/resources/docs/expressions.md is excluded by !**/*.md
  • pkg/resources/docs/outputs.md is excluded by !**/*.md
  • pkg/resources/docs/parameters.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_container.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_dag.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_http.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_overview.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_resource.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_script.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_steps.md is excluded by !**/*.md
  • pkg/resources/docs/template_types_suspend.md is excluded by !**/*.md
  • pkg/resources/docs/variables.md is excluded by !**/*.md
  • pkg/resources/docs/workflow_schema.md is excluded by !**/*.md
  • pkg/resources/docs/workflow_template_schema.md is excluded by !**/*.md
📒 Files selected for processing (117)
  • .coderabbit.yaml
  • .golangci.yml
  • Makefile
  • cmd/mcp-for-argo-workflows/main.go
  • internal/config/config.go
  • internal/server/server.go
  • internal/server/server_test.go
  • pkg/argo/client.go
  • pkg/argo/client_test.go
  • pkg/argo/config.go
  • pkg/argo/config_test.go
  • pkg/argo/mocks/mock_archived_workflow_service.go
  • pkg/argo/mocks/mock_client.go
  • pkg/argo/mocks/mock_cluster_workflow_template_service.go
  • pkg/argo/mocks/mock_cron_workflow_service.go
  • pkg/argo/mocks/mock_streams.go
  • pkg/argo/mocks/mock_workflow_service.go
  • pkg/argo/mocks/mock_workflow_template_service.go
  • pkg/prompts/registry.go
  • pkg/prompts/why_did_this_fail.go
  • pkg/prompts/why_did_this_fail_test.go
  • pkg/resources/cluster.go
  • pkg/resources/cluster_test.go
  • pkg/resources/embed.go
  • pkg/resources/resource.go
  • pkg/resources/resource_test.go
  • pkg/tools/archived_workflow_ops.go
  • pkg/tools/archived_workflow_ops_test.go
  • pkg/tools/convert_workflow.go
  • pkg/tools/convert_workflow_test.go
  • pkg/tools/create_cluster_workflow_template.go
  • pkg/tools/create_cluster_workflow_template_test.go
  • pkg/tools/create_cron_workflow.go
  • pkg/tools/create_cron_workflow_test.go
  • pkg/tools/create_workflow_template.go
  • pkg/tools/create_workflow_template_test.go
  • pkg/tools/delete_cluster_workflow_template.go
  • pkg/tools/delete_cluster_workflow_template_test.go
  • pkg/tools/delete_cron_workflow.go
  • pkg/tools/delete_cron_workflow_test.go
  • pkg/tools/delete_workflow.go
  • pkg/tools/delete_workflow_template.go
  • pkg/tools/delete_workflow_template_test.go
  • pkg/tools/delete_workflow_test.go
  • pkg/tools/get_cluster_workflow_template.go
  • pkg/tools/get_cluster_workflow_template_test.go
  • pkg/tools/get_cron_workflow.go
  • pkg/tools/get_cron_workflow_test.go
  • pkg/tools/get_workflow.go
  • pkg/tools/get_workflow_handler_test.go
  • pkg/tools/get_workflow_node.go
  • pkg/tools/get_workflow_node_test.go
  • pkg/tools/get_workflow_template.go
  • pkg/tools/get_workflow_template_test.go
  • pkg/tools/get_workflow_test.go
  • pkg/tools/helpers.go
  • pkg/tools/lint_cluster_workflow_template.go
  • pkg/tools/lint_cluster_workflow_template_test.go
  • pkg/tools/lint_cron_workflow.go
  • pkg/tools/lint_cron_workflow_test.go
  • pkg/tools/lint_workflow.go
  • pkg/tools/lint_workflow_template.go
  • pkg/tools/lint_workflow_template_test.go
  • pkg/tools/lint_workflow_test.go
  • pkg/tools/list_cluster_workflow_templates.go
  • pkg/tools/list_cluster_workflow_templates_test.go
  • pkg/tools/list_cron_workflows.go
  • pkg/tools/list_cron_workflows_test.go
  • pkg/tools/list_workflow_templates.go
  • pkg/tools/list_workflow_templates_test.go
  • pkg/tools/list_workflows.go
  • pkg/tools/list_workflows_handler_test.go
  • pkg/tools/list_workflows_test.go
  • pkg/tools/logs_workflow.go
  • pkg/tools/logs_workflow_test.go
  • pkg/tools/registry.go
  • pkg/tools/render_manifest_graph.go
  • pkg/tools/render_manifest_graph_test.go
  • pkg/tools/render_workflow_graph.go
  • pkg/tools/render_workflow_graph_test.go
  • pkg/tools/resubmit_workflow.go
  • pkg/tools/resubmit_workflow_test.go
  • pkg/tools/resume_cron_workflow.go
  • pkg/tools/resume_cron_workflow_test.go
  • pkg/tools/resume_workflow.go
  • pkg/tools/resume_workflow_test.go
  • pkg/tools/retry_workflow.go
  • pkg/tools/retry_workflow_test.go
  • pkg/tools/stop_workflow.go
  • pkg/tools/stop_workflow_test.go
  • pkg/tools/submit_workflow.go
  • pkg/tools/submit_workflow_test.go
  • pkg/tools/suspend_cron_workflow.go
  • pkg/tools/suspend_cron_workflow_test.go
  • pkg/tools/suspend_workflow.go
  • pkg/tools/suspend_workflow_test.go
  • pkg/tools/svg_renderer.go
  • pkg/tools/svg_renderer_test.go
  • pkg/tools/terminate_workflow.go
  • pkg/tools/terminate_workflow_test.go
  • pkg/tools/testdata/simple_cluster_workflow_template.yaml
  • pkg/tools/testdata/simple_cron_workflow.yaml
  • pkg/tools/testdata/simple_workflow.yaml
  • pkg/tools/testdata/simple_workflow_template.yaml
  • pkg/tools/testdata/workflow_with_params.yaml
  • pkg/tools/testhelpers_test.go
  • pkg/tools/wait_workflow.go
  • pkg/tools/wait_workflow_test.go
  • pkg/tools/watch_workflow.go
  • pkg/tools/watch_workflow_test.go
  • test/e2e/archive_test.go
  • test/e2e/cluster_template_test.go
  • test/e2e/cron_test.go
  • test/e2e/setup.go
  • test/e2e/template_test.go
  • test/e2e/utility_test.go
  • test/e2e/workflow_test.go

Walkthrough

This PR promotes the argo, prompts, resources, and tools packages from internal visibility to public by relocating them from internal/ to pkg/ directories, updating all import statements, configuration files, and tests accordingly.

Changes

Package Promotion: Internal to Public

Layer / File(s) Summary
Configuration & Build
.coderabbit.yaml, .golangci.yml, Makefile
CodeRabbit review paths and golangci-lint exclusion rules updated to reference pkg/argo/** and pkg/tools/**. Test target expanded to cover both ./internal/... and ./pkg/....
Entry Point & Config Wiring
cmd/mcp-for-argo-workflows/main.go, internal/config/config.go
Import paths switched from internal/argo to pkg/argo, updating the Argo client dependency used by the main application and configuration builder.
Server Setup
internal/server/server.go, internal/server/server_test.go
All server imports for argo, prompts, resources, and tools redirected from internal/* to pkg/* packages; server logic unchanged.
Argo Client Public API
pkg/argo/mocks/mock_client.go
Mock client import updated to reference the new public pkg/argo package path.
Prompts Package
pkg/prompts/registry.go, pkg/prompts/why_did_this_fail.go
Imports switched to use pkg/argo instead of internal/argo for ClientInterface types.
Resources Package
pkg/resources/cluster.go, pkg/resources/cluster_test.go
Argo client imports updated to pkg/argo; test mocks import updated to pkg/argo/mocks.
Tools Package Handlers
pkg/tools/archived_workflow_ops.go, pkg/tools/create_*.go, pkg/tools/delete_*.go, pkg/tools/get_*.go, pkg/tools/helpers.go, pkg/tools/lint_*.go, pkg/tools/list_*.go, pkg/tools/logs_*.go, pkg/tools/registry.go, pkg/tools/render_*.go, pkg/tools/resubmit_*.go, pkg/tools/resume_*.go, pkg/tools/retry_*.go, pkg/tools/stop_*.go, pkg/tools/submit_*.go, pkg/tools/suspend_*.go, pkg/tools/terminate_*.go, pkg/tools/wait_*.go, pkg/tools/watch_*.go
~60 tool handler files updated to import argo.ClientInterface from pkg/argo instead of internal/argo, maintaining identical handler logic and function signatures.
Tools Package Tests
pkg/tools/*_test.go, pkg/tools/testhelpers_test.go
All tool test files updated to import mocks from pkg/argo/mocks instead of internal/argo/mocks.
E2E Tests
test/e2e/archive_test.go, test/e2e/cluster_template_test.go, test/e2e/cron_test.go, test/e2e/setup.go, test/e2e/template_test.go, test/e2e/utility_test.go, test/e2e/workflow_test.go
All e2e tests updated to import tools from pkg/tools and argo from pkg/argo instead of internal packages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes are mechanically simple (import path redirects) and highly repetitive across ~100+ files, making individual file review quick. However, the sheer volume and interconnected nature of the refactoring across multiple packages and tests requires systematic verification to ensure no import cycles, broken references, or inconsistencies were introduced. The presence of both production code and test files doubling the scope adds moderate complexity.

Possibly related issues

  • #12191: Related because both changes involve promoting packages from internal/ to public pkg/ locations to enable external consumption and mirror the same code-level visibility refactor pattern.

Possibly related PRs

  • pipekit/mcp-for-argo-workflows#61: Main PR refactors internal→pkg imports including e2e test files (cluster_template_test.go, setup.go) that overlap directly with PR #61's modifications to the same files.
  • pipekit/mcp-for-argo-workflows#92: Related because both update internal/server test suite and server package imports; main PR's internal→pkg migration affects the test files and wiring touched by PR #92.
  • pipekit/mcp-for-argo-workflows#20: Related because both involve the Argo ClientInterface abstraction and tool handler mocks—PR #20 initially adds the interface under internal/argo while main PR shifts all usages and mocks to the public pkg/argo location.

Poem

🐰 Hops through the codebase with glee,
Moving packages from internal to free,
Import paths dance in a thousand-fold way,
Public APIs shine for all to survey!
One great refactor, no chaos in sight,
The rabbit made visibility right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely summarizes the main change: refactoring to expose internal packages (tools, prompts, resources, argo) via pkg/ for external consumption.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/expose-tools-as-pkg

Comment @coderabbitai help to get the list of available commands and usage tips.

@Joibel Joibel merged commit a9180d7 into main May 5, 2026
6 checks passed
@Joibel Joibel deleted the refactor/expose-tools-as-pkg branch May 5, 2026 09:26
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