Skip to content

docs: converted cursor to opencode#988

Merged
TomerFi merged 2 commits intodevfrom
convert-cursor-to-opencode
May 4, 2026
Merged

docs: converted cursor to opencode#988
TomerFi merged 2 commits intodevfrom
convert-cursor-to-opencode

Conversation

@TomerFi
Copy link
Copy Markdown
Owner

@TomerFi TomerFi commented May 4, 2026

Summary by CodeRabbit

  • Documentation
    • Reorganized and streamlined development documentation and guidelines.
    • Consolidated skill documentation for endpoint creation and smoke testing.
    • Introduced centralized project guidelines to improve consistency and clarity.

Signed-off-by: Tomer Figenblat <tomer@figenblat.com>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 4, 2026

Reviewer's Guide

Replaces Cursor-specific configuration with OpenCode-style agent and skill docs, expands the add-endpoint skill with more detailed guidance, introduces a new smoke-test skill and high-level AGENTS documentation, and removes legacy .cursor agents, commands, and rules files.

Sequence diagram for the new smoke-tester skill workflow

sequenceDiagram
    actor Developer
    participant Skill_smoke_tester
    participant Podman
    participant Container_switcher_webapi
    participant Health_endpoint

    Developer->>Skill_smoke_tester: Invoke smoke-tester instructions
    Skill_smoke_tester->>Podman: podman build -t switcher_webapi:local .
    Skill_smoke_tester->>Podman: podman run -d --name smoke-test -p 8000:8000 switcher_webapi:local
    Podman->>Container_switcher_webapi: Start container switcher_webapi:local
    loop Health_poll_attempts_1_to_12
        Skill_smoke_tester->>Health_endpoint: HTTP GET /health
        Health_endpoint-->>Skill_smoke_tester: HTTP status_code
    end
    alt Health_status_200
        Skill_smoke_tester->>Podman: podman logs smoke-test
        Skill_smoke_tester->>Podman: podman stop smoke-test
        Skill_smoke_tester->>Podman: podman rm smoke-test
        Skill_smoke_tester-->>Developer: Report success
    else Health_status_not_200
        Skill_smoke_tester-->>Developer: Report failure and logs
        Skill_smoke_tester->>Podman: podman stop smoke-test
        Skill_smoke_tester->>Podman: podman rm smoke-test
    end
Loading

Flow diagram for using the updated add-endpoint skill

flowchart TD
    start[Start: Need_new_API_endpoint]

    step1[Define_endpoint_path_constant_in_app_webapp_py]
    step2[Create_async_handler_function_using_standard_pattern]
    step2a[Extract_query_params_device_type_ip_id_login_key]
    step2b[Open_SwitcherApi_async_context_manager]
    step2c[Call_appropriate_aioswitcher_method]
    step2d[Serialize_result_and_return_JSON]

    step3[Add_pytest_asyncio_tests_in_app_tests]
    step4[Update_MkDocs_endpoint_documentation_in_docs]
    step5[Run_ruff_and_pytest_with_coverage]
    end_node[Endpoint_added_and_verified]

    start --> step1 --> step2
    step2 --> step2a --> step2b --> step2c --> step2d --> step3
    step3 --> step4 --> step5 --> end_node
Loading

File-Level Changes

Change Details Files
Expand and refine the add-endpoint skill documentation for agents, including standard handler patterns and test/docs workflow.
  • Move the add-endpoint skill from .cursor/skills to .agents/skills to align with the new agents layout.
  • Clarify the skill description to cover constants, async handlers, tests, docs updates, and running tests.
  • Add explicit section describing the standard endpoint handler pattern and required query parameters.
  • Restructure the steps into clearer subsections for defining constants, creating handlers, adding tests, updating docs, and running lint/tests.
  • Update test and tooling guidance to use ruff for linting and pytest with coverage instead of the old /test command.
.cursor/skills/add-endpoint/SKILL.md
.agents/skills/add-endpoint/SKILL.md
Introduce centralized AGENTS documentation describing architecture, conventions, testing, containers, workflow, and review guidelines for automated agents.
  • Add AGENTS.md with an overview of switcher_webapi, including endpoint handler pattern and constraints.
  • Document Python conventions, testing strategy, container build expectations, git workflow, and code review focus areas.
  • Outline documentation responsibilities and when to update project docs, providing a reference for agents and contributors.
AGENTS.md
Add a smoke-tester skill for running E2E container smoke tests via podman.
  • Create .agents/skills/smoke-tester/SKILL.md describing how to build a local container image with podman.
  • Document steps to run the container, poll the /health endpoint with retries, and interpret results.
  • Describe cleanup steps (logs, stop, rm) and expected healthy response payload from /health.
.agents/skills/smoke-tester/SKILL.md
Remove Cursor-specific agents, commands, and rules in favor of the new OpenCode agents setup.
  • Delete .cursor agent definition files such as code-reviewer, docs-writer, smoke-tester, and test-writer.
  • Remove .cursor command definitions for dockerfile linting, image builds, linting, docs serving, and tests.
  • Drop .cursor rules files that documented architecture, CI/CD, tooling, git workflow, project overview, Python conventions, and testing, since this content is now represented in AGENTS.md and related docs.
.cursor/agents/code-reviewer.md
.cursor/agents/docs-writer.md
.cursor/agents/smoke-tester.md
.cursor/agents/test-writer.md
.cursor/commands/dockerfile-lint.md
.cursor/commands/image-build.md
.cursor/commands/lint.md
.cursor/commands/serve-docs.md
.cursor/commands/stop-docs.md
.cursor/commands/test.md
.cursor/rules/architecture.mdc
.cursor/rules/ci-cd.mdc
.cursor/rules/cursor-tooling.mdc
.cursor/rules/git-workflow.mdc
.cursor/rules/project-overview.mdc
.cursor/rules/python-conventions.mdc
.cursor/rules/testing.mdc

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@auto-me-bot auto-me-bot Bot added the status: needs review Pull request needs a review label May 4, 2026
@snyk-io
Copy link
Copy Markdown

snyk-io Bot commented May 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Test Results

69 tests   69 ✅  1s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit 41d2caa.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The handler pattern description is now duplicated between AGENTS.md and .agents/skills/add-endpoint/SKILL.md; consider extracting this into a single canonical source to avoid divergence over time.
  • The smoke-tester skill assumes podman and a fixed localhost:8000 mapping; if your environments vary, you might want to parameterize the container runtime and port to make this skill reusable across different setups.
  • AGENTS.md codifies several conventions (Ruff, type hints, coverage, Docker constraints); it may be worth cross-checking these against existing project configuration to ensure they stay aligned and don’t drift from actual tooling or policies.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The handler pattern description is now duplicated between `AGENTS.md` and `.agents/skills/add-endpoint/SKILL.md`; consider extracting this into a single canonical source to avoid divergence over time.
- The smoke-tester skill assumes `podman` and a fixed `localhost:8000` mapping; if your environments vary, you might want to parameterize the container runtime and port to make this skill reusable across different setups.
- AGENTS.md codifies several conventions (Ruff, type hints, coverage, Docker constraints); it may be worth cross-checking these against existing project configuration to ensure they stay aligned and don’t drift from actual tooling or policies.

## Individual Comments

### Comment 1
<location path="AGENTS.md" line_range="20" />
<code_context>
-
-- All handlers must be `async def` and return `web.Response`
-- Use `@routes.get` / `@routes.post` / `@routes.patch` / `@routes.delete` decorators
-- Endpoint path constants defined at module level in `app/webapp.py`
-- Error handling must return appropriate HTTP status codes (400, 404, 500)
</code_context>
<issue_to_address>
**suggestion (typo):** Add a verb to this bullet for grammatical completeness.

For example: "Endpoint path constants are defined at module level in `app/webapp.py`."

```suggestion
- Endpoint path constants are defined at module level in `app/webapp.py`
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread AGENTS.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.07%. Comparing base (dccf537) to head (41d2caa).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #988   +/-   ##
=======================================
  Coverage   96.07%   96.07%           
=======================================
  Files           1        1           
  Lines         331      331           
=======================================
  Hits          318      318           
  Misses         13       13           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@auto-me-bot auto-me-bot Bot added status: review started Pull review in progress and removed status: needs review Pull request needs a review labels May 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@TomerFi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 59 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9f7ec0fa-5d26-420b-80cf-fafa8ecf3e9d

📥 Commits

Reviewing files that changed from the base of the PR and between e77a4d0 and 41d2caa.

📒 Files selected for processing (2)
  • .agents/skills/smoke-tester/SKILL.md
  • AGENTS.md
📝 Walkthrough

Walkthrough

Cursor AI tooling configuration and documentation is consolidated from distributed .cursor/ configuration files into a unified AGENTS.md guide. .cursor/agents/, .cursor/commands/, and .cursor/rules/ directories are emptied. Two endpoint-creation skills are refined: add-endpoint is restructured with clearer step formatting, and a new smoke-tester skill is added to document container health-check validation.

Changes

Documentation and Tooling Consolidation

Layer / File(s) Summary
Central Guidelines Definition
AGENTS.md
New unified developer guide consolidating architecture patterns, Python conventions, testing rules, container build constraints, git workflow, code review standards, and documentation ownership—all previously distributed across .cursor/ files.
Cursor Configuration Removal
.cursor/agents/*, .cursor/commands/*, .cursor/rules/*
All agent prompts (code-reviewer, docs-writer, smoke-tester, test-writer), commands (dockerfile-lint, image-build, lint, serve-docs, stop-docs, test), and rule files (architecture, ci-cd, cursor-tooling, git-workflow, project-overview, python-conventions, testing) are deleted, having been consolidated into AGENTS.md.
Skill Documentation Updates
.agents/skills/add-endpoint/SKILL.md, .agents/skills/smoke-tester/SKILL.md
add-endpoint skill is reformatted into five numbered steps with clearer subsections (define endpoint constant, create async handler with standard pattern, add pytest-asyncio tests, update docs, run verification). New smoke-tester skill documents the procedure to build the switcher_webapi image, run it with health-check polling (/health endpoint), and report results.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • TomerFi/switcher_webapi#936: This PR consolidates and removes the .cursor agent/commands/rules files originally introduced in that PR, effectively refactoring that tooling configuration.
  • TomerFi/switcher_webapi#935: Both PRs modify endpoint handler documentation and standardized patterns for aiohttp endpoints.
  • TomerFi/switcher_webapi#955: This PR directly affects the same .cursor rule and agent files that were previously modified in PR #955.

Suggested reviewers

  • dmatik
  • YogevBokobza

Poem

🐰 From scattered .cursor files so small,
A unified guide now stands tall,
Endpoints and smoke tests arranged just right,
Documentation clarity—hopping with delight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: converted cursor to opencode' accurately describes the main change: migrating from Cursor-specific agent/command/rule configurations to a unified OpenCode-based documentation structure (AGENTS.md) and updating skill documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch convert-cursor-to-opencode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 43 minutes and 59 seconds.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.agents/skills/add-endpoint/SKILL.md (1)

60-76: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Incorrect test patching pattern.

Line 70 instructs patching app.webapp.SwitcherApi, but the actual test suite patches aioswitcher.api.SwitcherApi methods directly (e.g., @patch("aioswitcher.api.SwitcherApi.get_state")). Developers following this guide will write tests that fail to mock correctly.

Update the example to use the correct patching pattern:

Corrected test example
-with patch("app.webapp.SwitcherApi") as mock_api:
-    mock_api.return_value.__aenter__.return_value.your_method = AsyncMock(
-        return_value=expected_response
-    )
-    resp = await api_client.get(url)
-    assert resp.status == 200
+@patch("aioswitcher.api.SwitcherApi.your_method")
+async def test_successful_your_endpoint_get_request(
+    api_your_method,
+    api_client,
+):
+    api_your_method.return_value = expected_response
+    resp = await api_client.get("/switcher/your_endpoint?type=plug&id=ab1c2d&ip=1.2.3.4")
+    api_your_method.assert_called_once()
+    assert resp.status == 200
🤖 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 @.agents/skills/add-endpoint/SKILL.md around lines 60 - 76, The test example
patches the wrong symbol; update the patch target from app.webapp.SwitcherApi to
the actual library class aioswitcher.api.SwitcherApi and mock the specific async
method used by your endpoint (e.g., get_state or the relevant method name) via
AsyncMock on that method; in the test function
test_successful_your_endpoint_get_request replace
patch("app.webapp.SwitcherApi") with patch("aioswitcher.api.SwitcherApi") and
set mock_api.return_value.__aenter__.return_value.<your_method> =
AsyncMock(return_value=expected_response) so api_client.get(...) sees the mocked
async call.
🤖 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.

Inline comments:
In @.agents/skills/smoke-tester/SKILL.md:
- Around line 37-43: The polling loop currently never fails explicitly; add a
healthy flag (e.g., healthy=0) before the for-loop, set healthy=1 and break when
response equals "200" (replace the short-circuit [ "$response" = "200" ] &&
break with an if that sets healthy), and after the loop check if healthy is not
1: print a failure message, run podman logs smoke-test || true, podman stop
smoke-test || true, podman rm smoke-test || true, and exit 1; otherwise run the
existing podman logs/stop/rm cleanup on success. Ensure the same change is
applied to both occurrences referenced (the blocks around the /health polling at
both locations).

In `@AGENTS.md`:
- Around line 16-21: The AGENTS.md constraint about error handling is out of
sync with the code: either update the documentation to reflect that exceptions
from handlers (ValueError, JSON decode errors, etc.) are currently caught by
error_middleware and translated into 500 responses, or implement consistent
handler-level validation so malformed requests return 400 and missing resources
return 404; to fix, choose one approach and apply it across the codebase—if
updating docs, change the line in AGENTS.md to state that error_middleware
converts uncaught exceptions into 500 and mention delete_schedule is the only
handler returning 404; if implementing consistent handling, add explicit
validation in each request handler that parses request bodies (the functions
that currently raise ValueError) to return web.Response(status=400) for bad
input and ensure resource-not-found cases return web.Response(status=404), and
update or remove error_middleware handling as needed to avoid converting these
to 500.

---

Outside diff comments:
In @.agents/skills/add-endpoint/SKILL.md:
- Around line 60-76: The test example patches the wrong symbol; update the patch
target from app.webapp.SwitcherApi to the actual library class
aioswitcher.api.SwitcherApi and mock the specific async method used by your
endpoint (e.g., get_state or the relevant method name) via AsyncMock on that
method; in the test function test_successful_your_endpoint_get_request replace
patch("app.webapp.SwitcherApi") with patch("aioswitcher.api.SwitcherApi") and
set mock_api.return_value.__aenter__.return_value.<your_method> =
AsyncMock(return_value=expected_response) so api_client.get(...) sees the mocked
async call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 09e72f3e-2b13-46b3-98ae-bbbced235a5e

📥 Commits

Reviewing files that changed from the base of the PR and between dccf537 and e77a4d0.

📒 Files selected for processing (20)
  • .agents/skills/add-endpoint/SKILL.md
  • .agents/skills/smoke-tester/SKILL.md
  • .cursor/agents/code-reviewer.md
  • .cursor/agents/docs-writer.md
  • .cursor/agents/smoke-tester.md
  • .cursor/agents/test-writer.md
  • .cursor/commands/dockerfile-lint.md
  • .cursor/commands/image-build.md
  • .cursor/commands/lint.md
  • .cursor/commands/serve-docs.md
  • .cursor/commands/stop-docs.md
  • .cursor/commands/test.md
  • .cursor/rules/architecture.mdc
  • .cursor/rules/ci-cd.mdc
  • .cursor/rules/cursor-tooling.mdc
  • .cursor/rules/git-workflow.mdc
  • .cursor/rules/project-overview.mdc
  • .cursor/rules/python-conventions.mdc
  • .cursor/rules/testing.mdc
  • AGENTS.md
💤 Files with no reviewable changes (17)
  • .cursor/rules/project-overview.mdc
  • .cursor/commands/test.md
  • .cursor/rules/testing.mdc
  • .cursor/commands/serve-docs.md
  • .cursor/rules/architecture.mdc
  • .cursor/rules/git-workflow.mdc
  • .cursor/rules/ci-cd.mdc
  • .cursor/commands/stop-docs.md
  • .cursor/agents/test-writer.md
  • .cursor/rules/python-conventions.mdc
  • .cursor/rules/cursor-tooling.mdc
  • .cursor/commands/lint.md
  • .cursor/agents/smoke-tester.md
  • .cursor/commands/dockerfile-lint.md
  • .cursor/agents/docs-writer.md
  • .cursor/commands/image-build.md
  • .cursor/agents/code-reviewer.md

Comment thread .agents/skills/smoke-tester/SKILL.md
Comment thread AGENTS.md Outdated
Signed-off-by: Tomer Figenblat <tomer@figenblat.com>
@TomerFi
Copy link
Copy Markdown
Owner Author

TomerFi commented May 4, 2026

@CodeRabbit resoble all - fixed in 41d2caa

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Tip

For best results, initiate chat on the files or code changes.

@TomerFi Sure! I'll resolve all my review comments on this PR now.

[resolve]

@TomerFi TomerFi merged commit 3aff235 into dev May 4, 2026
12 checks passed
@TomerFi TomerFi deleted the convert-cursor-to-opencode branch May 4, 2026 18:52
@auto-me-bot auto-me-bot Bot added status: merged Pull request merged and removed status: review started Pull review in progress labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: merged Pull request merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant