From a3cbf43fdf8e05b91046f7cd966f6f67a6cd9c6a Mon Sep 17 00:00:00 2001 From: Many Kasiriha Date: Tue, 1 Dec 2026 01:38:21 +0100 Subject: [PATCH 1/3] feat: guide agents to install robotcode[all] and the robotcode plugin The session check wrote its robotcode advice only to stderr, which no agent shows to the model on exit 0. The hooks now write model-facing text in the shape each agent reads (Claude Code, Codex, OpenCode: hookSpecificOutput; Antigravity: injectSteps; Cursor: additional_context), checked live. - rf-core: robotcode readiness (runner/analyze/repl extras, Robocop), install advice per package manager (uv, Poetry, PDM, Hatch, venv pip), ask before installing; one-time hints for a missing robotcode or extra; the validation hook says once when it couldn't check a file (Copilot CLI: decision/reason). - rf-stack (new, Claude Code): dependency-only plugin that installs rf-core and robotcode@robotframework-agent-plugins together. rf-core and the technology plugins stay free of external dependencies, so a blocked upstream marketplace only disables rf-stack. README section for organisations that restrict marketplaces. - Antigravity CLI support: generated .antigravity-plugin manifests, root hooks.json and subagent variants; installer adapter `antigravity`. - Installer: robotcode companion in plugin mode (--no-robotcode, --robotcode-source), opt-in robotcode skill copy in file mode (stays offline by default), robotcode readiness in install and doctor. Generated files regenerated with scripts/build-catalog.py and scripts/build-agent-variants.py. OpenSpec change: robotcode-install-guidance. Co-Authored-By: Claude Opus 5.5 --- .claude-plugin/marketplace.json | 26 +- .github/ISSUE_TEMPLATE/plugin-feedback.yml | 1 + CHANGELOG.md | 20 ++ README.md | 94 ++++++- docs/catalog.md | 13 + docs/ci/live-agent-checks.md | 28 ++ installer/README.md | 21 +- .../src/robotframework_plugins/_assets.py | 17 ++ .../src/robotframework_plugins/_catalog.py | 7 +- .../robotframework_plugins/_robotcode_env.py | 157 +++++++++++ .../_robotcode_skill.py | 127 +++++++++ .../adapters/__init__.py | 2 + .../robotframework_plugins/adapters/_base.py | 65 +++++ .../adapters/antigravity.py | 104 +++++++ .../adapters/claude_code.py | 21 +- .../robotframework_plugins/adapters/codex.py | 8 +- .../adapters/copilot.py | 15 +- .../robotframework_plugins/adapters/cursor.py | 6 + installer/src/robotframework_plugins/cli.py | 97 ++++++- .../robotcode-install-guidance/.openspec.yaml | 2 + .../robotcode-install-guidance/design.md | 138 ++++++++++ .../robotcode-install-guidance/proposal.md | 47 ++++ .../specs/agent-plugin-marketplace/spec.md | 27 ++ .../specs/antigravity-support/spec.md | 47 ++++ .../specs/companion-plugin-dependency/spec.md | 71 +++++ .../specs/hook-output-channels/spec.md | 59 ++++ .../specs/installer-plugin-bootstrap/spec.md | 59 ++++ .../specs/plugin-catalogue/spec.md | 23 ++ .../specs/plugin-split/spec.md | 23 ++ .../specs/rf-session-context-hooks/spec.md | 42 +++ .../specs/rf-validation-hooks/spec.md | 45 +++ .../specs/robotcode-prerequisite/spec.md | 73 +++++ .../robotcode-install-guidance/tasks.md | 76 +++++ .../rf-api/.antigravity-plugin/plugin.json | 10 + .../rf-core/.antigravity-plugin/plugin.json | 10 + plugins/rf-core/hooks.json | 47 ++++ plugins/rf-core/hooks/README.md | 24 +- plugins/rf-core/scripts/_hook_input.mjs | 16 +- plugins/rf-core/scripts/_hook_output.mjs | 56 ++++ plugins/rf-core/scripts/_install_advice.mjs | 126 +++++++++ plugins/rf-core/scripts/_python_env.mjs | 75 ++++- .../rf-core/scripts/check_rf_environment.mjs | 80 ++++-- .../scripts/maybe_inject_rf_context.mjs | 36 ++- plugins/rf-core/scripts/rf_error_hints.mjs | 34 ++- plugins/rf-core/scripts/validate_robot.mjs | 72 +++-- plugins/rf-core/skills/rf-setup/SKILL.md | 13 +- .../skills/rf-setup/references/libraries.md | 2 +- .../antigravity-replace-file-content.json | 1 + .../hook_inputs/antigravity-run-command.json | 1 + .../hook_inputs/antigravity-write-file.json | 1 + .../tests/fixtures/install_advice.json | 22 ++ plugins/rf-core/tests/test_agent_variants.py | 38 ++- plugins/rf-core/tests/test_hook_input.py | 6 +- plugins/rf-core/tests/test_hook_output.py | 100 +++++++ plugins/rf-core/tests/test_hook_scripts.py | 98 ++++++- plugins/rf-core/tests/test_install_advice.py | 60 ++++ .../rf-core/tests/test_robotcode_readiness.py | 233 ++++++++++++++++ .../antigravity/agents/rf-debug-expert.md | 120 ++++++++ .../antigravity/agents/rf-migration-guide.md | 73 +++++ .../antigravity/agents/rf-test-architect.md | 99 +++++++ .../variants/opencode/plugins/rf-core.js | 2 +- .../.antigravity-plugin/plugin.json | 10 + .../rf-mobile/.antigravity-plugin/plugin.json | 10 + plugins/rf-stack/.claude-plugin/plugin.json | 20 ++ plugins/rf-stack/README.md | 24 ++ plugins/rf-stack/catalog.yaml | 16 ++ .../rf-web/.antigravity-plugin/plugin.json | 10 + schemas/catalog.schema.json | 4 + scripts/build-agent-variants.py | 56 ++++ scripts/build-catalog.py | 78 +++++- scripts/templates/opencode-plugin.js | 2 +- tests/installer/test_adapter_antigravity.py | 80 ++++++ tests/installer/test_no_network.py | 2 +- tests/installer/test_plugin_mode.py | 8 +- tests/installer/test_plugin_selection.py | 2 +- tests/installer/test_project_detection.py | 2 +- tests/installer/test_robotcode_companion.py | 259 ++++++++++++++++++ tests/installer/test_robotcode_env.py | 96 +++++++ tests/live/claude_dependency.sh | 94 +++++++ tests/test_catalog.py | 47 ++++ tests/test_hook_channels_doc.py | 29 ++ tests/test_robotcode_prerequisite.py | 63 ++++- 82 files changed, 3799 insertions(+), 129 deletions(-) create mode 100644 docs/ci/live-agent-checks.md create mode 100644 installer/src/robotframework_plugins/_robotcode_env.py create mode 100644 installer/src/robotframework_plugins/_robotcode_skill.py create mode 100644 installer/src/robotframework_plugins/adapters/antigravity.py create mode 100644 openspec/changes/robotcode-install-guidance/.openspec.yaml create mode 100644 openspec/changes/robotcode-install-guidance/design.md create mode 100644 openspec/changes/robotcode-install-guidance/proposal.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/agent-plugin-marketplace/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/antigravity-support/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/companion-plugin-dependency/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/hook-output-channels/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/installer-plugin-bootstrap/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/plugin-catalogue/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/plugin-split/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/rf-session-context-hooks/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/rf-validation-hooks/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/specs/robotcode-prerequisite/spec.md create mode 100644 openspec/changes/robotcode-install-guidance/tasks.md create mode 100644 plugins/rf-api/.antigravity-plugin/plugin.json create mode 100644 plugins/rf-core/.antigravity-plugin/plugin.json create mode 100644 plugins/rf-core/hooks.json create mode 100644 plugins/rf-core/scripts/_hook_output.mjs create mode 100644 plugins/rf-core/scripts/_install_advice.mjs create mode 100644 plugins/rf-core/tests/fixtures/hook_inputs/antigravity-replace-file-content.json create mode 100644 plugins/rf-core/tests/fixtures/hook_inputs/antigravity-run-command.json create mode 100644 plugins/rf-core/tests/fixtures/hook_inputs/antigravity-write-file.json create mode 100644 plugins/rf-core/tests/fixtures/install_advice.json create mode 100644 plugins/rf-core/tests/test_hook_output.py create mode 100644 plugins/rf-core/tests/test_install_advice.py create mode 100644 plugins/rf-core/tests/test_robotcode_readiness.py create mode 100644 plugins/rf-core/variants/antigravity/agents/rf-debug-expert.md create mode 100644 plugins/rf-core/variants/antigravity/agents/rf-migration-guide.md create mode 100644 plugins/rf-core/variants/antigravity/agents/rf-test-architect.md create mode 100644 plugins/rf-desktop/.antigravity-plugin/plugin.json create mode 100644 plugins/rf-mobile/.antigravity-plugin/plugin.json create mode 100644 plugins/rf-stack/.claude-plugin/plugin.json create mode 100644 plugins/rf-stack/README.md create mode 100644 plugins/rf-stack/catalog.yaml create mode 100644 plugins/rf-web/.antigravity-plugin/plugin.json create mode 100644 tests/installer/test_adapter_antigravity.py create mode 100644 tests/installer/test_robotcode_companion.py create mode 100644 tests/installer/test_robotcode_env.py create mode 100755 tests/live/claude_dependency.sh create mode 100644 tests/test_hook_channels_doc.py diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 3b9e947..0d21f93 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -101,6 +101,27 @@ "verified" ] }, + { + "name": "rf-stack", + "source": "./plugins/rf-stack", + "description": "Claude Code only. Installs rf-core together with the RobotCode project's robotcode plugin in one step; needs the robotframework-agent-plugins marketplace.", + "author": { + "name": "manykarim", + "email": "manykarim@users.noreply.github.com" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins", + "license": "Apache-2.0", + "keywords": [ + "robotframework", + "robotcode" + ], + "category": "testing", + "tags": [ + "robot-framework", + "community" + ] + }, { "name": "rf-web", "source": "./plugins/rf-web", @@ -129,5 +150,8 @@ "renames": { "rf-agentskills": null }, - "forceRemoveDeletedPlugins": true + "forceRemoveDeletedPlugins": true, + "allowCrossMarketplaceDependenciesOn": [ + "robotframework-agent-plugins" + ] } diff --git a/.github/ISSUE_TEMPLATE/plugin-feedback.yml b/.github/ISSUE_TEMPLATE/plugin-feedback.yml index 347d450..0e21f97 100644 --- a/.github/ISSUE_TEMPLATE/plugin-feedback.yml +++ b/.github/ISSUE_TEMPLATE/plugin-feedback.yml @@ -23,6 +23,7 @@ body: - rf-core - rf-desktop - rf-mobile + - rf-stack - rf-web # plugins:end validations: diff --git a/CHANGELOG.md b/CHANGELOG.md index d91cac2..4331016 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ Every plugin (`rf-core`, `rf-web`, `rf-api`, `rf-mobile`, `rf-desktop`) and the ## Unreleased +### rf-stack (new) + +- **New plugin `rf-stack` for Claude Code.** It has no content of its own and depends on `rf-core` and on the RobotCode project's `robotcode@robotframework-agent-plugins`, so one install brings both. Add the `robotframework-agent-plugins` marketplace first; Claude Code doesn't add it for you. The marketplace now allows that one cross-marketplace dependency (`allowCrossMarketplaceDependenciesOn`). `rf-core` and the technology plugins still depend on nothing outside this marketplace, so an organisation that blocks the upstream marketplace loses only `rf-stack`; the README's new section "Organisations that restrict marketplaces" lists the other routes (allowlist, internal mirror, plain skill folder). Tier `community`: there is nothing in it to evaluate. + +### rf-core + +- **The session check now reaches the model.** It wrote only to stderr, which no agent shows to the model on exit 0. When Robot Framework is installed and robotcode isn't ready, a short notice now goes to stdout in the shape the calling agent reads (Claude Code, Codex, OpenCode: `hookSpecificOutput`; Antigravity: `injectSteps`; Cursor: `additional_context`). The full report stays on stderr. All context hooks use the same helper. +- **robotcode readiness, not just presence.** The check reads the installed `runner`, `analyze` and `repl` extras and Robocop. A base `robotcode` without `[all]` was reported as "available; errors are checked on every edit"; it now gets the command that installs `robotcode[all]`. +- **Install advice follows the project's tool:** uv, Poetry, PDM, Hatch, or pip into the project venv (`uv pip` for a venv made by `uv venv`), and tells the agent to ask you before installing. +- **The validation hook says when it couldn't check a file.** Without robotcode, below 2.8, or without the `analyze` extra, it tells the agent once per session that the edit was applied but not checked, instead of passing silently. Copilot CLI gets this through `decision`/`reason`, the only hook output it passes to the model. +- **New error hints:** `robotcode: command not found` and `Error: No such command '…'` get a one-time hint with the install command. +- `rf-setup` lists the PDM, Hatch and `uv venv` commands and the ask-first rule. +- **Antigravity CLI support.** Every plugin carries an `.antigravity-plugin/plugin.json`, and rf-core an Antigravity-format `hooks.json` at its root (generated; Claude Code, Copilot CLI and Codex keep reading `hooks/hooks.json`). Antigravity gets the environment notice at session start and the skill routing before each prompt; it passes no `PostToolUse` output to the model. Its hook input (`toolCall`, `conversationId`) is read too. + +### Installer + +- **Antigravity CLI** (`--agent antigravity`): writes each plugin as a folder Antigravity loads, `.agents/plugins//` or `~/.gemini/config/plugins//`, with the subagents in its format (`tools` as a list). No `agy` needed on PATH. +- **The robotcode companion.** Plugin mode registers the `robotframework-agent-plugins` marketplace and enables `robotcode@robotframework-agent-plugins` (Claude Code: also `rf-stack`; Codex: two more `codex plugin` commands; Cursor: the steps). `--no-robotcode` leaves it out; `--robotcode-source ` takes it from a mirror. File mode copies the robotcode skill only with `--robotcode-source`, so a plain install stays offline. +- `install` and `doctor` report whether `robotcode[all]>=2.8` is ready in the project environment, with the command for the project's package manager. The installer never installs robotcode. + ## 5.1.0 — 2026-11-23 ### rf-core diff --git a/README.md b/README.md index 50430f3..c1265f5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Robot Framework plugins -Skills, subagents and hooks that help coding agents write, run and fix Robot Framework tests. They work with eight agents: Claude Code, GitHub Copilot CLI, GitHub Copilot in VS Code, OpenAI Codex, Cursor, OpenCode, Project Goose and Claude Desktop. +Skills, subagents and hooks that help coding agents write, run and fix Robot Framework tests. They work with nine agents: Claude Code, GitHub Copilot CLI, GitHub Copilot in VS Code, OpenAI Codex, Cursor, OpenCode, Project Goose, Claude Desktop and Google Antigravity CLI. Install `rf-core` for the Robot Framework language, environment setup and Python keyword libraries, then add the plugin for each library you test with: web, API, mobile or desktop. The plugins sit next to the RobotCode project's own [`robotcode` plugin](https://github.com/robotcodedev/robotframework-agent-plugins), which teaches agents the robotcode CLI. @@ -26,7 +26,9 @@ Install `rf-core` for the Robot Framework language, environment setup and Python **Claude Code** ```bash claude plugin marketplace add MarketSquare/robotframework-plugins#stable - claude plugin install rf-web@robotframework-plugins # brings rf-core + claude plugin marketplace add robotcodedev/robotframework-agent-plugins + claude plugin install rf-stack@robotframework-plugins # brings rf-core and the robotcode plugin + claude plugin install rf-web@robotframework-plugins ``` **GitHub Copilot CLI** @@ -34,6 +36,8 @@ Install `rf-core` for the Robot Framework language, environment setup and Python copilot plugin marketplace add MarketSquare/robotframework-plugins#stable copilot plugin install rf-core@robotframework-plugins copilot plugin install rf-web@robotframework-plugins + copilot plugin marketplace add robotcodedev/robotframework-agent-plugins + copilot plugin install robotcode@robotframework-agent-plugins ``` **OpenAI Codex** @@ -41,6 +45,8 @@ Install `rf-core` for the Robot Framework language, environment setup and Python codex plugin marketplace add MarketSquare/robotframework-plugins --ref stable codex plugin add rf-core@robotframework-plugins codex plugin add rf-web@robotframework-plugins + codex plugin marketplace add robotcodedev/robotframework-agent-plugins + codex plugin add robotcode@robotframework-agent-plugins ``` **VS Code (GitHub Copilot)**: in your user settings, set `"chat.plugins.enabled": true`, `"chat.useHooks": true` and `"chat.plugins.marketplaces": ["MarketSquare/robotframework-plugins#stable"]`. Then install `rf-core` and `rf-web` in the Extensions view. VS Code doesn't install `rf-core` for you. @@ -63,6 +69,7 @@ Install `rf-core` for the Robot Framework language, environment setup and Python | `rf-api` | verified | active | RequestsLibrary and RESTinstance skills for API tests. | RequestsLibrary, RESTinstance | [@manykarim](https://github.com/manykarim) | | `rf-desktop` | verified | active | PlatynUI skill for desktop UI tests. | PlatynUI | [@manykarim](https://github.com/manykarim) | | `rf-mobile` | verified | active | AppiumLibrary skill for Android and iOS tests. | AppiumLibrary | [@manykarim](https://github.com/manykarim) | +| `rf-stack` | community | active | Claude Code only. Installs rf-core together with the RobotCode project's robotcode plugin in one step; needs the robotframework-agent-plugins marketplace. | Robot Framework | [@manykarim](https://github.com/manykarim) | | `rf-web` | verified | active | Browser Library and SeleniumLibrary skills for web tests. | Browser, SeleniumLibrary | [@manykarim](https://github.com/manykarim) | Tiers and what they mean: [GOVERNANCE.md](GOVERNANCE.md). Full details per plugin: [docs/catalog.md](docs/catalog.md). @@ -75,7 +82,7 @@ Release **5.1.0**: the installer and every plugin below carry this version (`v5. There are two ways to install, and both work at **user scope** (every project on your machine) or **project scope** (one repository, shared with your team): - **Plugin marketplace**: Claude Code, GitHub Copilot CLI, VS Code (Copilot), OpenAI Codex and Cursor all read this repository's `.claude-plugin/marketplace.json`. Add the marketplace `MarketSquare/robotframework-plugins` and install `rf-core` plus the technology plugins you need. Updates arrive through the agent. -- **Python installer** (`robotframework-plugins`): copies the files into each agent's own folders. Use it for OpenCode, Goose and Claude Desktop, which have no plugin marketplace, or wherever you prefer plain files. It can also write the marketplace settings for you (`--mode plugin`). +- **Python installer** (`robotframework-plugins`): copies the files into each agent's own folders. Use it for OpenCode, Goose, Claude Desktop and Antigravity CLI, which have no plugin marketplace we can use, or wherever you prefer plain files. It can also write the marketplace settings for you (`--mode plugin`). ### Which plugins @@ -110,27 +117,35 @@ The plugin does not set a default main agent. The three subagents are available "extraKnownMarketplaces": { "robotframework-plugins": { "source": { "source": "github", "repo": "MarketSquare/robotframework-plugins" } + }, + "robotframework-agent-plugins": { + "source": { "source": "github", "repo": "robotcodedev/robotframework-agent-plugins" } } }, "enabledPlugins": { + "rf-stack@robotframework-plugins": true, "rf-core@robotframework-plugins": true, - "rf-web@robotframework-plugins": true + "rf-web@robotframework-plugins": true, + "robotcode@robotframework-agent-plugins": true } } ``` +`rf-stack` is for Claude Code: it has no content of its own and makes Claude Code install `rf-core` and the `robotcode` plugin together. The other agents ignore dependencies, so the file also enables `rf-core` and `robotcode` directly. If your organisation blocks the `robotframework-agent-plugins` marketplace, leave out its two entries and `rf-stack`; see [Organisations that restrict marketplaces](#organisations-that-restrict-marketplaces). + Add `"ref"` to the source to pin the marketplace to a release, for example `"ref": "v5.1.0"`, or use `stable` for the latest release. Every plugin and the installer share one version, so a release tag pins all of them together. Older tags still install what they name, but receive no updates: `v1.1.0` to `v3.0.0` are `rf-agentskills` releases, and `--v1.0.0` the first separate plugins. #### Claude Code ```bash claude plugin marketplace add MarketSquare/robotframework-plugins -claude plugin install rf-web@robotframework-plugins # brings rf-core; --scope user (default) | project | local -# recommended companion: the robotcode plugin claude plugin marketplace add robotcodedev/robotframework-agent-plugins -claude plugin install robotcode@robotframework-agent-plugins +claude plugin install rf-stack@robotframework-plugins # brings rf-core and robotcode; --scope user (default) | project | local +claude plugin install rf-web@robotframework-plugins ``` +`rf-stack` depends on `rf-core` and on `robotcode@robotframework-agent-plugins`, so Claude Code installs both. It doesn't add the second marketplace for you: add it first. If you install `rf-stack` without it, `rf-core` still works, `rf-stack` reports the missing dependency, and adding the marketplace later installs it. Without `rf-stack`, install `rf-core` (or a technology plugin, which brings it) and `robotcode@robotframework-agent-plugins` one by one. + In a session, `/plugin marketplace add …` and `/plugin install …` do the same. `--scope project` writes the committed `.claude/settings.json` above. To try the in-tree plugins without a marketplace: `claude --plugin-dir ./plugins/rf-core --plugin-dir ./plugins/rf-web`. #### GitHub Copilot CLI @@ -146,7 +161,7 @@ copilot plugin install robotcode@robotframework-agent-plugins That is user scope. For project scope, commit `.claude/settings.json` (or `.github/copilot/settings.json` with the same keys) and list `rf-core` there too: Copilot CLI loads the plugins in that repository without an install step. Pin a release with its `ref` there. -Copilot CLI passes only a hook's `decision`/`reason` to the model. So the model sees Robot Framework **validation errors** after an edit ("The edit was applied, but …"), but not the advisory context the other agents get: deprecation and formatting warnings, the skill hint on prompts, error hints after `robot` runs, and the session environment report. +Copilot CLI passes only a hook's `decision`/`reason` to the model. So the model sees Robot Framework **validation errors** after an edit ("The edit was applied, but …"), but not the advisory context the other agents get: deprecation and formatting warnings, the skill hint on prompts, error hints after `robot` runs, and the session environment report. When robotcode is missing, the first `.robot` edit of a session carries that notice instead ("The edit was applied. … was not checked for errors"). #### VS Code (GitHub Copilot) @@ -196,6 +211,22 @@ Codex has no committed project-scope plugin file: every user runs the `codex plu Add the marketplace by its git URL, `https://github.com/MarketSquare/robotframework-plugins` (Customize → Plugins, or `cursor-agent plugin marketplace add …`), install `rf-core` and the technology plugins you need, and choose project or user scope. Cursor keeps marketplaces on your Cursor account. It also imports the plugin when it is installed in Claude Code or enabled in `.claude/settings.json` (Settings → Third-Party Imports). Add `https://github.com/robotcodedev/robotframework-agent-plugins` the same way for the `robotcode` plugin. +#### Antigravity CLI + +Antigravity CLI (`agy`, checked with 1.5.0) loads a plugin folder from the workspace's `.agents/plugins/` or from `~/.gemini/config/plugins/`. The installer writes that folder, with the subagents in Antigravity's format: + +```bash +uvx robotframework-plugins install --agent antigravity --plugins rf-core,rf-web # project: .agents/plugins/ +uvx robotframework-plugins install --agent antigravity --scope user --plugins rf-core,rf-web # user: ~/.gemini/config/plugins/ +uvx robotframework-plugins install --agent antigravity --robotcode-source ./robotframework-agent-plugins # also the robotcode skill (a local clone) +``` + +`agy plugin install ./plugins/rf-core` from a checkout loads the skills and hooks too, but skips the three subagents: Antigravity wants their `tools` as a YAML list, and the checkout keeps the Claude format ([antigravity-cli#2069](https://github.com/google-antigravity/antigravity-cli/issues/2069)). What reaches the model: +- the environment notice at session start, and the skill routing before each prompt (`PreInvocation`); +- not the validation results after an edit, nor the error hints after a command: Antigravity passes no `PostToolUse` output to the model, and its `PostToolUse` input carries no command output. The Stop-time project check runs. + +An administrator can turn plugins off with `pluginControls.pluginsDisabled` (admin settings or Gemini Enterprise plugin controls). + ### Python installer (`robotframework-plugins`) Run it with zero install and let it walk you through the agents to set up: @@ -257,6 +288,33 @@ Agents read project skills from `.claude/skills/` (Claude Code, Copilot), `.agen Without a ref, agents follow the repository's default branch, `main`. Add `#stable` (or `--ref stable`) unless you want unreleased changes. +### Organisations that restrict marketplaces + +Some organisations allow only approved plugin marketplaces. `rf-core` and the technology plugins depend on nothing outside this marketplace, so they install and work wherever this marketplace is allowed. Only `rf-stack` needs `robotframework-agent-plugins`; where that is blocked, `rf-stack` alone reports the missing dependency. Ways to get the robotcode plugin or skill, best first: + +1. **Allow the upstream marketplace.** Add `robotcodedev/robotframework-agent-plugins` to the allowlist, then install `rf-stack` as above. +2. **Mirror it internally.** Clone `robotcodedev/robotframework-agent-plugins` to an internal git host with its `robotcode--v` tags. Keep the marketplace name `robotframework-agent-plugins` in its `marketplace.json`, register it with `extraKnownMarketplaces`, and allow it by host or path pattern. A same-named mirror satisfies `rf-stack`'s dependency (checked with Claude Code 2.1.331, `tests/live/claude_dependency.sh`). +3. **Install the skill as plain files.** Install `rf-core` and the technology plugins, then add the robotcode skill folder from a pinned tag. Claude Code's marketplace allowlist doesn't apply to plain skills: + ```bash + git clone --depth 1 --branch robotcode--v2.8.0 https://github.com/robotcodedev/robotframework-agent-plugins # or your mirror + uvx robotframework-plugins install --agent --robotcode-source ./robotframework-agent-plugins + # or by hand: cp -r robotframework-agent-plugins/plugins/robotcode/skills/robotcode ~/.claude/skills/ + ``` +4. **VS Code:** the RobotCode extension bundles the plugin for Copilot Chat, so nothing else is needed. +5. **`rf-core` alone.** Its skills spell out every robotcode command they use, so they work without the robotcode skill. + +Where the admin setting lives, per agent: + +| Agent | Setting | +|---|---| +| Claude Code | managed settings: `strictKnownMarketplaces`, `blockedMarketplaces`, `extraKnownMarketplaces` | +| Copilot CLI | enterprise managed settings (`.github-private`, `copilot/managed-settings.json`): `strictKnownMarketplaces`, `extraKnownMarketplaces` | +| Codex | `requirements.toml`: `[marketplaces]` with `restrict_to_allowed_sources = true` and allowed sources | +| Antigravity CLI | admin settings: `pluginControls.pluginsDisabled`, `pluginControls.marketplaceDisabled` | +| OpenCode | managed config `policies`: `plugin.use`, `skill.use` | + +The robotcode CLI itself is a Python package (`robotcode[all]`); install it from your package index or mirror as described in [Prerequisites](#prerequisites). + ## Trust tiers Every plugin has a tier, shown in the catalogue above. @@ -299,9 +357,21 @@ The installer, hooks and scripts send nothing anywhere. The installer only touch - **Post-save validation**: Checks every written `.robot`/`.resource` file with `robotcode analyze code` (project environment first): syntax, argument and import errors are fed back to the agent; unknown keywords and variables are reported, and block only if still unresolved when the agent finishes; Robocop adds advice: deprecated syntax (`[Return]`, `Run Keyword If`, `Force Tags`, …) is reported as a **non-blocking warning** (`RF_AGENTSKILLS_DEPRECATION_CHECK=warn|off`); an opt-in per-file dry run (`RF_AGENTSKILLS_FILE_DRYRUN=1`). See `plugins/rf-core/hooks/README.md`. - **Skill routing**: Routes RF-related prompts to the appropriate skill (short routing text, ≤ 450 characters) -- **Environment check**: Checks for Robot Framework, robotcode (≥ 2.8) and the RF packages at session start (install advice via rf-setup) +- **Environment check**: Checks for Robot Framework, robotcode (≥ 2.8 with the `[all]` extras) and the RF packages at session start. When robotcode is missing or incomplete, the agent gets a short notice with the install command for your project's tool (uv, Poetry, PDM, Hatch or pip), and is told to ask you before installing. - **Test reminder**: Reminds you to run tests when the session ends +What reaches the model differs per agent. Each hook writes the shape the calling agent reads (checked live on the versions named): + +| Agent (version checked) | Environment notice at session start | Context after edits and commands (hints, advice) | Validation errors | +|---|---|---|---| +| Claude Code (2.1.331) | yes | yes | yes | +| Codex (0.162.1) | yes, after you trust the hooks once with `/hooks` | yes | yes | +| Copilot CLI (1.0.91) | no; the notice comes once with the first `.robot` edit instead | no | yes | +| VS Code Copilot (1.142) | not checked | Local harness: at the end of the reply | yes | +| Cursor | not checked (it reads `additional_context`, per its docs) | not checked | not checked | +| OpenCode (1.15.12) | yes, appended to the first tool output | yes | yes | +| Antigravity CLI (1.5.0) | yes | prompt routing yes; after edits and commands no | no | + ## Prerequisites - A supported coding agent (see the install matrix above) @@ -311,9 +381,13 @@ The installer, hooks and scripts send nothing anywhere. The installer only touch ```bash uv add --dev "robotcode[all]>=2.8" # uv poetry add --group dev "robotcode[all]>=2.8" # Poetry - pip install "robotcode[all]>=2.8" # venv + pip (venv active) + pdm add -dG dev "robotcode[all]>=2.8" # PDM + pip install "robotcode[all]>=2.8" # venv + pip (venv active; add it to requirements-dev.txt) + uv pip install --python .venv "robotcode[all]>=2.8" # a venv made with `uv venv` (it has no pip) ``` + With Hatch, add `robotcode[all]>=2.8` to the dependencies of the environment that runs the tests. When robotcode is missing or lacks an extra, the session check gives the agent the command for your project's tool, and tells it to ask you before installing. + Why `[all]`: the base package only has `config` and `profiles`; the skills need the `runner` (`robot`, `discover`, `results`), `analyze` and `repl` (`doc`, `robot-debug`) extras, and the hooks need Robocop, which only `[all]` brings in as well. A CI job that only runs tests can use `robotcode[runner]`. - **Recommended:** the `robotcode` plugin (`robotcode@robotframework-agent-plugins`) next to these plugins. It owns running, discovery, keyword documentation, result analysis, static analysis, `robot.toml` configuration, the REPL and the debugger; these plugins own Robot Framework syntax, Python keyword libraries, the test-library skills, environment setup, the validation hooks and the design, diagnosis and migration subagents. - New to Robot Framework setup? The `setup` skill (`rf-setup`) walks an agent through installing it into a project environment (uv preferred; it also covers venv + pip and Poetry). diff --git a/docs/catalog.md b/docs/catalog.md index dc1ade6..a64df26 100644 --- a/docs/catalog.md +++ b/docs/catalog.md @@ -10,6 +10,7 @@ Release **5.1.0**: the installer and every plugin carry this version. `pip insta | `rf-api` | verified | active | RequestsLibrary and RESTinstance skills for API tests. | RequestsLibrary, RESTinstance | [@manykarim](https://github.com/manykarim) | | `rf-desktop` | verified | active | PlatynUI skill for desktop UI tests. | PlatynUI | [@manykarim](https://github.com/manykarim) | | `rf-mobile` | verified | active | AppiumLibrary skill for Android and iOS tests. | AppiumLibrary | [@manykarim](https://github.com/manykarim) | +| `rf-stack` | community | active | Claude Code only. Installs rf-core together with the RobotCode project's robotcode plugin in one step; needs the robotframework-agent-plugins marketplace. | Robot Framework | [@manykarim](https://github.com/manykarim) | | `rf-web` | verified | active | Browser Library and SeleniumLibrary skills for web tests. | Browser, SeleniumLibrary | [@manykarim](https://github.com/manykarim) | ## rf-core @@ -63,6 +64,18 @@ AppiumLibrary skill for Android and iOS tests. - **Maintainers:** [@manykarim](https://github.com/manykarim) - **Install (Claude Code):** `/plugin install rf-mobile@robotframework-plugins` +## rf-stack + +Claude Code only. Installs rf-core together with the RobotCode project's robotcode plugin in one step; needs the robotframework-agent-plugins marketplace. + +- **Tier:** community +- **Status:** active +- **Robot Framework:** `>=7.0` +- **Brings:** `rf-core`, `robotcode@robotframework-agent-plugins` (nothing of its own; for claude-code only) +- **Tested with:** claude-code +- **Maintainers:** [@manykarim](https://github.com/manykarim) +- **Install (Claude Code):** `/plugin install rf-stack@robotframework-plugins` + ## rf-web Browser Library and SeleniumLibrary skills for web tests. diff --git a/docs/ci/live-agent-checks.md b/docs/ci/live-agent-checks.md new file mode 100644 index 0000000..f918206 --- /dev/null +++ b/docs/ci/live-agent-checks.md @@ -0,0 +1,28 @@ +# Live agent checks: robotcode install guidance + +What each agent showed in a live session, for the change `robotcode-install-guidance`. Re-run these before a release that touches the hooks or the installer, and update the README channel table from the results. + +Every check ran in a scratch project whose `.venv` has Robot Framework 7.5 but no robotcode, unless the row says otherwise. + +## Results + +| Agent (version) | Date | Check | Result | +|---|---|---|---| +| Claude Code (2.1.331) | 2026-12-01 | `claude --plugin-dir plugins/rf-core -p "Quote any robotcode notice"` | Notice in context (`SessionStart hook additional context: Robot Framework project: robotcode is not installed …`), with the venv command `.venv/bin/python -m pip install "robotcode[all]>=2.8"`. | +| Claude Code (2.1.331) | 2026-12-01 | Task "look up the arguments of `Should Be Equal As Numbers` with robotcode, add a test, run the suite", without Bash | The agent stopped and asked for permission to install `robotcode[all]`. | +| Claude Code (2.1.331) | 2026-12-01 | Same session continued with "Yes, install it" (Bash allowed only for the venv's pip and robotcode) | Installed into the venv: `robotcode` 2.8.0 with `runner`, `analyze`, `repl` and Robocop 9.4.0. Then ran `robotcode analyze code`, `robotcode robot` and `robotcode results summary`. | +| Claude Code (2.1.331) | 2026-12-01 | `tests/live/claude_dependency.sh` | All five cases match: default install, upstream added late, allowlist, blocklist, same-named mirror. | +| Codex (0.162.1) | 2026-11-24 | Probe plugin after `/hooks` trust, `codex exec` | `hookSpecificOutput.additionalContext` reaches the model; a top-level `additionalContext` and a combined object don't. | +| Codex (0.162.1) | 2026-12-01 | rf-core from the working tree (`codex plugin marketplace add `), hooks trusted with `/hooks`, then `codex exec` | The model quotes the robotcode notice with `.venv/bin/python -m pip install "robotcode[all]>=2.8"` and the companion plugin. Codex trusted the hooks of `hooks/hooks.json` only, so the Antigravity `hooks.json` at the plugin root doesn't affect it. | +| Antigravity CLI (1.5.0) | 2026-12-01 | `agy plugin import` of rf-core | Edit matcher `write_to_file\|write_file\|replace_file_content\|edit_file`, shell `run_command`. PostToolUse input: `toolCall`, `conversationId`, no tool output. PostToolUse `injectSteps` don't reach the model. | +| Antigravity CLI (1.5.20) | 2026-12-01 | `robotframework-plugins install --agent antigravity --plugins rf-core,rf-web`, then `agy -p` | `agy plugin validate --strict` passes (4 skills, 3 subagents, 1 hook). The session lists the three `rf-` subagents and the rf-core and rf-web skills, gets the prompt routing (`PreInvocation`) and the robotcode notice. `uninstall` removes the folder. | +| OpenCode (1.15.12) | 2026-11-24 | Probe through the generated hook plugin | `hookSpecificOutput.additionalContext` shows in the first tool output. | +| OpenCode (1.15.12) | 2026-12-01 | `uvx --from ./installer robotframework-plugins install --agent opencode --plugins rf-core --robotcode-source `, then `opencode run` (OpenRouter, Claude Haiku 4.5) | `install` reports robotcode missing with the venv's pip command. The robotcode notice is appended to the first tool output (`ls`). The robotcode skill copied from the clone is available, with its description. | +| Copilot CLI (1.0.91) | 2026-11-24 | Probe plugin, both hook formats, all output shapes | The hook runs, but no SessionStart output reaches the model. | +| Copilot CLI (1.0.91) | 2026-12-01 | `copilot --plugin-dir plugins/rf-core -p` writing two `.robot` files | The first edit returns `The edit was applied. a.robot was not checked for errors: … .venv/bin/python -m pip install "robotcode[all]>=2.8"`; the file stays, and the second edit gets no notice. | +| Copilot CLI (1.0.91) | 2026-12-01 | Probe plugin on `UserPromptSubmit`, `hookSpecificOutput` and top-level `additionalContext` | Neither reaches the model, so the first-edit notice stays Copilot's only channel (design D3). | + +## Notes + +- The installer pins the interpreter it runs with (`scripts/python_runtime.json`), and the hooks look for robotcode next to it too. Run the installer as users do (`uvx robotframework-plugins …`, or `uvx --from ./installer …` from a checkout). Run from this repository's own `.venv`, which has `robotcode[all]`, it reports robotcode as ready in any project. +- agy updated itself from 1.5.0 to 1.5.20 during the checks; the results held on both. 1.5.20 fixed `agy plugin install` writing a Claude plugin's hooks in a shape its loader skips. Subagents are still copied unconverted and skipped: [antigravity-cli#2069](https://github.com/google-antigravity/antigravity-cli/issues/2069). diff --git a/installer/README.md b/installer/README.md index b000aca..1ba978e 100644 --- a/installer/README.md +++ b/installer/README.md @@ -1,6 +1,6 @@ # robotframework-plugins -Installs the Robot Framework plugins (skills, subagents and hooks for coding agents) into the folders each agent reads, for seven agents: +Installs the Robot Framework plugins (skills, subagents and hooks for coding agents) into the folders each agent reads, for eight agents: | Agent | What it gets | |---|---| @@ -11,6 +11,7 @@ Installs the Robot Framework plugins (skills, subagents and hooks for coding age | OpenCode | skills, subagents; edit validation, error hints and the environment report through its JS plugin | | Project Goose | skills, plus the subagents folded into `.goosehints` | | Claude Desktop | one upload-ready ZIP per skill (Customize → Skills → Upload a skill) | +| Antigravity CLI | a plugin folder (`.agents/plugins/` or `~/.gemini/config/plugins/`): skills, subagents, the environment report and prompt routing | This package was called `rf-agentskills` up to 0.8.0. That name now forwards here. @@ -67,6 +68,21 @@ robotframework-plugins install --agent claude-code --mode plugin robotframework-plugins install --agent claude-code --mode plugin --ref v5.1.0 # pin a release ``` +### The robotcode plugin or skill + +The plugins build on the RobotCode project's `robotcode` plugin, which teaches the agent the robotcode CLI. In plugin mode the installer adds it too: it registers the `robotframework-agent-plugins` marketplace and enables `robotcode@robotframework-agent-plugins` (Claude Code also gets `rf-stack`, which installs `rf-core` and `robotcode` together). Codex gets the two extra `codex plugin` commands, Cursor the steps. `--no-robotcode` leaves it out. + +File-mode installs make no network call, so they copy the robotcode skill only when you say where it comes from: + +```bash +git clone --depth 1 --branch robotcode--v2.8.0 https://github.com/robotcodedev/robotframework-agent-plugins +robotframework-plugins install --agent opencode --robotcode-source ./robotframework-agent-plugins # a local clone: no network +robotframework-plugins install --agent opencode --robotcode-source https://git.example.com/mirror/robotframework-agent-plugins +robotframework-plugins install --agent opencode --robotcode-source github # downloads the tag's archive +``` + +The skill keeps its `LICENSE`, is recorded like the other files, and `uninstall` removes it. A later install without the flag leaves it as it is. In plugin mode, `--robotcode-source` with a folder or a git URL registers that internal mirror instead of GitHub. + ### Upgrading Run `install` again with the same agent and scope. Files the previous install wrote that the new version no longer ships are removed when you haven't changed them; files you changed are kept and reported. `--dry-run` shows them as `remove` and `keep` rows first. An install made by `rf-agentskills` 0.8.0 or earlier is moved to the new layout the same way. @@ -81,6 +97,7 @@ Pre-releases need an opt-in: `pipx install --pip-args=--pre robotframework-plugi robotframework-plugins install [--agents all|none|detected| | --agent | --all] [--plugins |all] [--scope project|user] [--project DIR] [--mode files|plugin] [--ref TAG] [--what skills,agents,hooks] + [--no-robotcode] [--robotcode-source DIR|GIT-URL|github] [--yes] [--no-input] [--dry-run] [--force] robotframework-plugins uninstall --agent [--scope project|user] [--project DIR] robotframework-plugins catalog [--json] # the plugins this version bundles @@ -156,7 +173,7 @@ Choose the ref deliberately: ## No telemetry -The installer sends nothing anywhere. It only touches the network for the marketplace and package operations you ask for. The `bundle.fetch()` function of the Python API downloads from GitHub, or the source you configure, only when a program calls it; the installer's commands never do. +The installer sends nothing anywhere. It only touches the network for the marketplace and package operations you ask for, and for `--robotcode-source` with a git URL or `github`. The `bundle.fetch()` function of the Python API downloads from GitHub, or the source you configure, only when a program calls it; the installer's commands never do. ## More diff --git a/installer/src/robotframework_plugins/_assets.py b/installer/src/robotframework_plugins/_assets.py index c06a241..b14d64c 100644 --- a/installer/src/robotframework_plugins/_assets.py +++ b/installer/src/robotframework_plugins/_assets.py @@ -36,6 +36,19 @@ def asset_root_traversable(plugin: str = DEFAULT_PLUGIN): return bundle_root_traversable().joinpath("plugins", plugin) +#: Plugin-shaped trees from outside the bundle, by name, for one install run +#: (the robotcode skill copied with --robotcode-source; design D7). +_EXTERNAL_TREES: dict[str, Path] = {} + + +def register_external_tree(name: str, root: Path | None) -> None: + """Make ``asset_root_path(name)`` yield ``root`` (``None`` removes it).""" + if root is None: + _EXTERNAL_TREES.pop(name, None) + else: + _EXTERNAL_TREES[name] = root + + @contextmanager def asset_root_path(plugin: str = DEFAULT_PLUGIN) -> Iterator[Path]: """Yield one bundled plugin tree as a real ``Path``. @@ -43,7 +56,11 @@ def asset_root_path(plugin: str = DEFAULT_PLUGIN) -> Iterator[Path]: ``importlib.resources.as_file`` extracts the resource into a temporary directory if it lives inside a zip / wheel; for normal on-disk installs (the common case) it returns the path directly. + A tree registered with :func:`register_external_tree` wins. """ + if plugin in _EXTERNAL_TREES: + yield _EXTERNAL_TREES[plugin] + return with as_file(asset_root_traversable(plugin)) as p: yield Path(p) diff --git a/installer/src/robotframework_plugins/_catalog.py b/installer/src/robotframework_plugins/_catalog.py index 33915bd..f504d2f 100644 --- a/installer/src/robotframework_plugins/_catalog.py +++ b/installer/src/robotframework_plugins/_catalog.py @@ -20,7 +20,8 @@ #: on a breaking change to the documented entry fields; see the README's #: "Python API" section. CATALOG_FORMAT = 1 -#: Statuses that are bundled; ``removed`` plugins stay out. +#: Statuses that are bundled; ``removed`` plugins stay out, and so do +#: dependency-only plugins (``kind: dependency-only``), which ship no files. BUNDLED_STATUSES = ("active", "deprecated") #: A plugin's own top-level folders that are for this repository's CI, not for #: users. Skills ship example ``tests/`` folders too, so only the plugin root. @@ -68,6 +69,10 @@ def catalog_entries(plugins_dir: Path) -> list[dict[str, Any]]: m = _manifest(d) if m["status"] not in BUNDLED_STATUSES: continue + # A dependency-only plugin (rf-stack) has no files to install; Claude Code + # enables it by name from the marketplace (companion-plugin-dependency). + if m.get("kind") == "dependency-only": + continue pj = _plugin_json(d) deps = [x if isinstance(x, str) else x["name"] for x in pj.get("dependencies", [])] entry = { diff --git a/installer/src/robotframework_plugins/_robotcode_env.py b/installer/src/robotframework_plugins/_robotcode_env.py new file mode 100644 index 0000000..257f4a3 --- /dev/null +++ b/installer/src/robotframework_plugins/_robotcode_env.py @@ -0,0 +1,157 @@ +"""Is ``robotcode[all]`` ready in a project's environment, and which command installs it. + +A Python port of the hook helpers ``_install_advice.mjs`` and ``robotcodeReadiness`` +in ``_python_env.mjs`` (plugins/rf-core/scripts); both follow the table in +plugins/rf-core/tests/fixtures/install_advice.json, which the tests of each side read. +Used by ``install`` and ``doctor``. The installer never installs robotcode itself: it +runs from its own environment (often ``uvx``), which can't see the project's libraries. +Standard library only; the project's interpreter is run, never imported. +""" + +from __future__ import annotations + +import json +import os +import re +import subprocess +import sys +from dataclasses import dataclass, field +from pathlib import Path + +REQUIREMENT = "robotcode[all]>=2.8" +MIN_VERSION = (2, 8) +EXTRAS = {"runner": "robotcode-runner", "analyze": "robotcode-analyze", "repl": "robotcode-repl"} +_MARKERS = ("pyproject.toml", "uv.lock", "poetry.lock", "pdm.lock", ".venv", "requirements.txt") +_PROBE = ( + "import json\n" + "from importlib import metadata as m\n" + "def v(n):\n" + " try: return m.version(n)\n" + " except Exception: return None\n" + f"print(json.dumps({{n: v(n) for n in {['robotcode', 'robotframework', 'robotframework-robocop', *EXTRAS.values()]!r}}}))\n" +) + + +@dataclass(frozen=True) +class Advice: + manager: str # uv | poetry | pdm | hatch | pip | unknown + command: str + note: str = "" + + @property + def text(self) -> str: + return f"{self.command} ({self.note})" if self.note else self.command + + +@dataclass(frozen=True) +class Readiness: + state: str # ready | partial | old | missing | unknown (no interpreter) + interpreter: str | None + version: str | None = None + robotframework: str | None = None + missing_extras: tuple[str, ...] = field(default_factory=tuple) + + +def project_dir(start: Path) -> Path: + """The nearest folder at or above ``start`` that looks like a Python project root.""" + d = start.resolve() + for _ in range(20): + if any((d / m).exists() for m in _MARKERS): + return d + if d.parent == d: + break + d = d.parent + return start.resolve() + + +def install_advice(cwd: Path, env: dict[str, str] | None = None) -> Advice: + env = dict(os.environ) if env is None else env + root = project_dir(cwd) + try: + pyproject = (root / "pyproject.toml").read_text(encoding="utf-8") + except OSError: + pyproject = "" + + def section(name: str) -> bool: + return re.search(rf"^\[tool\.{name}(\]|\.)", pyproject, re.MULTILINE) is not None + + req = f'"{REQUIREMENT}"' + if (root / "uv.lock").exists() or section("uv"): + return Advice("uv", f"uv add --dev {req}") + if (root / "poetry.lock").exists() or section("poetry"): + return Advice("poetry", f"poetry add --group dev {req}") + if (root / "pdm.lock").exists() or section("pdm"): + return Advice("pdm", f"pdm add -dG dev {req}") + if section("hatch"): + return Advice("hatch", f"add {req} to the dependencies of the Hatch environment that runs the tests", + "then recreate it (hatch env prune)") + active = env.get("VIRTUAL_ENV", "").strip() + venv = Path(active) if active else (root / ".venv" if (root / ".venv").exists() else None) + if venv is not None: + shown = ".venv" if venv == root / ".venv" else str(venv) + py = f"{shown}\\Scripts\\python.exe" if sys.platform == "win32" else f"{shown}/bin/python" + req_file = next((n for n in ("requirements-dev.txt", "dev-requirements.txt", "requirements.txt") + if (root / n).exists()), None) + try: + uv_venv = re.search(r"^uv\s*=", (venv / "pyvenv.cfg").read_text(encoding="utf-8"), re.MULTILINE) + except OSError: + uv_venv = None + command = f"uv pip install --python {shown} {req}" if uv_venv else f"{py} -m pip install {req}" + return Advice("pip", command, f"and add {REQUIREMENT} to {req_file}" if req_file else "") + return Advice("unknown", f"uv add --dev {req}", "or the project's own tool (rf-setup skill)") + + +def project_interpreter(cwd: Path, env: dict[str, str] | None = None) -> str | None: + """The project's Python: the active venv, the project's .venv, else python3 on PATH.""" + env = dict(os.environ) if env is None else env + rel = Path("Scripts", "python.exe") if sys.platform == "win32" else Path("bin", "python") + candidates = [] + if env.get("VIRTUAL_ENV", "").strip(): + candidates.append(Path(env["VIRTUAL_ENV"].strip()) / rel) + candidates.append(project_dir(cwd) / ".venv" / rel) + for c in candidates: + if c.is_file(): + return str(c) + import shutil + return shutil.which("python3", path=env.get("PATH")) or shutil.which("python", path=env.get("PATH")) + + +def _at_least(version: str) -> bool: + nums = [int(x) for x in re.findall(r"\d+", version)[:2]] + [0, 0] + return (nums[0], nums[1]) >= MIN_VERSION + + +def readiness(cwd: Path, env: dict[str, str] | None = None, timeout: float = 15) -> Readiness: + py = project_interpreter(cwd, env) + if py is None: + return Readiness("unknown", None) + try: + r = subprocess.run([py, "-c", _PROBE], capture_output=True, text=True, timeout=timeout, env=env) + dists = json.loads(r.stdout.strip().splitlines()[-1]) if r.returncode == 0 and r.stdout.strip() else None + except Exception: + dists = None + if not isinstance(dists, dict): + return Readiness("unknown", py) + version = dists.get("robotcode") + if not version: + return Readiness("missing", py, robotframework=dists.get("robotframework")) + if not _at_least(version): + return Readiness("old", py, version, dists.get("robotframework")) + missing = tuple(extra for extra, dist in EXTRAS.items() if not dists.get(dist)) + return Readiness("partial" if missing else "ready", py, version, dists.get("robotframework"), missing) + + +def summary(cwd: Path, env: dict[str, str] | None = None) -> tuple[Readiness, str]: + """Readiness and one line for people: what's wrong and the command, or that it's ready.""" + r = readiness(cwd, env) + advice = install_advice(cwd, env) + if r.state == "ready": + return r, f"robotcode {r.version} with runner, analyze and repl ({r.interpreter})" + if r.state == "unknown": + return r, f"no project Python found; install {REQUIREMENT} into the project environment: {advice.text}" + problem = { + "missing": "not installed in the project environment", + "old": f"{r.version} is older than 2.8", + "partial": f"{r.version} without the extras {', '.join(r.missing_extras)}", + }[r.state] + return r, f"robotcode {problem}; install {REQUIREMENT}: {advice.text}" diff --git a/installer/src/robotframework_plugins/_robotcode_skill.py b/installer/src/robotframework_plugins/_robotcode_skill.py new file mode 100644 index 0000000..cffc534 --- /dev/null +++ b/installer/src/robotframework_plugins/_robotcode_skill.py @@ -0,0 +1,127 @@ +"""The RobotCode project's ``robotcode`` skill, for file-mode installs (design D7). + +Used only with ``install --robotcode-source``; a file-mode install without it makes +no network call (adoption-reporting, "No telemetry"). The source is + +* a local folder: a clone or a mirror checkout of robotframework-agent-plugins, its + ``plugins/robotcode`` folder, or the skill folder itself (no network); +* ``github``: the archive of the upstream tag ``ROBOTCODE_PLUGIN_TAG``; +* any other value: a git URL of an internal mirror, cloned at that tag. + +Only ``plugins/robotcode/skills/robotcode/`` and the plugin's ``LICENSE`` are +taken. The result is a plugin-shaped tree (``/skills/robotcode/``, LICENSE +inside the skill folder) that every adapter installs like a bundled plugin. +Nothing from the source is imported or run. +""" + +from __future__ import annotations + +import shutil +import subprocess +import tarfile +import tempfile +import urllib.request +from pathlib import Path, PurePosixPath + +from .adapters._base import ROBOTCODE_PLUGIN_TAG, ROBOTCODE_REPO + +#: Name the skill tree is installed under (manifest ``plugin`` of its files). +PLUGIN_NAME = "robotcode" +SKILL_NAME = "robotcode" +MAX_ARCHIVE_BYTES = 20 * 1024 * 1024 +_SKILL_PARTS = ("plugins", "robotcode", "skills", "robotcode") + + +class SkillSourceError(RuntimeError): + """The robotcode skill could not be taken from the given source.""" + + +def archive_url(tag: str = ROBOTCODE_PLUGIN_TAG) -> str: + return f"https://codeload.github.com/{ROBOTCODE_REPO}/tar.gz/refs/tags/{tag}" + + +def manual_commands(tag: str = ROBOTCODE_PLUGIN_TAG) -> list[str]: + """What a user runs to add the skill by hand (printed when no source is given).""" + return [ + f"git clone --depth 1 --branch {tag} https://github.com/{ROBOTCODE_REPO}", + "robotframework-plugins install ... --robotcode-source ./robotframework-agent-plugins", + ] + + +def _find_skill(root: Path) -> tuple[Path, Path | None]: + """(skill folder, LICENSE or None) inside a local source folder.""" + for skill in (root.joinpath(*_SKILL_PARTS), root / "skills" / SKILL_NAME, root): + if (skill / "SKILL.md").is_file(): + break + else: + raise SkillSourceError(f"{root}: no robotcode skill (looked for plugins/robotcode/skills/robotcode/SKILL.md)") + for lic in (root / "plugins" / "robotcode" / "LICENSE", root / "LICENSE", skill / "LICENSE"): + if lic.is_file(): + return skill, lic + return skill, None + + +def _build_tree(skill: Path, license_file: Path | None, dest: Path) -> Path: + target = dest / "skills" / SKILL_NAME + shutil.copytree(skill, target, ignore=shutil.ignore_patterns(".git", "__pycache__")) + if license_file is not None and not (target / "LICENSE").is_file(): + shutil.copy2(license_file, target / "LICENSE") + return dest + + +def _extract_archive(archive: Path, dest: Path) -> Path: + """Unpack only plugins/robotcode/ (regular files and folders, no links, no ..).""" + with tarfile.open(archive, "r:gz") as tf: + for m in tf.getmembers(): + parts = PurePosixPath(m.name).parts + if len(parts) < 3 or parts[1:3] != ("plugins", "robotcode"): + continue + if m.name.startswith("/") or ".." in parts or not (m.isfile() or m.isdir()): + raise SkillSourceError(f"unsafe archive entry: {m.name}") + out = dest.joinpath(*parts[1:]) + if m.isdir(): + out.mkdir(parents=True, exist_ok=True) + continue + out.parent.mkdir(parents=True, exist_ok=True) + src = tf.extractfile(m) + if src is None: + continue + with src, open(out, "wb") as fh: + shutil.copyfileobj(src, fh) + return dest + + +def _download(url: str, dest: Path, timeout: float) -> None: + req = urllib.request.Request(url, headers={"User-Agent": "robotframework-plugins-installer"}) + with urllib.request.urlopen(req, timeout=timeout) as resp, open(dest, "wb") as fh: + total = 0 + while chunk := resp.read(65536): + total += len(chunk) + if total > MAX_ARCHIVE_BYTES: + raise SkillSourceError(f"{url}: archive larger than {MAX_ARCHIVE_BYTES} bytes") + fh.write(chunk) + + +def fetch(source: str, dest: Path, *, tag: str = ROBOTCODE_PLUGIN_TAG, timeout: float = 30) -> Path: + """Build the plugin-shaped robotcode skill tree in ``dest`` and return it.""" + local = Path(source).expanduser() + if local.is_dir(): + return _build_tree(*_find_skill(local), dest) + with tempfile.TemporaryDirectory(prefix="rf-robotcode-") as tmp: + work = Path(tmp) + if source == "github": + archive = work / "src.tar.gz" + try: + _download(archive_url(tag), archive, timeout) + except OSError as exc: + raise SkillSourceError(f"download of {archive_url(tag)} failed: {exc}") from exc + checkout = _extract_archive(archive, work / "repo") + else: + if shutil.which("git") is None: + raise SkillSourceError("git is needed to clone a mirror URL") + checkout = work / "repo" + r = subprocess.run(["git", "clone", "--quiet", "--depth", "1", "--branch", tag, source, str(checkout)], + capture_output=True, text=True, timeout=timeout * 4) + if r.returncode != 0: + raise SkillSourceError(f"git clone {source} at {tag} failed: {r.stderr.strip()[:300]}") + return _build_tree(*_find_skill(checkout), dest) diff --git a/installer/src/robotframework_plugins/adapters/__init__.py b/installer/src/robotframework_plugins/adapters/__init__.py index fcc4e2d..a22ef3c 100644 --- a/installer/src/robotframework_plugins/adapters/__init__.py +++ b/installer/src/robotframework_plugins/adapters/__init__.py @@ -11,6 +11,7 @@ class implementing the protocol, append to ``ALL_ADAPTERS``. from __future__ import annotations from . import ( + antigravity, claude_code, claude_desktop, codex, @@ -29,6 +30,7 @@ class implementing the protocol, append to ``ALL_ADAPTERS``. goose.GooseAdapter, opencode.OpenCodeAdapter, claude_desktop.ClaudeDesktopAdapter, + antigravity.AntigravityAdapter, ) diff --git a/installer/src/robotframework_plugins/adapters/_base.py b/installer/src/robotframework_plugins/adapters/_base.py index d50326b..3083410 100644 --- a/installer/src/robotframework_plugins/adapters/_base.py +++ b/installer/src/robotframework_plugins/adapters/_base.py @@ -61,6 +61,11 @@ class InstallOptions: # True when ``--plugins`` named the plugins. Otherwise an upgrade keeps # what the target already has (see ``upgrade_plugins``). plugins_explicit: bool = False + # The RobotCode project's robotcode plugin or skill (companion-plugin-dependency): + # off with --no-robotcode; ``robotcode_source`` is --robotcode-source (a folder, + # a git URL, or "github"), the mirror in plugin mode and the skill source in file mode. + robotcode: bool = True + robotcode_source: str | None = None @dataclass(frozen=True) @@ -411,6 +416,66 @@ def op(key: str, values: dict[str, Any], what: str) -> ConfigMergeOp: ] +#: The RobotCode project's agent plugin (companion-plugin-dependency). +ROBOTCODE_MARKETPLACE = "robotframework-agent-plugins" +ROBOTCODE_REPO = "robotcodedev/robotframework-agent-plugins" +ROBOTCODE_PLUGIN_ID = f"robotcode@{ROBOTCODE_MARKETPLACE}" +#: Upstream tag the skill fallback is taken from (design D7); bumped per release. +ROBOTCODE_PLUGIN_TAG = "robotcode--v2.8.0" +#: Dependency-only plugin that installs rf-core and robotcode together (Claude Code). +STACK_PLUGIN = "rf-stack" + + +def robotcode_mirror(opts: InstallOptions) -> str | None: + """The --robotcode-source mirror for the marketplace, or None for GitHub.""" + src = (opts.robotcode_source or "").strip() + return None if not src or src == "github" else src + + +def robotcode_marketplace_source(opts: InstallOptions) -> dict[str, Any]: + """``extraKnownMarketplaces`` source for robotframework-agent-plugins: GitHub, a + local folder, or a git URL of an internal mirror that keeps the marketplace name.""" + mirror = robotcode_mirror(opts) + if mirror is None: + return {"source": "github", "repo": ROBOTCODE_REPO} + if Path(mirror).expanduser().is_dir(): + return {"source": "directory", "path": str(Path(mirror).expanduser().resolve())} + return {"source": "git", "url": mirror} + + +def robotcode_settings_merges(settings_path: Path, opts: InstallOptions, *, stack: bool) -> list[ConfigMergeOp]: + """Marketplace entry and enabled plugins for the robotcode companion. ``stack`` + also enables rf-stack (Claude Code only: the other agents don't resolve dependencies).""" + if not opts.robotcode: + return [] + from .. import transforms as _x + + def op(key: str, values: dict[str, Any], what: str) -> ConfigMergeOp: + return ConfigMergeOp( + path=settings_path, + description=f"add {what} to {settings_path}", + apply=lambda: _x.merge_json_at_path(settings_path, [key], values), + revert=lambda: _x.remove_json_keys_at_path(settings_path, [key], list(values)), + kind="json_nested", + key_path=(key,), + ) + + enabled = {ROBOTCODE_PLUGIN_ID: True} + if stack: + enabled = {plugin_id(STACK_PLUGIN): True, **enabled} + return [ + op("extraKnownMarketplaces", {ROBOTCODE_MARKETPLACE: {"source": robotcode_marketplace_source(opts)}}, + f"marketplace {ROBOTCODE_MARKETPLACE}"), + op("enabledPlugins", enabled, "enabled plugin(s) " + ", ".join(enabled)), + ] + + +def robotcode_marketplace_arg(opts: InstallOptions) -> str: + """What ` plugin marketplace add` takes for the robotcode marketplace.""" + mirror = robotcode_mirror(opts) + return mirror if mirror is not None else ROBOTCODE_REPO + + def needs_support_dir(src_root: Path) -> bool: """A plugin needs a ``-files`` folder only for hook scripts, hooks or skill scripts; the technology plugins have none (split-rf-agentskills D7).""" diff --git a/installer/src/robotframework_plugins/adapters/antigravity.py b/installer/src/robotframework_plugins/adapters/antigravity.py new file mode 100644 index 0000000..2817e28 --- /dev/null +++ b/installer/src/robotframework_plugins/adapters/antigravity.py @@ -0,0 +1,104 @@ +"""Adapter for Google Antigravity CLI (``agy``) (antigravity-support, design D6). + +Antigravity loads a plugin folder without ``agy plugin install`` from +``/.agents/plugins//`` (that workspace) and from +``~/.gemini/config/plugins//`` (the user's plugins, where ``agy plugin +install`` puts them); both checked live with agy 1.5.0. Each folder holds: + +* ``.antigravity-plugin/plugin.json`` — the manifest (``build-catalog.py``) +* ``skills//`` — verbatim skill trees +* ``agents/.md`` — subagents in Antigravity's format + (``variants/antigravity/agents``: ``tools`` + as a YAML list, which its loader requires) +* ``hooks.json`` + ``scripts/`` — Antigravity-format hooks (generated by + ``build-agent-variants.py``) and the shared + hook scripts they run from the plugin folder + +A tree without an Antigravity manifest (the robotcode skill copied with +``--robotcode-source``) installs its skills as plain skills: ``.agents/skills/`` +or ``~/.gemini/config/skills/``. The install needs no ``agy`` on PATH. +""" + +from __future__ import annotations + +import shutil +from dataclasses import dataclass +from pathlib import Path +from typing import Iterable + +from .. import _assets +from .. import transforms as _x +from ._base import AdapterBase, InstallOptions, InstallPlan, InstallTarget + +MANIFEST_REL = Path(".antigravity-plugin") / "plugin.json" + + +@dataclass +class AntigravityAdapter(AdapterBase): + name: str = "antigravity" + pretty: str = "Antigravity CLI" + user_root_subpath: tuple[str, ...] = (".gemini", "config") + project_root_subpath: tuple[str, ...] = (".agents",) + + def detect(self) -> bool: + return shutil.which("agy") is not None or (Path.home() / ".gemini" / "antigravity-cli").is_dir() + + def plan(self, opts: InstallOptions) -> InstallPlan: + root = self.install_root(opts) + with _assets.asset_root_path(opts.plugin) as src_root: + if (src_root / MANIFEST_REL).is_file(): + plugin_dst = root / "plugins" / opts.plugin + targets = list(self._plugin_targets(src_root, plugin_dst, opts.what)) + else: # skills only, e.g. the robotcode skill + targets = list(self._skill_targets(src_root, root / "skills", root / "skills", opts.what)) + return InstallPlan(targets=tuple(targets)) + + def _skill_targets(self, src_root: Path, skills_dst: Path, plugin_dst: Path, + what: frozenset[str]) -> Iterable[InstallTarget]: + skills_src = src_root / "skills" + if "skills" not in what or not skills_src.is_dir(): + return + plugin_root_abs = _x.to_native_path_string(plugin_dst.resolve()) + for f in sorted(skills_src.rglob("*")): + if not f.is_file(): + continue + rel = f.relative_to(skills_src) + data = f.read_bytes() + if _x.is_substitution_candidate(f): + data = _x.substitute_plugin_root_bytes(data, plugin_root_abs) + yield InstallTarget( + dst=skills_dst / rel, + payload=self.render_skill_dir(data, f, skills_dst / rel.parts[0]), + transform_name="plugin_root_substitution", + ) + + def _plugin_targets(self, src_root: Path, plugin_dst: Path, what: frozenset[str]) -> Iterable[InstallTarget]: + yield InstallTarget(dst=plugin_dst / MANIFEST_REL, payload=(src_root / MANIFEST_REL).read_bytes(), + transform_name="antigravity_manifest") + yield from self._skill_targets(src_root, plugin_dst / "skills", plugin_dst, what) + if "agents" in what: + for f in sorted((src_root / "variants" / "antigravity" / "agents").glob("*.md")): + yield InstallTarget(dst=plugin_dst / "agents" / f.name, payload=f.read_bytes(), + transform_name="antigravity_agent_variant") + hooks = src_root / "hooks.json" + if "hooks" in what and hooks.is_file(): + yield InstallTarget(dst=plugin_dst / "hooks.json", payload=hooks.read_bytes(), + transform_name="antigravity_hooks") + for f in sorted((src_root / "scripts").glob("*")): + if f.is_file(): + yield InstallTarget(dst=plugin_dst / "scripts" / f.name, payload=f.read_bytes(), + transform_name="antigravity_hook_script") + # validate_robot and check_rf_environment read the pinned interpreter. + yield InstallTarget(dst=plugin_dst / "scripts" / "python_runtime.json", + payload=_x.python_runtime_config_bytes(), transform_name="python_runtime_pin") + + def post_install(self, opts: InstallOptions) -> list[str]: + notes = ["Antigravity loads the plugins on its next session (no `agy plugin install` needed)."] + if "hooks" in opts.what: + notes.append( + "Hooks (need `node` on PATH): the environment report at session start and the skill " + "routing before each prompt reach the model. Antigravity passes no PostToolUse output " + "to the model (agy 1.5.0), so validation results after edits and error hints after " + "commands don't show there." + ) + return notes diff --git a/installer/src/robotframework_plugins/adapters/claude_code.py b/installer/src/robotframework_plugins/adapters/claude_code.py index 8ce8438..57d3a82 100644 --- a/installer/src/robotframework_plugins/adapters/claude_code.py +++ b/installer/src/robotframework_plugins/adapters/claude_code.py @@ -40,6 +40,10 @@ InstallPlan, InstallTarget, marketplace_settings_merges, + robotcode_settings_merges, + ROBOTCODE_MARKETPLACE, + ROBOTCODE_PLUGIN_ID, + STACK_PLUGIN, upgrade_plugins, old_marketplace_note, skill_script_files, @@ -114,6 +118,9 @@ def plan(self, opts: InstallOptions) -> InstallPlan: ) return InstallPlan(targets=tuple(targets), merges=tuple(merges), notes=tuple(notes)) + #: Enable rf-stack next to robotcode: only Claude Code resolves its dependencies. + enables_stack = True + def plugin_plan(self, opts: InstallOptions) -> InstallPlan | None: """Point Claude Code at the marketplace via ``settings.json``. @@ -140,8 +147,18 @@ def plugin_plan(self, opts: InstallOptions) -> InstallPlan | None: migrated = old_marketplace_note(settings) if migrated: notes.append(migrated) - return InstallPlan(merges=tuple(marketplace_settings_merges(settings, opts.ref, plugins)), - notes=tuple(notes)) + if opts.robotcode: + enabled = ([plugin_id(STACK_PLUGIN)] if self.enables_stack else []) + [ROBOTCODE_PLUGIN_ID] + notes.append( + f"{settings} also registers the {ROBOTCODE_MARKETPLACE} marketplace and enables " + f"{', '.join(enabled)} (the RobotCode project's plugin; --no-robotcode leaves it out). " + "If your organisation blocks that marketplace, see the README section " + "'Organisations that restrict marketplaces'." + ) + return InstallPlan( + merges=(*marketplace_settings_merges(settings, opts.ref, plugins), + *robotcode_settings_merges(settings, opts, stack=self.enables_stack)), + notes=tuple(notes)) def _collect_targets( self, diff --git a/installer/src/robotframework_plugins/adapters/codex.py b/installer/src/robotframework_plugins/adapters/codex.py index d5fb86a..54bbac9 100644 --- a/installer/src/robotframework_plugins/adapters/codex.py +++ b/installer/src/robotframework_plugins/adapters/codex.py @@ -41,7 +41,9 @@ from ._base import ( needs_support_dir, MARKETPLACE_REPO, + ROBOTCODE_PLUGIN_ID, plugin_id, + robotcode_marketplace_arg, AdapterBase, InstallOptions, InstallPlan, @@ -147,7 +149,11 @@ def plugin_commands(self, opts: InstallOptions) -> list[list[str]]: add = ["codex", "plugin", "marketplace", "add", MARKETPLACE_REPO] if opts.ref: add += ["--ref", opts.ref] - return [add, *(["codex", "plugin", "add", plugin_id(p)] for p in opts.plugins)] + commands = [add, *(["codex", "plugin", "add", plugin_id(p)] for p in opts.plugins)] + if opts.robotcode: # the RobotCode project's plugin (Codex installs no dependencies) + commands += [["codex", "plugin", "marketplace", "add", robotcode_marketplace_arg(opts)], + ["codex", "plugin", "add", ROBOTCODE_PLUGIN_ID]] + return commands def _collect_targets( self, diff --git a/installer/src/robotframework_plugins/adapters/copilot.py b/installer/src/robotframework_plugins/adapters/copilot.py index f19d213..579444e 100644 --- a/installer/src/robotframework_plugins/adapters/copilot.py +++ b/installer/src/robotframework_plugins/adapters/copilot.py @@ -26,12 +26,21 @@ from dataclasses import dataclass from pathlib import Path -from ._base import InstallOptions, InstallPlan, marketplace_settings_merges, old_marketplace_note, upgrade_plugins +from ._base import ( + InstallOptions, + InstallPlan, + marketplace_settings_merges, + old_marketplace_note, + robotcode_settings_merges, + upgrade_plugins, +) from .claude_code import ClaudeCodeAdapter @dataclass class CopilotAdapter(ClaudeCodeAdapter): + # Copilot CLI doesn't install dependencies: enable robotcode itself, not rf-stack. + enables_stack = False name: str = "copilot" pretty: str = "GitHub Copilot (VS Code)" # VS Code does not document ${CLAUDE_SKILL_DIR} substitution. @@ -82,6 +91,8 @@ def plugin_plan(self, opts: InstallOptions) -> InstallPlan | None: if migrated: notes = (*notes, migrated) return InstallPlan( - merges=(*base.merges, *marketplace_settings_merges(copilot_settings, opts.ref, upgrade_plugins(copilot_settings, opts))), + merges=(*base.merges, + *marketplace_settings_merges(copilot_settings, opts.ref, upgrade_plugins(copilot_settings, opts)), + *robotcode_settings_merges(copilot_settings, opts, stack=False)), notes=notes, ) diff --git a/installer/src/robotframework_plugins/adapters/cursor.py b/installer/src/robotframework_plugins/adapters/cursor.py index 993b0b7..05d050b 100644 --- a/installer/src/robotframework_plugins/adapters/cursor.py +++ b/installer/src/robotframework_plugins/adapters/cursor.py @@ -47,7 +47,10 @@ needs_support_dir, legacy_markers, MARKETPLACE_REPO, + ROBOTCODE_PLUGIN_ID, + ROBOTCODE_REPO, plugin_id, + robotcode_mirror, AdapterBase, ConfigMergeOp, InstallOptions, @@ -126,6 +129,9 @@ def plugin_plan(self, opts: InstallOptions) -> InstallPlan | None: "choose project or user scope.", "Cursor also imports the plugin when it is installed in Claude Code and " "enabled in .claude/settings.json (Settings -> Third-Party Imports).", + *([f"Cursor: add the marketplace {robotcode_mirror(opts) or 'https://github.com/' + ROBOTCODE_REPO} " + f"the same way and install {ROBOTCODE_PLUGIN_ID} (the RobotCode project's plugin)."] + if opts.robotcode else []), )) def _collect_targets( diff --git a/installer/src/robotframework_plugins/cli.py b/installer/src/robotframework_plugins/cli.py index 5e09c61..20f14b5 100644 --- a/installer/src/robotframework_plugins/cli.py +++ b/installer/src/robotframework_plugins/cli.py @@ -26,19 +26,24 @@ from __future__ import annotations import argparse +import contextlib import json import os +import subprocess import sys +import tempfile from dataclasses import replace from pathlib import Path from typing import Sequence from rich.console import Console +from rich.markup import escape from rich.table import Table -from . import __version__, _assets, detect as _detect, manifest as _m +from . import __version__, _assets, _robotcode_env, _robotcode_skill, detect as _detect, manifest as _m from .adapters import ALL_ADAPTERS, all_names, by_name from .adapters._base import ( + ROBOTCODE_PLUGIN_TAG, Adapter, ConfigMergeOp, InstallOptions, @@ -98,6 +103,20 @@ def _build_parser() -> argparse.ArgumentParser: "scope); agents without a marketplace fall back to files.", ) sp.add_argument("--ref", help="With --mode plugin: pin the marketplace to this git tag/branch.") + sp.add_argument( + "--no-robotcode", + action="store_true", + help="Leave out the RobotCode project's robotcode plugin or skill (by default plugin mode " + "registers its marketplace and enables it next to these plugins).", + ) + sp.add_argument( + "--robotcode-source", + metavar="SOURCE", + help="Where the robotcode plugin or skill comes from: a local folder (a clone or a mirror " + "checkout), a git URL of an internal mirror, or 'github'. Plugin mode registers that " + "marketplace; file mode copies the robotcode skill from it (only with this flag: the " + "git URL and 'github' download it).", + ) sp.add_argument( "--plugins", metavar="NAMES", @@ -166,6 +185,8 @@ def _opts_from_args(args: argparse.Namespace) -> InstallOptions: force=getattr(args, "force", False), mode=getattr(args, "mode", "files") or "files", ref=getattr(args, "ref", None), + robotcode=not getattr(args, "no_robotcode", False), + robotcode_source=getattr(args, "robotcode_source", None), ) @@ -502,6 +523,54 @@ def cmd_install(args: argparse.Namespace) -> int: opts = replace(_opts_from_args(args), plugins=tuple(plugins), plugin=plugins[0], plugins_explicit=explicit) file_plugins = tuple(plugins) + with contextlib.ExitStack() as stack: + skill_tree = _robotcode_skill_tree(opts, selection, stack) + if skill_tree is _SKILL_FAILED: + return 1 + if skill_tree is not None: + file_plugins = (*file_plugins, _robotcode_skill.PLUGIN_NAME) + return _install_agents(args, opts, selection, file_plugins) + + +_SKILL_FAILED = Path("/nonexistent/robotcode-skill-failed") + + +def _robotcode_skill_tree(opts: InstallOptions, selection: list[str], stack: contextlib.ExitStack) -> Path | None: + """The robotcode skill tree for file-mode installs, from --robotcode-source (design D7). + + Without the flag nothing is fetched (file mode stays offline); a note says how + to add the skill. ``_SKILL_FAILED`` when the named source can't be used. + """ + if not opts.robotcode or (opts.ref and opts.mode != "plugin"): + return None # --no-robotcode; or the --ref error that _install_agents reports + # Agents that get files: all in file mode; in plugin mode those without a marketplace. + classes = [by_name(n) for n in selection] + files_agents = [c for c in classes if c is not None and (opts.mode == "files" or c().plugin_plan(opts) is None)] + if not files_agents: + return None + if not opts.robotcode_source: + console.print( + "[dim]robotcode skill:[/dim] not copied (file mode makes no network call). To add the " + "RobotCode project's robotcode skill, pass --robotcode-source with a clone or mirror " + "folder, a mirror's git URL, or 'github':\n " + + "\n ".join(_robotcode_skill.manual_commands()) + ) + return None + tmp = Path(stack.enter_context(tempfile.TemporaryDirectory(prefix="rf-robotcode-skill-"))) + try: + tree = _robotcode_skill.fetch(opts.robotcode_source, tmp / "tree") + except (_robotcode_skill.SkillSourceError, OSError, subprocess.SubprocessError) as exc: + err_console.print(f"[red]error:[/red] robotcode skill from {escape(repr(opts.robotcode_source))}: {escape(str(exc))}") + return _SKILL_FAILED + _assets.register_external_tree(_robotcode_skill.PLUGIN_NAME, tree) + stack.callback(_assets.register_external_tree, _robotcode_skill.PLUGIN_NAME, None) + console.print(f"[dim]robotcode skill:[/dim] copied from {opts.robotcode_source} " + f"({ROBOTCODE_PLUGIN_TAG} for remote sources)") + return tree + + +def _install_agents(args: argparse.Namespace, opts: InstallOptions, selection: list[str], + file_plugins: tuple[str, ...]) -> int: if opts.ref and opts.mode != "plugin": err_console.print("[red]error:[/red] --ref needs --mode plugin") return 2 @@ -531,9 +600,20 @@ def cmd_install(args: argparse.Namespace) -> int: rc |= _execute_plan(adapter, plan, agent_opts, manifest_path) if agent_opts.mode == "plugin": rc |= _run_plugin_commands(adapter, agent_opts, run=bool(getattr(args, "yes", False))) + if not opts.dry_run and opts.scope == "project": + _report_robotcode(opts.project_dir or Path.cwd()) return rc +def _report_robotcode(project: Path) -> None: + """After a project install: is robotcode[all] ready there? The installer never installs it.""" + state, line = _robotcode_env.summary(project) + if state.state == "ready": + console.print(f"[dim]robotcode:[/dim] {escape(line)}") + else: + console.print(f"[yellow]robotcode:[/yellow] {escape(line)}") + + def _plan_plugins(adapter: Adapter, opts: InstallOptions) -> InstallPlan: """One plan covering every plugin in ``opts.plugins``. @@ -879,7 +959,15 @@ def cmd_doctor(_args: argparse.Namespace) -> int: adapter.pretty, ) - # 4. Legacy skill directories from pre-2.0 bundles that we do not own. + # 4. robotcode in the project environment (the plugins need robotcode[all]>=2.8). + state, line = _robotcode_env.summary(Path.cwd()) + table.add_row( + "robotcode (project)", + "[green]ok[/green]" if state.state == "ready" else "[yellow]warn[/yellow]", + escape(line), # "robotcode[all]" is not Rich markup + ) + + # 5. Legacy skill directories from pre-2.0 bundles that we do not own. legacy = find_legacy_skill_dirs() table.add_row( "legacy skill dirs", @@ -1019,6 +1107,11 @@ def _partition_previous( for entry in previous.files: if entry.path in new_paths: continue + # The robotcode skill, copied by an earlier run with --robotcode-source: a run + # that doesn't copy it again keeps it (uninstall still removes it). + if entry.plugin == _robotcode_skill.PLUGIN_NAME and _robotcode_skill.PLUGIN_NAME not in opts.plugins: + carried.append(entry) + continue if _m.entry_category(entry) in in_scope or _is_retired_file(entry, previous.agent): stale.append(entry) else: diff --git a/openspec/changes/robotcode-install-guidance/.openspec.yaml b/openspec/changes/robotcode-install-guidance/.openspec.yaml new file mode 100644 index 0000000..ac69935 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-24 diff --git a/openspec/changes/robotcode-install-guidance/design.md b/openspec/changes/robotcode-install-guidance/design.md new file mode 100644 index 0000000..5303fbb --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/design.md @@ -0,0 +1,138 @@ +# Design + +## Context + +See proposal.md for the motivation. The evidence below comes from live checks on 2026-11-24. The probe plugins and test marketplaces are in the session scratchpad, and the commands are repeated in tasks.md. + +What each agent did with a `SessionStart` hook's stdout. The marker came from a probe plugin; the model was asked to quote it. + +| Agent (version) | Plain stdout | `hookSpecificOutput.additionalContext` | top-level `additionalContext` | `injectSteps` | stderr, exit 0 | +|---|---|---|---|---|---| +| Claude Code 2.1.331 | seen | seen | ignored | n/a | **not seen** | +| OpenCode 1.15.12 (our generated hook plugin) | n/a | seen | ignored | n/a | not seen | +| Antigravity CLI 1.5.0 | n/a | dropped | dropped | seen, **only when it is the only field** | n/a | +| Copilot CLI 1.0.91 | not seen | not seen | not seen | n/a | not seen (the hook runs, with `CLAUDE_PLUGIN_ROOT` set) | +| Codex 0.162.1 (`codex exec`, plugin hook trusted once with `/hooks`) | docs: seen | seen; **a combined object with extra fields is not seen** | ignored | n/a | not tested | +| Cursor | docs: `additional_context` | n/a | n/a | n/a | not tested: no `cursor-agent` on the machine | + +Cross-marketplace dependency in Claude Code 2.1.331 (isolated `CLAUDE_CONFIG_DIR`; policy simulated with the `--managed-settings` flag): + +| Placement | Upstream added | Upstream blocked or missing | +|---|---|---| +| on `rf-core` | all load (`+ 1 dependency: robotcode`) | **`rf-core` and every technology plugin fail to load**; the session has no skills | +| on technology plugins | all load | `rf-core` loads, technology plugins fail | +| in the marketplace entry | all load | install refused; nothing installed | +| thin `rf-stack` (`plugin.json`) | all load (`+ 2 dependencies`) | `rf-core` and technology plugins load; only `rf-stack` fails, and heals when a same-named marketplace is added | +| version range `>=2.8.0` | **fails**: "installed version unknown" (upstream entry has no `version`) | fails | + +Other observations: +- A same-named mirror of `robotframework-agent-plugins` satisfies the dependency. +- A plain skill folder in `~/.claude/skills/robotcode` loads under a marketplace allowlist. +- `agy plugin install` of a Claude-format plugin writes a root `hooks.json` that keeps the `"hooks"` wrapper, and agy's own loader skips it. A folder with `.antigravity-plugin/plugin.json` and an agy-format root `hooks.json` installs and runs natively. Claude Code and Copilot ignore those two files. + +## Goals / Non-Goals + +**Goals:** +- Every agent that has a channel receives a short robotcode notice at session start; Copilot CLI receives it on the first edit. +- The notice is right: it checks the extras, gives the command for the project's package manager, and says to ask first. +- In Claude Code, one install brings rf-core and the robotcode plugin, and an organisation that blocks upstream loses nothing else. +- Antigravity CLI is supported, and installs are checked live on Claude Code, Codex, OpenCode and Antigravity. + +**Non-Goals:** +- Installing the robotcode CLI without the user's consent. Hooks never run `pip` or `uv`; the agent asks the user. +- Re-listing or vendoring the robotcode plugin in our marketplace (option (d) below). +- Teaching the robotcode CLI. That stays the robotcode plugin's job; our skills keep their inline commands. + +## Decisions + +### D1. One output helper picks the shape by the calling agent + +A shared `_hook_output.mjs` gets `(event, text)` and writes one JSON object. The caller is detected in this order: + +| Signal | Agent | Shape | +|---|---|---| +| input has `conversationId` and camel-case `hookEventName`, or env `PLUGIN_ROOT` without `CLAUDE_PLUGIN_ROOT` | Antigravity | `injectSteps[{systemMessage:{systemMessage}}]` | +| input has `cursor_version` | Cursor | `additional_context` | +| env `RF_HOOK_AGENT` set by a generated wrapper (OpenCode plugin) | as named | per table | +| anything else | Claude Code, Codex, Copilot | `hookSpecificOutput.additionalContext` | + +**Alternative: one combined object with every field.** Rejected: Antigravity and Codex both drop it (tested); only Claude Code accepted it. +**Alternative: per-agent copies of each script.** Rejected: the scripts would drift. The generated variants pass only the agent name. + +The full human report stays on stderr. The model-facing notice is at most 600 characters and is emitted only when something is missing. + +### D2. The cross-marketplace dependency lives on a new dependency-only plugin, `rf-stack` + +`plugins/rf-stack/.claude-plugin/plugin.json` declares `["rf-core", "robotcode@robotframework-agent-plugins"]` as bare strings. `marketplace.json` gets `allowCrossMarketplaceDependenciesOn: ["robotframework-agent-plugins"]`. `catalog.yaml` has `agents: [claude-code]`. + +The simulations decided this; see the Context table. Rejected alternatives: +- **(a) dependency on `rf-core`:** it takes down all Robot Framework content where upstream is blocked, including installs that existed before the policy arrived; +- **(c) dependency on the technology plugins:** it moves the same failure to the library skills; +- **in the marketplace entry:** a missing upstream then refuses the whole install; +- **(d) re-list robotcode in our marketplace (`git-subdir` source pinned by `sha`):** this works under an ours-only allowlist, and it is the only one-command install. We don't take it, because it fetches third-party content past what an admin approved, and it makes us re-pin and vouch for upstream on every release. Raise it with the RobotCode maintainer as a future joint option. + +No version range is used, because upstream's marketplace entry has no `version` (raised upstream: https://github.com/robotcodedev/robotframework-agent-plugins/issues/2). The ≥ 2.8 check stays on the CLI, in the session report. + +### D3. Copilot CLI gets the notice on the first edit + +Copilot CLI 1.0.91 passes no SessionStart output to the model, but it does pass the PostToolUse `decision`/`reason`. The validation hook therefore sends the robotcode notice once per session on the first `.robot`/`.resource` edit. On Copilot the reason starts with "The edit was applied." to keep the agent from reverting it. On the other agents the same once-per-session notice goes through D1's channel as context, not as a block. The `reason` channel is used only on Copilot. + +**Alternative: the `userPromptSubmitted` additionalContext.** Not used: the README records that Copilot passes only `decision`/`reason`. Re-test it in task 7, and switch if it works. + +### D4. Readiness is checked from installed distributions + +One Python call in the resolved interpreter reads `importlib.metadata` for `robotcode`, `robotcode-runner`, `robotcode-analyze`, `robotcode-repl` and `robotframework-robocop`, and their versions. That is fast enough for the 15-second SessionStart budget, and it parses no robotcode output. The validation hook additionally treats `Error: No such command` from `robotcode analyze code` as "extra missing" (D3/D5 notice), not as a silent no-op. + +**Alternative: run `robotcode --help` and parse the command list.** Rejected: it is slower, and the help format is not an interface. + +### D5. The package manager is read from project files + +From the project root, in this order: `uv.lock` or `[tool.uv]`, then `poetry.lock` or `[tool.poetry]`, then `pdm.lock`, then `[tool.hatch]`, then a `.venv` or `VIRTUAL_ENV` (pip, plus `requirements-dev.txt` if present), else uv. One helper serves the session report, the error hints, the validation notice and the installer's `doctor`, which uses a Python port of it covered by the same fixture tests. + +### D6. Antigravity files are generated next to the Claude ones + +`build-catalog.py` writes `.antigravity-plugin/plugin.json`. `build-agent-variants.py` writes the root `hooks.json` in agy format. Event mapping: +- `SessionStart` maps to `SessionStart`; +- `PostToolUse` `Write|Edit` maps to the agy edit tools (names confirmed with `agy plugin import` on rf-core in task 6.1); +- `PostToolUse` `Bash` maps to `run_command`; +- `Stop` maps to `Stop`; +- `UserPromptSubmit` maps to `PreInvocation`, which supports `injectSteps`. + +Hook commands use paths relative to the plugin root (agy runs hooks there). The caller is recognised from agy's input (`conversationId`, `hookEventName`), so the commands set no environment variable, which wouldn't work in `cmd.exe` anyway. `UserPromptSubmit` routing runs on `PreInvocation`, which fires before every model call, so the hook injects once per prompt there. + +agy's loader rejects the Claude subagent format (`tools: Read, Grep` must be a YAML list), and `agy plugin import` copies the files unchanged, so they are skipped either way. The generator writes `variants/antigravity/agents/*.md` with list-form `tools`. The installer's `antigravity` adapter copies an assembled folder (skills, scripts, manifest, root `hooks.json`, those subagents) to `/.agents/plugins//` or `~/.gemini/config/plugins//`; agy loads both without `agy plugin install` (checked live), and the copy needs no `agy` on PATH. + +Task 6.1 findings (2026-12-01, agy 1.5.0, `agy plugin import` of rf-core, then live `agy -p` sessions): +- **Edit matcher:** `write_to_file|write_file|replace_file_content|edit_file`. Shell: `run_command`. `UserPromptSubmit` is skipped ("there is no UserPromptSubmit event"); SessionStart and Stop are converted. +- **PostToolUse input:** `toolCall: {name, args}` with `args.Path` (writes) and `args.CommandLine` (shell), `conversationId` instead of `session_id`, and **no tool output**. `_hook_input.mjs` reads this shape, and the session markers fall back to `conversationId`. The Bash error hints can't work on agy: there is no output to scan. +- **What reaches the model:** the SessionStart notice (`injectSteps`), confirmed live. PostToolUse `injectSteps` is ignored: a replayed input made `validate_robot.mjs` emit the right object, and the model saw nothing. So on agy the robotcode notice comes at session start only, and validation feedback after edits doesn't reach the model. The README says so. +- **Upstream (2026-12-01, agy 1.5.20):** `agy plugin install` now converts a Claude plugin's hooks (it didn't on 1.5.0). Both `install` and `import` still copy the subagents unchanged and report them as installed while the loader skips them; reported as https://github.com/google-antigravity/antigravity-cli/issues/2069. + +### D7. The robotcode skill fallback is opt-in, from a source the user names + +File-mode installs stay offline: adoption-reporting ("No telemetry") and installer-python-api promise it, and `tests/installer/test_no_network.py` checks it. The skill is therefore copied only with `--robotcode-source`: +- a local folder (a clone, or a checkout of an internal mirror): no network; +- a git URL (a mirror): `git clone --depth 1 --branch robotcode--v2.8.0`; +- `github`: the upstream tag's archive. + +The installer pins `ROBOTCODE_PLUGIN_TAG = "robotcode--v2.8.0"`, takes `plugins/robotcode/skills/robotcode/` plus `LICENSE` (extracting only that folder, with the same member checks as `bundle.fetch()`), and records the files in the manifest. Without the flag, it prints the commands that add the skill. A release bumps the pin after checking the new upstream tag. Nothing is committed to this repository. Decided with the maintainer on 2026-12-01; the alternatives were bundling the skill into the wheel (the build needs network, and we would re-pin every release) and fetching by default (it breaks the offline promise). + +## Risks / Trade-offs + +- **[Agents change hook semantics between versions]** → Each claim in the README names the version that was checked. Task 7 makes the live checks a release step. +- **[Antigravity's hook format is young]** → It is generated and checked with `agy plugin validate --strict` in CI when `agy` is available, and the bug in the `plugin install` conversion is reported upstream. +- **[`rf-stack` shows as an empty plugin in Copilot, Codex and Cursor]** → Its description says "Claude Code only", the catalogue marks it, and the installer skips it elsewhere. +- **[The Copilot `reason` notice reads like an error]** → It is worded as information ("The edit was applied. …"), sent once, and only on Copilot. +- **[Upstream renames the marketplace or the skill path]** → `rf-stack` then fails visibly with a named dependency, and rf-core is unaffected. The installer pin makes the skill path explicit. +- **[`--managed-settings` is a hidden SDK flag]** → It is used only for local simulation. Task 7 includes the real `/etc/claude-code/managed-settings.json` check, which the maintainer runs. + +## Migration Plan + +- Existing installs keep working: `rf-core` and the technology plugins don't change their dependencies. The README recommends `rf-stack` for new Claude Code installs. +- `installer --mode plugin` merges the upstream marketplace and `rf-stack` into an existing `.claude/settings.json` only when it runs again; `--no-robotcode` opts out. +- Rollback: remove `rf-stack` from the catalogue and the `allowCrossMarketplaceDependenciesOn` key. Nothing else depends on them. + +## Open Questions + +- Cursor: whether `additional_context` from `sessionStart` reaches the model. There is no `cursor-agent` here, so it gets checked on a machine with Cursor, and the README marks it unverified until then. This doesn't change the design: D1's helper already has the shape. +Resolved on 2026-11-24: Codex 0.162.1 honours `hookSpecificOutput.additionalContext` from a trusted plugin's `SessionStart` hook in `codex exec`, and ignores a top-level `additionalContext` or a combined object. diff --git a/openspec/changes/robotcode-install-guidance/proposal.md b/openspec/changes/robotcode-install-guidance/proposal.md new file mode 100644 index 0000000..141e5ed --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/proposal.md @@ -0,0 +1,47 @@ +# Proposal + +## Why + +The robotcode CLI (`robotcode[all]`) and the RobotCode project's `robotcode` agent plugin are the base the Robot Framework plugins build on, but agents are not guided to install them. Live checks on 2026-11-24 showed the gaps: +- The `SessionStart` environment report writes only to stderr. In Claude Code (2.1.331) the model saw nothing of it; with the same text on stdout, it saw the whole report. OpenCode's hook plugin reads only stdout JSON, so the report is lost there too. +- A base `robotcode` without `[all]` is reported as "available; errors are checked on every edit", although `analyze` and `doc` fail with `Error: No such command`. The validation hook then passes a broken file silently. +- The install advice is always `uv add`, also in venv + pip projects. +- Users have to install the `robotcode` plugin from a second marketplace by hand, on every agent. Many companies block third-party marketplaces, and the docs give them no route. + +## What Changes + +- **Hook output reaches the model on every agent that supports it.** The context hooks (environment report, prompt routing, error hints) write the JSON each agent reads, chosen by which agent is calling: `hookSpecificOutput.additionalContext` for Claude Code, Codex and OpenCode, `injectSteps` for Antigravity, and `additional_context` for Cursor. One combined object does not work: Antigravity drops output that has extra fields. The long human report stays on stderr. +- **Copilot CLI** (1.0.91) passes no `SessionStart` output to the model in any shape we tested, so the robotcode notice reaches Copilot once per session through the channel it does read (the validation hook's `decision`/`reason` on the first `.robot` edit). +- **robotcode readiness instead of presence:** the report checks for the `runner`, `analyze` and `repl` extras and Robocop, says which commands are missing, and gives the one command that fixes it. That command follows the project's package manager (uv, Poetry, PDM, Hatch, venv + pip). +- **Ask, then install:** the notice tells the agent to ask the user once, then install `robotcode[all]` into the project environment. This matches the robotcode skill's own rule and our fixed choice of `[all]`. +- **Just-in-time hints:** `robotcode: command not found` and `Error: No such command '…'` in command output get a one-time hint, and the validation hook says once that its error check is off, instead of passing silently. +- **New `rf-stack` plugin (Claude Code):** it ships no content and depends on `rf-core` and `robotcode@robotframework-agent-plugins`, so one install brings both. `rf-core` and the technology plugins stay free of the external dependency. In simulated enterprise policies, a dependency on `rf-core` disabled every Robot Framework plugin; with `rf-stack`, only `rf-stack` fails, with an error that names the fix (design.md, decision D2). This drops the `robotcode-prerequisite` rule that forbids the dependency today. +- **Enterprise and alternative install routes**, documented and checked: an internal mirror under the same marketplace name (verified to satisfy the dependency), the installer's file mode with the robotcode skill copied from a pinned tag, `npx skills add`, the RobotCode VS Code extension, and plain skill folders. +- **Antigravity CLI (`agy`)** becomes a supported agent: plugins ship an `.antigravity-plugin/plugin.json` and a root `hooks.json` in Antigravity's format, next to the Claude-format files, which the other agents ignore (checked). +- **Installation verified live** on Claude Code, Codex, OpenCode and Antigravity with a recorded checklist. + +## Capabilities + +### New Capabilities +- `hook-output-channels`: how each hook delivers model-facing text per agent (detection of the calling agent, the JSON shape per agent, the fallback where an agent has no channel), so every context hook uses one helper. +- `companion-plugin-dependency`: how the plugins declare and resolve the `robotcode` plugin across marketplaces, and the routes for environments where that marketplace is blocked. +- `antigravity-support`: Antigravity CLI as a supported agent (manifest, hooks format, install commands). + +### Modified Capabilities +- `robotcode-prerequisite`: drops "No plugin dependency on the robotcode plugin"; the session report checks extras, not just the binary; install advice follows the package manager; ask-before-install. +- `rf-session-context-hooks`: the environment report is model-facing per agent instead of stderr-only; robotcode readiness and package-manager-specific commands. +- `rf-validation-hooks`: when robotcode or its `analyze` extra is missing, the hook tells the agent once that the error check is off. +- `agent-plugin-marketplace`: the marketplace allows cross-marketplace dependencies on `robotframework-agent-plugins`, and the per-agent install docs add the second marketplace and `rf-stack`. +- `plugin-split`: a dependency-only plugin (`rf-stack`) is allowed, for Claude Code only. +- `plugin-catalogue`: the catalogue checks accept the one external dependency and the Antigravity manifest. +- `installer-plugin-bootstrap`: the installer handles the robotcode plugin or skill for each agent, including blocked-marketplace environments, and Antigravity. + +## Impact + +- **Hook scripts** in `plugins/rf-core/scripts/` (`check_rf_environment.mjs`, `maybe_inject_rf_context.mjs`, `rf_error_hints.mjs`, `validate_robot.mjs`, `_python_env.mjs`), plus a new shared output helper. +- **Generated variants:** `scripts/build-agent-variants.py`, the OpenCode hook plugin, and the new Antigravity hooks file and manifest per plugin. +- **Manifests:** `.claude-plugin/marketplace.json` (`allowCrossMarketplaceDependenciesOn`) and a new `plugins/rf-stack/`. `scripts/build-catalog.py` `content_problems()` must accept a dependency-only plugin and the one external dependency. `tests/test_robotcode_prerequisite.py` changes with the rule. +- **Installer:** adapters for the robotcode plugin or skill, and a new Antigravity adapter. +- **Docs:** README (Install, Prerequisites, a new enterprise section), the `rf-setup` skill, and CHANGELOG `## Unreleased`. +- **robotcode commands used:** `robotcode --version`, `robotcode discover info`, `robotcode analyze code` (readiness probe and validation), `robotcode doc` (presence of the `repl` extra). No new parsing of Robot Framework files. +- **Upstream:** the Antigravity bug where `agy plugin install` copies a Claude `hooks/hooks.json` into a root `hooks.json` that its own loader rejects gets reported to Antigravity. The missing `version` in the robotcode marketplace entry, which blocks version ranges, gets raised at `robotcodedev/robotframework-agent-plugins`. diff --git a/openspec/changes/robotcode-install-guidance/specs/agent-plugin-marketplace/spec.md b/openspec/changes/robotcode-install-guidance/specs/agent-plugin-marketplace/spec.md new file mode 100644 index 0000000..d29ed48 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/agent-plugin-marketplace/spec.md @@ -0,0 +1,27 @@ +# Spec Delta + +## ADDED Requirements + +### Requirement: Install docs add the robotcode companion per agent + +The per-agent install section of the README SHALL add the `robotframework-agent-plugins` marketplace and the robotcode plugin in the same block as the Robot Framework plugins, in the form each agent supports: `rf-stack` for Claude Code, one install per plugin for agents that do not resolve dependencies, and the RobotCode extension for VS Code. + +#### Scenario: Claude Code block +- **WHEN** the README's Claude Code section is read +- **THEN** it shows `claude plugin marketplace add MarketSquare/robotframework-plugins`, `claude plugin marketplace add robotcodedev/robotframework-agent-plugins` and `claude plugin install rf-stack@robotframework-plugins`, in that order + +#### Scenario: Agents without dependencies +- **WHEN** the README's Copilot CLI, Codex and Cursor sections are read +- **THEN** each adds the upstream marketplace and installs `robotcode@robotframework-agent-plugins` next to `rf-core` + +#### Scenario: VS Code +- **WHEN** the README's VS Code section is read +- **THEN** it says that the RobotCode extension already bundles the robotcode plugin + +### Requirement: The project settings example includes the companion + +The committed project-scope `.claude/settings.json` example SHALL list both marketplaces in `extraKnownMarketplaces` and enable `rf-stack`, `robotcode` and the chosen technology plugins. + +#### Scenario: Project settings example +- **WHEN** the README's project-scope settings example is parsed as JSON +- **THEN** `extraKnownMarketplaces` holds `robotframework-plugins` and `robotframework-agent-plugins`, and `enabledPlugins` holds `rf-stack@robotframework-plugins` and `robotcode@robotframework-agent-plugins` diff --git a/openspec/changes/robotcode-install-guidance/specs/antigravity-support/spec.md b/openspec/changes/robotcode-install-guidance/specs/antigravity-support/spec.md new file mode 100644 index 0000000..a1f63c6 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/antigravity-support/spec.md @@ -0,0 +1,47 @@ +# Spec Delta + +## Purpose + +Makes the Antigravity CLI (`agy`) a supported agent: the plugin files it loads, the hooks format it reads, and how users install the plugins and the robotcode companion there. + +## ADDED Requirements + +### Requirement: Plugins carry generated Antigravity files + +Every plugin with content SHALL carry a generated Antigravity manifest at `.antigravity-plugin/plugin.json`. A plugin with subagents SHALL carry them in Antigravity's format under `variants/antigravity/agents/`, and a plugin with hooks SHALL carry a root `hooks.json` in Antigravity's format. All of them SHALL be generated from the canonical files and covered by the drift check. + +#### Scenario: Hooks format +- **WHEN** rf-core's root `hooks.json` is read +- **THEN** it maps a named hook to `SessionStart`, `PreInvocation`, `PostToolUse` and `Stop`, with edits matched as `write_to_file|write_file|replace_file_content|edit_file` + +#### Scenario: Subagent format +- **WHEN** a file under `variants/antigravity/agents/` is read +- **THEN** its `tools` is a YAML list and the rest equals the canonical subagent + +#### Scenario: Validation passes +- **WHEN** `agy plugin validate --strict` runs on the folder the installer writes for rf-core +- **THEN** it reports no error, and counts the 4 rf-core skills, the 3 subagents and the hooks + +#### Scenario: Checkout loads skills and hooks +- **WHEN** `agy plugin validate plugins/rf-core` runs on the repository checkout +- **THEN** the skills and the root `hooks.json` load; the subagents, whose Claude-format `tools` string Antigravity rejects, are reported as skipped, and the README points to the installer for them + +### Requirement: Other agents ignore the Antigravity files + +Claude Code and Copilot CLI SHALL keep loading the plugin's hooks from `hooks/hooks.json` only. + +#### Scenario: Other agents unaffected +- **WHEN** rf-core with the root `hooks.json` is loaded with `claude --plugin-dir` and `copilot --plugin-dir` +- **THEN** both run only the hooks from `hooks/hooks.json` + +#### Scenario: Install from a checkout +- **WHEN** `agy plugin install /plugins/rf-core` runs +- **THEN** `agy plugin list --json` shows rf-core with its skills and hooks, and a new session in a project without robotcode receives the robotcode notice + +### Requirement: Antigravity install is documented + +The README SHALL have an Antigravity section with the commands that install rf-core, the technology plugins and the robotcode companion, the hook events that are not ported, and the admin control (`pluginControls.pluginsDisabled`, `pluginControls.marketplaceDisabled`) that can block them. + +#### Scenario: README section +- **WHEN** the README's Antigravity section is read +- **THEN** it gives the install commands, lists the hooks that are not ported, and names the version that was checked diff --git a/openspec/changes/robotcode-install-guidance/specs/companion-plugin-dependency/spec.md b/openspec/changes/robotcode-install-guidance/specs/companion-plugin-dependency/spec.md new file mode 100644 index 0000000..fdcab52 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/companion-plugin-dependency/spec.md @@ -0,0 +1,71 @@ +# Spec Delta + +## Purpose + +Defines how users get the RobotCode project's `robotcode` plugin together with the Robot Framework plugins: the dependency-only `rf-stack` plugin for Claude Code, and the documented routes for agents without dependencies and for organisations that block the upstream marketplace. + +## ADDED Requirements + +### Requirement: rf-stack installs rf-core with the robotcode plugin + +The marketplace SHALL list a plugin `rf-stack` that ships no skill, subagent or hook. Its `plugin.json` SHALL declare exactly two dependencies, `rf-core` and the bare string `robotcode@robotframework-agent-plugins`, and the marketplace manifest SHALL set `allowCrossMarketplaceDependenciesOn` to `["robotframework-agent-plugins"]`. + +#### Scenario: Default install +- **WHEN** a user adds both marketplaces and runs `claude plugin install rf-stack@robotframework-plugins` +- **THEN** the output reports `+ 2 dependencies: rf-core, robotcode`, and `claude plugin list` shows `rf-stack`, `rf-core` and `robotcode` enabled + +#### Scenario: Upstream marketplace missing +- **WHEN** only our marketplace is added and `rf-stack` is installed +- **THEN** `rf-core` is enabled, `rf-stack` reports that `robotcode@robotframework-agent-plugins` is not installed, and adding the upstream marketplace afterwards installs robotcode and enables `rf-stack` + +#### Scenario: Declared in plugin.json without a version range +- **WHEN** `plugins/rf-stack/.claude-plugin/plugin.json` and the marketplace entry are read +- **THEN** the dependencies are in `plugin.json` as bare strings, and the marketplace entry has none (a dependency there refuses the whole install when the upstream marketplace is missing; a version range fails because the upstream entry has no version) + +### Requirement: rf-stack says who it is for + +`rf-stack`'s description SHALL say that it is for Claude Code, that it needs the `robotframework-agent-plugins` marketplace, and that users whose organisation blocks it install `rf-core` instead. + +#### Scenario: Description +- **WHEN** the marketplace entry of `rf-stack` is read +- **THEN** its description names Claude Code and the `robotframework-agent-plugins` marketplace + +### Requirement: A blocked upstream marketplace leaves the Robot Framework content working + +`rf-core` and the technology plugins SHALL NOT declare a dependency outside this marketplace. When managed settings block or do not allow `robotframework-agent-plugins`, every plugin except `rf-stack` SHALL install and load. + +#### Scenario: Allowlist without upstream +- **WHEN** managed settings set `strictKnownMarketplaces` to only `MarketSquare/robotframework-plugins`, and `rf-stack` and `rf-web` are installed +- **THEN** `rf-core` and `rf-web` are enabled and only `rf-stack` fails to load + +#### Scenario: Policy arrives after install +- **WHEN** all plugins were installed and the organisation then blocks the upstream marketplace +- **THEN** `rf-core` and the technology plugins still load + +### Requirement: Routes for organisations that block the upstream marketplace are documented + +The README SHALL have a section for organisations with marketplace restrictions that gives, best first, the routes to the robotcode plugin or skill, and names the admin setting per agent where one exists. + +#### Scenario: Routes listed +- **WHEN** the section is read +- **THEN** it gives, in order: allowing `robotcodedev/robotframework-agent-plugins`; an internal mirror that keeps the marketplace name and the `robotcode--v` tags; `rf-core` plus the robotcode skill as a plain folder from a pinned tag; the RobotCode VS Code extension; and `rf-core` alone + +#### Scenario: Admin settings named +- **WHEN** the section is read +- **THEN** it names Claude Code `strictKnownMarketplaces`, Copilot enterprise managed settings, Codex `requirements.toml`, Antigravity `pluginControls` and OpenCode `policies` + +#### Scenario: Mirror satisfies the dependency +- **WHEN** a same-named mirror of `robotframework-agent-plugins` is the only allowed source besides our marketplace, and `rf-stack` is installed +- **THEN** `rf-stack`, `rf-core` and `robotcode` are enabled, with robotcode read from the mirror + +#### Scenario: Plain skill under an allowlist +- **WHEN** the robotcode skill folder is copied into the user's skills directory and the upstream marketplace is not allowed +- **THEN** a new session lists the `robotcode` skill next to the rf-core skills + +### Requirement: Agents without plugin dependencies get the companion through documented commands + +For Codex, Copilot CLI, Cursor, OpenCode and Antigravity, the README and the installer SHALL give the commands that add the robotcode plugin or skill next to rf-core. `rf-stack` SHALL be documented as Claude Code only, and the installer SHALL NOT install it for other agents or in file mode. + +#### Scenario: Installer skips rf-stack outside Claude Code +- **WHEN** `robotframework-plugins install --agent codex --plugins all` runs +- **THEN** `rf-stack` is not installed, and the output gives the commands that add the robotcode plugin for Codex diff --git a/openspec/changes/robotcode-install-guidance/specs/hook-output-channels/spec.md b/openspec/changes/robotcode-install-guidance/specs/hook-output-channels/spec.md new file mode 100644 index 0000000..da501dc --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/hook-output-channels/spec.md @@ -0,0 +1,59 @@ +# Spec Delta + +## Purpose + +Defines how the plugins' hooks deliver text to the model on each supported agent: how the calling agent is recognised, which output shape each agent reads, and the fallback where an agent reads none. + +## ADDED Requirements + +### Requirement: Model-facing hook text uses the calling agent's output shape + +Every hook that gives the model context SHALL write it to stdout as one JSON object in the shape the calling agent reads: `hookSpecificOutput.additionalContext` for Claude Code, Codex and OpenCode, `injectSteps` with a `systemMessage` for Antigravity CLI, and `additional_context` for Cursor. The hook SHALL recognise the agent from its input and environment, fall back to the Claude Code shape, and never combine shapes in one object. + +#### Scenario: Claude Code sees the environment report +- **WHEN** a Claude Code session starts with rf-core in a project that has Robot Framework but no robotcode +- **THEN** the model's context holds the robotcode notice, verified with a headless `claude -p` session that quotes it + +#### Scenario: Antigravity sees the environment report +- **WHEN** an Antigravity CLI session starts with rf-core installed in the same project +- **THEN** the hook writes `{"injectSteps": [{"systemMessage": {"systemMessage": ""}}]}` with no other top-level field, and the model's context holds the robotcode notice + +#### Scenario: OpenCode sees the environment report +- **WHEN** an OpenCode session in that project runs its first tool +- **THEN** that tool's output carries the robotcode notice + +#### Scenario: Cursor shape +- **WHEN** the hook input carries `cursor_version` +- **THEN** the hook writes `{"additional_context": ""}` + +#### Scenario: No combined object +- **WHEN** any hook writes model-facing text +- **THEN** the object has exactly one of `hookSpecificOutput`, `injectSteps` or `additional_context`, because Antigravity and Codex drop an object with fields they do not expect + +#### Scenario: Unknown caller +- **WHEN** the hook input matches no known agent +- **THEN** the hook writes the Claude Code shape and exits 0 + +### Requirement: Model-facing text never relies on stderr + +Text meant only for the person (the full environment report) MAY go to stderr. Model-facing text SHALL go to stdout, because no agent shows a hook's stderr to the model when the hook exits 0. + +#### Scenario: Report split +- **WHEN** the environment check runs in a project where robotcode is missing +- **THEN** the full report is on stderr and the short notice is JSON on stdout + +### Requirement: Agents without a session-start channel get the notice at the first edit + +For an agent that passes no `SessionStart` output to the model (Copilot CLI 1.0.91 in our checks), the robotcode notice SHALL reach the model once per session through the validation hook's `decision`/`reason` after the first `.robot` or `.resource` edit. The notice SHALL say that the edit was applied, so the agent does not undo it. + +#### Scenario: Copilot CLI first edit without robotcode +- **WHEN** Copilot CLI writes a `.robot` file in a project without robotcode +- **THEN** the hook's reason says the edit was applied, that the error check needs `robotcode[all]`, and gives the install command; a second edit in the same session does not repeat it + +### Requirement: The output channel per agent is verified and documented + +The README SHALL state, per supported agent and version, which hook text reaches the model. Each claim SHALL come from a live check that a release re-runs. + +#### Scenario: README states the channel +- **WHEN** the README's hooks section is read +- **THEN** it names, for Claude Code, Codex, Copilot CLI, VS Code Copilot, Cursor, OpenCode and Antigravity, whether the environment report reaches the model, and the agent version that was checked diff --git a/openspec/changes/robotcode-install-guidance/specs/installer-plugin-bootstrap/spec.md b/openspec/changes/robotcode-install-guidance/specs/installer-plugin-bootstrap/spec.md new file mode 100644 index 0000000..d50d1c8 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/installer-plugin-bootstrap/spec.md @@ -0,0 +1,59 @@ +# Spec Delta + +## ADDED Requirements + +### Requirement: Installer sets up the robotcode companion in plugin mode + +In plugin mode, `robotframework-plugins install` SHALL register the `robotframework-agent-plugins` marketplace and enable `robotcode@robotframework-agent-plugins` next to the Robot Framework plugins, unless `--no-robotcode` is given. Only for Claude Code SHALL it also enable `rf-stack`. With `--robotcode-source ` it SHALL register that mirror instead of GitHub. + +#### Scenario: Claude Code +- **WHEN** `install --agent claude-code --mode plugin --yes` runs in a project +- **THEN** `.claude/settings.json` registers both marketplaces and enables `rf-stack@robotframework-plugins` and `robotcode@robotframework-agent-plugins` + +#### Scenario: Copilot CLI +- **WHEN** `install --agent copilot --mode plugin --yes` runs +- **THEN** both settings files enable `robotcode@robotframework-agent-plugins` and neither enables `rf-stack` + +#### Scenario: Codex and Cursor +- **WHEN** plugin mode runs for Codex or Cursor +- **THEN** Codex gets `codex plugin marketplace add robotcodedev/robotframework-agent-plugins` and `codex plugin add robotcode@robotframework-agent-plugins` (run with `--yes`), and Cursor gets the steps printed + +#### Scenario: Mirror source +- **WHEN** `--robotcode-source https://git.example.com/mirror/robotframework-agent-plugins` is given in plugin mode for Claude Code +- **THEN** the `robotframework-agent-plugins` entry in `.claude/settings.json` uses that git URL + +#### Scenario: Opt out +- **WHEN** `--no-robotcode` is given +- **THEN** no settings file names `robotframework-agent-plugins`, `robotcode` or `rf-stack` + +### Requirement: File mode copies the robotcode skill only from a named source + +In file mode, the installer SHALL copy the `robotcode` skill, with its `LICENSE`, only when `--robotcode-source` names a local folder, a git URL or `github`, and SHALL record it in the manifest so that `uninstall` removes it. Without the flag, file mode SHALL make no network call and SHALL print the commands that add the skill. + +#### Scenario: File mode copies the skill from a local source +- **WHEN** `robotframework-plugins install --agent opencode --mode files --robotcode-source --yes` runs +- **THEN** the opencode skills directory holds `robotcode/SKILL.md` with its `LICENSE`, the manifest records it, `uninstall` removes it, and no network call is made + +#### Scenario: File mode stays offline by default +- **WHEN** `robotframework-plugins install --agent opencode --mode files --yes` runs with every network connection refused +- **THEN** the install succeeds without the robotcode skill and prints the commands that add it + +#### Scenario: Remote sources download on request +- **WHEN** `--robotcode-source github` is given +- **THEN** the skill comes from the archive of the upstream tag `robotcode--v`, and only `plugins/robotcode/` is extracted + +### Requirement: Installer reports robotcode readiness + +The installer SHALL NOT install the robotcode CLI. `install` (project scope) and `doctor` SHALL report whether `robotcode[all]>=2.8` is ready in the project environment and print the install command for the project's package manager. + +#### Scenario: Doctor reports the CLI +- **WHEN** `robotframework-plugins doctor` runs in a uv project without robotcode +- **THEN** it reports robotcode as missing and prints `uv add --dev "robotcode[all]>=2.8"` + +### Requirement: Installer supports Antigravity + +The installer SHALL have an `antigravity` agent that copies each selected plugin as an Antigravity plugin folder, `/.agents/plugins//` or `~/.gemini/config/plugins//`, with its subagents in Antigravity's format, recorded in the manifest. It SHALL need no `agy` on PATH. + +#### Scenario: Antigravity install +- **WHEN** `robotframework-plugins install --agent antigravity --plugins rf-core --yes` runs in a project +- **THEN** `.agents/plugins/rf-core/` passes `agy plugin validate --strict` with 4 skills, 3 subagents and 1 hook, a new `agy` session there receives the robotcode notice and lists the `rf-` subagents, and `uninstall` removes the folder diff --git a/openspec/changes/robotcode-install-guidance/specs/plugin-catalogue/spec.md b/openspec/changes/robotcode-install-guidance/specs/plugin-catalogue/spec.md new file mode 100644 index 0000000..ae25829 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/plugin-catalogue/spec.md @@ -0,0 +1,23 @@ +# Spec Delta + +## ADDED Requirements + +### Requirement: The catalogue knows which agents a plugin serves + +`catalog.yaml` SHALL accept an optional `agents` list. A plugin that lists `agents` SHALL be offered only to those agents: the generated catalogue names them, and the installer skips the plugin for other agents and in file mode. `rf-stack` SHALL list `[claude-code]`. + +#### Scenario: Catalogue names the agent +- **WHEN** `docs/catalog.md` is generated +- **THEN** the `rf-stack` row says it is for Claude Code and that it brings `rf-core` and the robotcode plugin + +#### Scenario: Dependency-only plugin checked +- **WHEN** a dependency-only plugin's `plugin.json` names a marketplace other than `robotframework-agent-plugins`, or a version range +- **THEN** `python scripts/build-catalog.py --check` fails and names the entry + +### Requirement: Generated manifests include the Antigravity files + +`scripts/build-catalog.py` SHALL generate each content plugin's `.antigravity-plugin/plugin.json`, with the same name, version, description and author as its Claude manifest, and `--check` SHALL fail when it is stale. + +#### Scenario: Version stamp +- **WHEN** the release version changes and `python scripts/build-catalog.py` runs +- **THEN** every `.antigravity-plugin/plugin.json` carries the new version diff --git a/openspec/changes/robotcode-install-guidance/specs/plugin-split/spec.md b/openspec/changes/robotcode-install-guidance/specs/plugin-split/spec.md new file mode 100644 index 0000000..fbe24db --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/plugin-split/spec.md @@ -0,0 +1,23 @@ +# Spec Delta + +## MODIFIED Requirements + +### Requirement: The content is split into a core and technology plugins + +The catalogue SHALL contain `rf-core`, `rf-web`, `rf-api`, `rf-mobile`, `rf-desktop` and `rf-stack`, and every skill and subagent SHALL belong to exactly one of them. A technology plugin SHALL NOT be added without content and at least one maintainer. `rf-stack` is the one dependency-only plugin, listed for Claude Code only. + +#### Scenario: Content per plugin +- **WHEN** the plugins' skill, subagent and hook folders are listed +- **THEN** `rf-core` holds `rf-language`, `rf-bdd`, `rf-setup`, `rf-python-library`, the three subagents and all hooks; `rf-web` holds `rf-browser` and `rf-selenium`; `rf-api` holds `rf-requests` and `rf-restinstance`; `rf-mobile` holds `rf-appium`; `rf-desktop` holds `rf-platynui`; `rf-stack` holds nothing and depends on `rf-core` and `robotcode@robotframework-agent-plugins` + +#### Scenario: Every skill has one home +- **WHEN** the skill directories of all plugins are listed +- **THEN** the ten skills appear once each, in the plugins "Content per plugin" names + +#### Scenario: Empty plugin refused +- **WHEN** a PR adds `plugins/rf-database/` with a `catalog.yaml` but no skill, subagent or hook +- **THEN** the catalogue check fails and says a plugin needs content + +#### Scenario: rf-stack accepted without content +- **WHEN** the catalogue check runs on `plugins/rf-stack/`, which has a `catalog.yaml` and a `plugin.json` with the two dependencies and no other content +- **THEN** the check passes diff --git a/openspec/changes/robotcode-install-guidance/specs/rf-session-context-hooks/spec.md b/openspec/changes/robotcode-install-guidance/specs/rf-session-context-hooks/spec.md new file mode 100644 index 0000000..f3e1335 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/rf-session-context-hooks/spec.md @@ -0,0 +1,42 @@ +# Spec Delta + +## MODIFIED Requirements + +### Requirement: Environment report follows rf-setup + +The `SessionStart` environment report SHALL NOT recommend `rfbrowser init`, and SHALL recommend `pip install` only into a project's own venv. For missing packages it SHALL refer to `rf-setup` and show the project's install command. It SHALL state whether robotcode and Robocop are ready and which advice on edit depends on them, using the validation hooks' interpreter resolution. + +#### Scenario: Missing robocop is reported with its effect +- **WHEN** the session starts in a uv project whose environment has Robot Framework but neither robotcode nor Robocop +- **THEN** the report lists robotcode as not installed, states that the error check, deprecation and formatting advice on edit are disabled, shows `uv add --dev "robotcode[all]>=2.8"`, and points to `rf-setup` +- **AND** the model-facing notice carries the same command + +#### Scenario: Robocop comes with robotcode +- **WHEN** Robocop is missing +- **THEN** the fix shown is the `robotcode[all]` command, not a separate Robocop install + +#### Scenario: Two parts +- **WHEN** something is missing +- **THEN** the full report goes to stderr, and a model-facing notice of at most 600 characters goes out through the calling agent's output channel + +#### Scenario: Nothing missing +- **WHEN** the project environment has Robot Framework and `robotcode[all]` 2.8 or later +- **THEN** the model-facing output is at most one line, and the full report still goes to stderr + +## ADDED Requirements + +### Requirement: robotcode failures in command output get a one-time hint + +The Bash `PostToolUse` error-hint hook SHALL recognise a missing robotcode and a robotcode without the needed extra in command output, and inject one hint per kind per session (at most 400 characters) through the calling agent's output channel. It SHALL never block. + +#### Scenario: robotcode not installed +- **WHEN** a Bash command's output contains `robotcode: command not found` or `No module named robotcode` +- **THEN** the hook injects a hint that robotcode is not installed in the project environment, to ask the user, and the project's install command for `robotcode[all]` (rf-setup) + +#### Scenario: Missing extra +- **WHEN** a Bash command's output contains `Error: No such command 'doc'.` +- **THEN** the hook injects a hint that names the missing extra, the project's install command for `robotcode[all]`, and says not to retry other spellings + +#### Scenario: Once per session +- **WHEN** the same output appears again in the session +- **THEN** no second hint is injected diff --git a/openspec/changes/robotcode-install-guidance/specs/rf-validation-hooks/spec.md b/openspec/changes/robotcode-install-guidance/specs/rf-validation-hooks/spec.md new file mode 100644 index 0000000..03af5c4 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/rf-validation-hooks/spec.md @@ -0,0 +1,45 @@ +# Spec Delta + +## MODIFIED Requirements + +### Requirement: Graceful degradation when tooling is absent + +Every validation tier SHALL degrade to a silent no-op, never breaking the session, when its tool or a Python interpreter is unavailable, its output cannot be parsed, or it times out. The one exception is the once-per-session notice of "A disabled error check is announced once". A tool crash or unparsable output SHALL NOT count as a finding, and no tier SHALL block. + +#### Scenario: Robocop tiers run without robotcode +- **WHEN** a `.robot` file is written, robotcode is absent and Robocop is available +- **THEN** the Robocop advisory tiers still run, and no tier blocks + +#### Scenario: Robocop not installed +- **WHEN** a `.robot` file is written and Robocop is not installed in the resolved Python environment +- **THEN** the deprecation and formatting tiers are skipped, the robotcode tier still runs, and no failure is caused by the missing Robocop + +#### Scenario: robotcode not installed +- **WHEN** a `.robot` file with an unterminated `FOR` loop is written and robotcode is not installed in the resolved Python environment +- **THEN** the hook exits `0`, the agent's workflow is uninterrupted, and the only model-facing output is the once-per-session notice + +#### Scenario: No Python interpreter available +- **WHEN** no usable Python interpreter can be resolved +- **THEN** the hook exits `0` silently + +#### Scenario: Unparsable Robocop output +- **WHEN** Robocop exits non-zero but prints nothing the hook can parse as a finding +- **THEN** that tier adds no model-facing output + +#### Scenario: Unparsable robotcode output +- **WHEN** `robotcode analyze code` exits non-zero but prints nothing the hook can parse as a diagnostic +- **THEN** the hook exits `0` with no model-facing output + +## ADDED Requirements + +### Requirement: A disabled error check is announced once + +When the robotcode tier cannot run because robotcode is missing, older than 2.8 or lacks the `analyze` extra, the hook SHALL tell the model once per session that the edit was applied but not checked for errors, with the project's install command. It SHALL exit 0 and SHALL NOT present the notice as an error in the file. + +#### Scenario: Base robotcode without extras +- **WHEN** a `.robot` file with an unterminated `FOR` loop is written in a project where only the base `robotcode` 2.8 package is installed +- **THEN** the hook exits 0 and the model receives one notice that the error check is off because `robotcode[all]` is missing, with the install command; the next edit in the session produces no notice + +#### Scenario: Timeouts stay silent +- **WHEN** robotcode is ready but `robotcode analyze code` times out +- **THEN** the hook exits 0 with no model-facing output diff --git a/openspec/changes/robotcode-install-guidance/specs/robotcode-prerequisite/spec.md b/openspec/changes/robotcode-install-guidance/specs/robotcode-prerequisite/spec.md new file mode 100644 index 0000000..52ac52a --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/specs/robotcode-prerequisite/spec.md @@ -0,0 +1,73 @@ +# Spec Delta + +## REMOVED Requirements + +### Requirement: No plugin dependency on the robotcode plugin + +**Reason**: The robotcode plugin is the base the Robot Framework plugins build on, and Claude Code can now install it as a cross-marketplace dependency. The new `rf-stack` plugin carries that dependency. + +**Migration**: Replaced by "Only rf-stack depends outside the marketplace" below and by the `companion-plugin-dependency` capability. `rf-core` and the technology plugins keep loading without the robotcode marketplace. + +## ADDED Requirements + +### Requirement: Only rf-stack depends outside the marketplace + +Of the plugins in this marketplace, only `rf-stack` SHALL declare a dependency outside it: the bare string `robotcode@robotframework-agent-plugins`. Every other dependency SHALL name a plugin of this marketplace by bare name, without a version range, and no other manifest SHALL point outside this marketplace. + +#### Scenario: Manifests checked +- **WHEN** every `plugin.json` and `marketplace.json` in the repository is parsed +- **THEN** the only entry naming another marketplace is `robotcode@robotframework-agent-plugins` in `plugins/rf-stack/.claude-plugin/plugin.json`, and `allowCrossMarketplaceDependenciesOn` equals `["robotframework-agent-plugins"]` + +#### Scenario: Other manifests +- **WHEN** the Codex, Copilot, Antigravity and Open Plugins manifests are read +- **THEN** none has a field that points outside this marketplace + +#### Scenario: rf-core loads without the robotcode marketplace +- **WHEN** `rf-core` is installed in Claude Code in an isolated home where the `robotframework-agent-plugins` marketplace was never added +- **THEN** the install succeeds and its skills, subagents and hooks are listed + +### Requirement: Install advice follows the project's package manager + +Wherever the plugins tell an agent how to install or upgrade robotcode, the command SHALL match the project's package manager (uv, Poetry, PDM, Hatch, or pip into the project venv; uv when nothing is found). The advice SHALL tell the agent to ask the user before installing, and SHALL NOT recommend `uvx`, `pipx` or `uv tool`. + +#### Scenario: venv + pip project +- **WHEN** a session starts in a project with a `.venv`, a `requirements-dev.txt` and no lock file, and robotcode is missing +- **THEN** the notice gives `pip install "robotcode[all]>=2.8"` for that venv and says to add it to `requirements-dev.txt`, and contains no `uv add` + +#### Scenario: Poetry project +- **WHEN** the project has `poetry.lock` +- **THEN** the notice gives `poetry add --group dev "robotcode[all]>=2.8"` + +#### Scenario: uv, PDM and Hatch projects +- **WHEN** the project has `uv.lock` (or `[tool.uv]`), `pdm.lock`, or `[tool.hatch]` in `pyproject.toml` +- **THEN** the notice gives `uv add --dev "robotcode[all]>=2.8"`, `pdm add -dG dev "robotcode[all]>=2.8"`, or the instruction to add `robotcode[all]>=2.8` to the Hatch environment's dependencies + +#### Scenario: Nothing found +- **WHEN** the project has no lock file, tool section or venv +- **THEN** the notice gives the uv command and points to `rf-setup` + +## MODIFIED Requirements + +### Requirement: Session start reports robotcode availability + +The `SessionStart` environment report SHALL say whether robotcode is ready in the project environment: version 2.8 or later with the `runner`, `analyze` and `repl` extras and Robocop. When it is not, a notice of at most 600 characters SHALL reach the model through the calling agent's output channel. The report SHALL never block the session. + +#### Scenario: robotcode missing +- **WHEN** a session starts in a Robot Framework project whose environment has Robot Framework but no robotcode +- **THEN** the model-facing notice states that robotcode is not installed, that keyword lookup, result analysis and the error check on edit need it, says to ask the user, and gives the install command for the project; the hook exits 0 + +#### Scenario: robotcode without extras +- **WHEN** the project environment has the base `robotcode` 2.8 package without extras +- **THEN** the notice says robotcode lacks the `runner`, `analyze` and `repl` extras and Robocop, and gives the command that installs `robotcode[all]`; it does not say that errors are checked on edit + +#### Scenario: robotcode too old +- **WHEN** the project environment has robotcode 2.7 +- **THEN** the notice states that 2.8 or later is required (for `robotcode doc`) and shows the upgrade command + +#### Scenario: Companion named when absent +- **WHEN** robotcode is not ready and the robotcode plugin or skill is not installed for any agent on the machine +- **THEN** the notice also names `robotcode@robotframework-agent-plugins` and `rf-setup` + +#### Scenario: robotcode ready +- **WHEN** the project environment has `robotcode[all]` 2.8 or later +- **THEN** the model-facing text is at most one line, and contains no install command diff --git a/openspec/changes/robotcode-install-guidance/tasks.md b/openspec/changes/robotcode-install-guidance/tasks.md new file mode 100644 index 0000000..e9d9b44 --- /dev/null +++ b/openspec/changes/robotcode-install-guidance/tasks.md @@ -0,0 +1,76 @@ +# Tasks + +## 1. Per-agent hook output (D1) + +- [x] 1.1 Add `plugins/rf-core/scripts/_hook_output.mjs` with caller detection and the shapes from design D1. Unit tests in `plugins/rf-core/tests/` must cover: an Antigravity input (`conversationId`, `hookEventName`) gives an `injectSteps` object with no other top-level key; a Cursor input (`cursor_version`) gives `additional_context`; a Claude input gives `hookSpecificOutput`; malformed input gives the Claude shape and exit 0. Verify with `python -m pytest plugins/rf-core/tests -k hook_output -v`. +- [x] 1.2 Switch `check_rf_environment.mjs`, `maybe_inject_rf_context.mjs` and `rf_error_hints.mjs` to the helper. The full report stays on stderr, and the model-facing notice is ≤ 600 characters. Verify: the existing hook tests pass, and a new test asserts that the SessionStart stdout of a project without robotcode parses as JSON with the notice. +- [x] 1.3 Make `build-agent-variants.py` set `RF_HOOK_AGENT=opencode` in the OpenCode hook plugin, and regenerate the variants. Verify: `python scripts/build-agent-variants.py --check` and `bash scripts/check-drift.sh` pass, and the variant test sees the notice in the first tool output. + +## 2. robotcode readiness and install advice (D4, D5) + +- [x] 2.1 Add the readiness probe (distributions `robotcode`, `robotcode-runner`, `robotcode-analyze`, `robotcode-repl`, `robotframework-robocop`) to `_python_env.mjs`. Verify with fixture venvs in tests: none, base `robotcode` 2.8, `robotcode[all]` 2.8, `robotcode` 2.7. Each must report the right state, and base 2.8 must no longer say "errors are checked on every edit". +- [x] 2.2 Add package-manager detection (uv, Poetry, PDM, Hatch, venv + pip, fallback). Verify: a table-driven test over fixture projects returns the command from the `robotcode-prerequisite` table, and the venv + pip fixture produces no `uv add`. +- [x] 2.3 Rewrite the robotcode part of `check_rf_environment.mjs`: readiness, the project's command, "ask the user before installing", `rf-setup`, and the companion plugin when it is not installed for the current agent. Verify against the scenarios "robotcode missing", "robotcode without extras", "robotcode too old" and "robotcode ready" in `plugins/rf-core/tests`. +- [x] 2.4 Update the `rf-setup` skill and the README Prerequisites section with the PDM and Hatch forms and the ask-first rule. Verify: `python scripts/validate-skills.py --channel all`, `python -m pytest tests/test_robotcode_prerequisite.py -v` and `python scripts/check-docs-voice.py` pass. + +## 3. Hints and the validation notice (D3) + +- [x] 3.1 Add the `robotcode: command not found` / `No module named robotcode` and `Error: No such command ''` kinds to `rf_error_hints.mjs`, once per session each. Verify against the scenarios "Missing extra" and "Once per session". +- [x] 3.2 In `validate_robot.mjs`, treat missing robotcode, version < 2.8 or `No such command 'analyze'` as a disabled check: send the once-per-session notice through `_hook_output.mjs`, and on Copilot (`RF_HOOK_AGENT=copilot` or detected input) through `decision`/`reason`, starting with "The edit was applied." Verify against "Base robotcode without extras" and "Copilot CLI first edit without robotcode" with recorded hook inputs, and confirm the unparsable-output scenarios still give no output. +- [x] 3.3 Update the README hooks section with a channel table per agent and version (Claude Code, Codex, Copilot CLI, VS Code Copilot, Cursor, OpenCode, Antigravity), marking unverified cells. Verify: the README test asserts the table names all seven agents, and `python scripts/check-docs-voice.py` passes. + +## 4. rf-stack and the cross-marketplace dependency (D2) + +- [x] 4.1 Add `plugins/rf-stack/` (`catalog.yaml` with `agents: [claude-code]`, `.claude-plugin/plugin.json` with `["rf-core", "robotcode@robotframework-agent-plugins"]`, `README.md`). Verify: `claude plugin validate plugins/rf-stack` passes. +- [x] 4.2 Extend `scripts/build-catalog.py`: accept the dependency-only plugin and the one external dependency, emit `allowCrossMarketplaceDependenciesOn`, support `agents` in `catalog.yaml`, refuse other marketplaces and version ranges. Regenerate. Verify: `python scripts/build-catalog.py --check` passes, and new tests cover "rf-stack accepted without content", "Empty plugin refused" and "Dependency-only plugin checked". +- [x] 4.3 Replace `test_manifests_declare_no_plugin_dependency` in `tests/test_robotcode_prerequisite.py` with the "Manifests checked" scenario. Verify with `python -m pytest tests/test_robotcode_prerequisite.py tests/test_marketplace_validation.py -v`. +- [x] 4.4 Add a test script `tests/live/claude_dependency.sh` that replays the D2 simulations against an isolated `CLAUDE_CONFIG_DIR`, using a throwaway marketplace built from the working tree: default install, upstream missing then added, ours-only allowlist and upstream blocklist via `--managed-settings`, and a same-named mirror. Verify: the script prints the expected `claude plugin list` states for each case and exits 0. +- [x] 4.5 README: update the Claude Code block and the project-scope `settings.json` example, add `robotcode` installs to the Copilot CLI, Codex and Cursor blocks, and add the section "Organisations that restrict marketplaces" with the five routes and the admin setting per agent. Add `rf-stack` under `## Unreleased` in CHANGELOG. Verify: the README tests for "Claude Code block" and "Project settings example" pass, and `python scripts/check-docs-voice.py` and `python scripts/check-governance.py` pass. + +## 5. Installer: robotcode companion and doctor (D7) + +- [x] 5.1 Add `--no-robotcode` and `--robotcode-source`. In plugin mode, Claude Code gets the upstream marketplace entry and `rf-stack` + `robotcode` merged into settings; Codex, Copilot CLI and Cursor get the printed (or, with `--yes`, run) upstream commands. Skip `rf-stack` for other agents and in file mode. Verify: installer tests for "Mirror source" and "Installer skips rf-stack outside Claude Code". +- [x] 5.2 In file mode, copy the robotcode skill and `LICENSE` only with `--robotcode-source ` (design D7); record them in the manifest, remove them on uninstall, and without the flag print the commands that add the skill. Verify: a test against a local fixture repo covers "File mode copies the skill from a local source" with sockets blocked, `test_no_network.py` still passes ("File mode stays offline by default"), and uninstall leaves no `robotcode/` folder. +- [x] 5.3 Make `install` and `doctor` report robotcode readiness with the package-manager command (Python port of D5, sharing the fixture table with 2.2). Verify: the "Doctor reports the CLI" test passes, and `uv run pytest tests/installer -v` is green. + +## 6. Antigravity support (D6) + +- [x] 6.1 Run `agy plugin import` on a copy of rf-core, and record in design D6 the agy tool names its converted `PostToolUse` matchers use for edits and shell. Verify: design D6 names the edit tools, and the copy is removed with `agy plugin uninstall`. +- [x] 6.2 Generate `.antigravity-plugin/plugin.json` (`build-catalog.py`) and the agy-format root `hooks.json` (`build-agent-variants.py`) for each content plugin. Hooks run with relative paths and `RF_HOOK_AGENT=antigravity`. Verify: `agy plugin validate plugins/rf-core --strict --json` reports no error, `--check` modes pass, and `claude --plugin-dir` / `copilot --plugin-dir` still run only `hooks/hooks.json` (scenario "Other agents unaffected"). +- [x] 6.3 Add the installer `antigravity` adapter: copy the assembled plugin folder (design D6) to `.agents/plugins//` or `~/.gemini/config/plugins//`, manifest-tracked. Verify: adapter tests for both scopes and uninstall; the written folder passes `agy plugin validate --strict` when `agy` is available; the "Antigravity install" scenario run live in 7.3. +- [x] 6.4 README Antigravity section (install, ported and not-ported hooks, `pluginControls`, version checked). Report the `agy plugin install` hooks-conversion bug upstream and link it in the section. Verify: `python scripts/check-docs-voice.py` passes and the section names the issue link. + +## 7. Live verification across agents + +Run each in a scratch project with Robot Framework in `.venv` and no robotcode, then again after the agent installed `robotcode[all]`. Record the agent version, command and observed result in `docs/ci/live-agent-checks.md`. + +- [x] 7.1 Claude Code: `claude --plugin-dir plugins/rf-core -p "Quote any robotcode notice in your context"` shows the notice. `tests/live/claude_dependency.sh` passes. A task prompt ("check the arguments of Should Be Equal As Numbers, then run the suite") ends with the agent asking to install, then running the project's command. Verify: the results are recorded in the doc. +- [x] 7.2 Codex (needs the maintainer, see below): with rf-core installed from the working tree, a `codex exec` run quotes the notice. The channel itself was confirmed on 2026-11-24 with a probe (`hookSpecificOutput` seen; top-level and combined not), so a miss here points at the rf-core install or hook trust. Verify: the result is recorded in `docs/ci/live-agent-checks.md`. +- [x] 7.3 Antigravity: `robotframework-plugins install --agent antigravity --plugins rf-core --yes`, then `agy -p "Quote any robotcode notice in your context"` shows it, and `uninstall` removes the plugin. Verify: the results are recorded. +- [x] 7.4 OpenCode: install with `robotframework-plugins install --agent opencode --mode files --yes`; `opencode run` with one shell command shows the notice in the tool output; the robotcode skill is listed. Verify: the results are recorded. +- [x] 7.5 Copilot CLI: `copilot --plugin-dir plugins/rf-core -p "Create tests/a.robot with one test, then tell me any notice you received"` reports the "edit was applied" notice once. Also re-test `userPromptSubmitted` additionalContext (design D3). Verify: the results are recorded. +- [x] 7.6 Raise upstream: the missing `version` in the `robotcode` marketplace entry (blocks version ranges) at `robotcodedev/robotframework-agent-plugins`. Verify: the issue link is in design D2. +- [x] 7.7 Shorten the requirements that `openspec validate --strict` flags as over 500 characters (move detail into scenarios). Verify: `openspec validate robotcode-install-guidance --strict` reports no issues, and all checks in AGENTS.md pass. + +## Commands the maintainer runs + +These need a person: an interactive trust step, or root. + +```bash +# 7.2 Codex: trust the plugin hooks once (interactive), then check +codex plugin marketplace add "$PWD" # from a checkout of this branch +codex plugin add rf-core@robotframework-plugins +codex # in the TUI: /hooks -> trust rf-core's hooks, then quit +cd && codex exec "Quote any robotcode notice in your context, or say NONE" + +# Real managed-settings check (D2 risk): applies to all your sessions while present +sudo mkdir -p /etc/claude-code +echo '{"strictKnownMarketplaces":[{"source":"github","repo":"MarketSquare/robotframework-plugins"}]}' \ + | sudo tee /etc/claude-code/managed-settings.json +CLAUDE_CONFIG_DIR=/tmp/cc-ent claude plugin marketplace add robotcodedev/robotframework-agent-plugins # expect: blocked by enterprise policy +sudo rm /etc/claude-code/managed-settings.json +``` + +## Workflow follow-up + +- After the PR merges, archive the change with `openspec archive robotcode-install-guidance`. diff --git a/plugins/rf-api/.antigravity-plugin/plugin.json b/plugins/rf-api/.antigravity-plugin/plugin.json new file mode 100644 index 0000000..def6d95 --- /dev/null +++ b/plugins/rf-api/.antigravity-plugin/plugin.json @@ -0,0 +1,10 @@ +{ + "name": "rf-api", + "version": "5.1.0", + "description": "RequestsLibrary and RESTinstance skills for Robot Framework API tests.", + "author": { + "name": "manykarim" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins" +} diff --git a/plugins/rf-core/.antigravity-plugin/plugin.json b/plugins/rf-core/.antigravity-plugin/plugin.json new file mode 100644 index 0000000..aba34ff --- /dev/null +++ b/plugins/rf-core/.antigravity-plugin/plugin.json @@ -0,0 +1,10 @@ +{ + "name": "rf-core", + "version": "5.1.0", + "description": "Robot Framework syntax, environment setup, Python keyword libraries, test design, debugging and migration subagents, and the validation hooks. Needed by every other Robot Framework plugin.", + "author": { + "name": "manykarim" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins" +} diff --git a/plugins/rf-core/hooks.json b/plugins/rf-core/hooks.json new file mode 100644 index 0000000..ac2a17e --- /dev/null +++ b/plugins/rf-core/hooks.json @@ -0,0 +1,47 @@ +{ + "rf-core": { + "PostToolUse": [ + { + "matcher": "write_to_file|write_file|replace_file_content|edit_file", + "hooks": [ + { + "type": "command", + "command": "node \"./scripts/validate_robot.mjs\"", + "timeout": 60 + } + ] + } + ], + "PreInvocation": [ + { + "type": "command", + "command": "node \"./scripts/maybe_inject_rf_context.mjs\"", + "timeout": 15 + } + ], + "SessionStart": [ + { + "type": "command", + "command": "node \"./scripts/check_rf_environment.mjs\"", + "timeout": 15 + } + ], + "Stop": [ + { + "type": "command", + "command": "node \"./scripts/report_pending_errors.mjs\"", + "timeout": 60 + }, + { + "type": "command", + "command": "node \"./scripts/maybe_remind_robot_tests.mjs\"", + "timeout": 60 + }, + { + "type": "command", + "command": "node \"./scripts/validate_robot_project.mjs\"", + "timeout": 60 + } + ] + } +} diff --git a/plugins/rf-core/hooks/README.md b/plugins/rf-core/hooks/README.md index a30b033..57cb01d 100644 --- a/plugins/rf-core/hooks/README.md +++ b/plugins/rf-core/hooks/README.md @@ -231,6 +231,8 @@ After every Bash command it scans the output (first 20 000 characters) for Robot | `Invalid argument syntax '…'` | typed arguments `${count: int}` need RF 7.3+ (rf-language) | | `Resolving variable '…' failed` | scope, import order, `$var` in expressions (rf-language) | | `Importing library '…' failed` | install into the project environment (rf-setup) | +| `robotcode: command not found`, `No module named robotcode` | robotcode is missing: ask the user, then install `robotcode[all]` with the project's command (rf-setup) | +| `Error: No such command '…'` from robotcode | robotcode lacks that extra: install `robotcode[all]`; don't retry other spellings | It never blocks. It always exits 0, and unrelated or malformed input produces no output. @@ -323,14 +325,22 @@ is a shipped skill or subagent. ## What `check_rf_environment.mjs` reports At `SessionStart` it reports the Robot Framework version and interpreter -(same resolution as above, from the event's `cwd`), the robotcode version — -without robotcode (or below 2.8) the error check on edit is disabled, and it -names the robotcode plugin as the recommended companion — whether Robocop is +(same resolution as above, from the event's `cwd`), whether robotcode is ready — +version 2.8 or later with the `runner`, `analyze` and `repl` extras, read from the +installed distributions; without them the error check on edit is disabled — whether +the robotcode plugin is installed (recommended companion), whether Robocop is available (deprecation and formatting advice), and which library packages are -importable. For missing packages it shows project-environment commands -(`uv add …`, `uv add --dev "robotcode[all]"`) and points to the rf-setup skill; it never -recommends `pip install` or a library's post-install step. A missing, empty or malformed -event produces no output; it always exits 0. +importable. The install command follows the project's package manager +(`_install_advice.mjs`: uv, Poetry, PDM, Hatch, or pip into the project venv) and it +points to the rf-setup skill; it never recommends `uvx`, `pipx` or a library's +post-install step. + +The full report goes to stderr, for you. When Robot Framework is installed and +robotcode is not ready, a short notice (at most 600 characters) goes to stdout as +JSON in the calling agent's shape (`_hook_output.mjs`), because no agent shows a +hook's stderr to the model on exit 0. It says what is missing, gives the command and +tells the agent to ask you before installing. When robotcode is ready, stdout stays +empty. A missing, empty or malformed event produces no output; it always exits 0. ## How `maybe_remind_robot_tests.mjs` decides diff --git a/plugins/rf-core/scripts/_hook_input.mjs b/plugins/rf-core/scripts/_hook_input.mjs index 1d25880..6d111df 100644 --- a/plugins/rf-core/scripts/_hook_input.mjs +++ b/plugins/rf-core/scripts/_hook_input.mjs @@ -10,6 +10,9 @@ // multi_replace_string_in_file: tool_input.replacements[].filePath // apply_patch: tool_input.input (patch text); run_in_terminal // Codex apply_patch: tool_input.command (patch text); Bash +// Antigravity CLI toolCall.name write_file|write_to_file|replace_file_content|edit_file, +// toolCall.args.Path / TargetFile; run_command: toolCall.args.CommandLine +// (observed 2026-12-01, agy 1.5.0) // // VS Code ignores matchers in Claude-format hooks and runs every command for // every tool, so callers must check `isEdit` / `isShell` and exit quietly. @@ -17,8 +20,8 @@ import { readFileSync } from "node:fs"; import { isAbsolute, resolve } from "node:path"; const EDIT_TOOLS = - /^(write|edit|multiedit|apply_patch|create_file|replace_string_in_file|multi_replace_string_in_file|insert_edit_into_file|edit_file|edit_notebook_file|create)$/i; -const SHELL_TOOLS = /^(bash|shell|run_in_terminal|powershell|exec_command|local_shell)$/i; + /^(write|edit|multiedit|apply_patch|create_file|replace_string_in_file|multi_replace_string_in_file|insert_edit_into_file|edit_file|edit_notebook_file|create|write_file|write_to_file|replace_file_content|multi_replace_file_content)$/i; +const SHELL_TOOLS = /^(bash|shell|run_in_terminal|powershell|exec_command|local_shell|run_command)$/i; const PATCH_FILE_RE = /^\*\*\* (?:Add File|Update File|Move to): (.+)$/; function parseJson(text) { @@ -59,8 +62,8 @@ function patchText(toolInput) { export function normalizeHookInput(event) { const empty = { event: null, tool: "", isEdit: false, isShell: false, files: [], command: "", cwd: process.cwd() }; if (!event || typeof event !== "object") return empty; - const tool = String(event.tool_name ?? event.toolName ?? ""); - let toolInput = event.tool_input ?? event.toolArgs ?? {}; + const tool = String(event.tool_name ?? event.toolName ?? event.toolCall?.name ?? ""); + let toolInput = event.tool_input ?? event.toolArgs ?? event.toolCall?.args ?? {}; if (typeof toolInput === "string") toolInput = parseJson(toolInput) ?? toolInput; const cwd = String(event.cwd || process.cwd()); @@ -68,7 +71,7 @@ export function normalizeHookInput(event) { const patch = patchText(toolInput); raw.push(...patchFiles(patch)); if (toolInput && typeof toolInput === "object") { - for (const key of ["file_path", "filePath"]) { + for (const key of ["file_path", "filePath", "Path", "TargetFile", "AbsolutePath"]) { if (typeof toolInput[key] === "string") raw.push(toolInput[key]); } if (Array.isArray(toolInput.replacements)) { @@ -81,7 +84,8 @@ export function normalizeHookInput(event) { // No tool name (legacy TOOL_INPUT, Cursor afterFileEdit): a file path means an edit. const isEdit = tool ? EDIT_TOOLS.test(tool) : files.length > 0; const isShell = SHELL_TOOLS.test(tool); - const command = isShell && !patch && typeof toolInput?.command === "string" ? toolInput.command : ""; + const rawCommand = toolInput?.command ?? toolInput?.CommandLine; + const command = isShell && !patch && typeof rawCommand === "string" ? rawCommand : ""; return { event, tool, isEdit, isShell, files: isEdit ? files : [], command, cwd }; } diff --git a/plugins/rf-core/scripts/_hook_output.mjs b/plugins/rf-core/scripts/_hook_output.mjs new file mode 100644 index 0000000..955b03b --- /dev/null +++ b/plugins/rf-core/scripts/_hook_output.mjs @@ -0,0 +1,56 @@ +// _hook_output.mjs — write model-facing hook text in the shape the calling agent reads. +// +// Each agent reads a different JSON shape from a hook's stdout (live checks, +// 2026-11-24), and one combined object fails: Antigravity and Codex drop an +// object with fields they don't expect. +// +// Claude Code, Codex, OpenCode* {"hookSpecificOutput": {"hookEventName", "additionalContext"}} +// Antigravity CLI {"injectSteps": [{"systemMessage": {"systemMessage": text}}]} +// Cursor {"additional_context": text} +// Copilot CLI hookSpecificOutput, but it passes no SessionStart text +// to the model; only PostToolUse `decision`/`reason` reach it. +// * OpenCode runs the scripts through the generated hook plugin, which reads hookSpecificOutput. +// +// stderr never reaches the model on exit 0; keep it for text meant for the person. + +/** + * Which agent runs this hook. + * Order: explicit RF_HOOK_AGENT (set by generated wrappers), input shape, environment. + * Copilot CLI is checked before Claude Code because it also sets CLAUDE_PLUGIN_ROOT. + * @returns {"claude"|"codex"|"copilot"|"cursor"|"antigravity"|"opencode"} ("codex" only when named) + */ +export function detectAgent(event, env = process.env) { + const named = String(env.RF_HOOK_AGENT ?? "").trim().toLowerCase(); + if (["claude", "codex", "copilot", "cursor", "antigravity", "opencode"].includes(named)) return named; + const ev = event && typeof event === "object" ? event : {}; + if ("cursor_version" in ev) return "cursor"; + if ("conversationId" in ev && "hookEventName" in ev && !("hook_event_name" in ev)) return "antigravity"; + if (env.COPILOT_CLI || env.COPILOT_PLUGIN_ROOT) return "copilot"; + if (env.PLUGIN_ROOT && !env.CLAUDE_PLUGIN_ROOT) return "antigravity"; + // Codex reads the same shape as Claude Code, so it needs no detection of its own. + return "claude"; +} + +/** Whether the agent passes this event's context text to the model at all. */ +export function hasContextChannel(agent, hookEventName) { + return !(agent === "copilot" && hookEventName !== "PostToolUse"); +} + +/** The JSON object that carries `text` to the model for this agent and event. */ +export function contextPayload(agent, hookEventName, text) { + switch (agent) { + case "antigravity": + return { injectSteps: [{ systemMessage: { systemMessage: text } }] }; + case "cursor": + return { additional_context: text }; + default: + return { hookSpecificOutput: { hookEventName, additionalContext: text } }; + } +} + +/** Write `text` as model-facing context for the calling agent; nothing when empty. */ +export function emitContext(event, hookEventName, text, env = process.env) { + if (!text) return; + const agent = detectAgent(event, env); + process.stdout.write(JSON.stringify(contextPayload(agent, hookEventName, text)) + "\n"); +} diff --git a/plugins/rf-core/scripts/_install_advice.mjs b/plugins/rf-core/scripts/_install_advice.mjs new file mode 100644 index 0000000..048c755 --- /dev/null +++ b/plugins/rf-core/scripts/_install_advice.mjs @@ -0,0 +1,126 @@ +// _install_advice.mjs — the robotcode install command for the project's package manager. +// +// One source for the session report, the error hints and the validation notice +// (robotcode-prerequisite, "Install advice follows the project's package manager"). +// The installer's `doctor` has a Python port that shares the fixture table in +// plugins/rf-core/tests/fixtures/install_advice.json. +// +// Never recommends uvx, pipx or uv tool: an isolated robotcode can't see the +// project's libraries. +import { existsSync, readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; + +export const ROBOTCODE_REQ = "robotcode[all]>=2.8"; + +function readText(path) { + try { + return readFileSync(path, "utf-8"); + } catch { + return ""; + } +} + +// The nearest directory at or above `start` that looks like a Python project root. +function projectDir(start) { + let dir = start; + for (let i = 0; i < 20; i++) { + for (const marker of ["pyproject.toml", "uv.lock", "poetry.lock", "pdm.lock", ".venv", "requirements.txt"]) { + if (existsSync(join(dir, marker))) return dir; + } + const parent = dirname(dir); + if (parent === dir) break; + dir = parent; + } + return start; +} + +/** + * The package manager of the project at `cwd` and the command that installs robotcode[all] there. + * @returns {{manager: "uv"|"poetry"|"pdm"|"hatch"|"pip"|"unknown", command: string, note: string}} + * `command` is one line to run (Hatch: an instruction); `note` adds what else to do. + */ +export function robotcodeInstallAdvice(cwd, env = process.env) { + const root = projectDir(cwd || process.cwd()); + const pyproject = readText(join(root, "pyproject.toml")); + const has = (name) => existsSync(join(root, name)); + const section = (name) => new RegExp(`^\\[tool\\.${name}(\\]|\\.)`, "m").test(pyproject); + const req = `"${ROBOTCODE_REQ}"`; + + if (has("uv.lock") || section("uv")) { + return { manager: "uv", command: `uv add --dev ${req}`, note: "" }; + } + if (has("poetry.lock") || section("poetry")) { + return { manager: "poetry", command: `poetry add --group dev ${req}`, note: "" }; + } + if (has("pdm.lock") || section("pdm")) { + return { manager: "pdm", command: `pdm add -dG dev ${req}`, note: "" }; + } + if (section("hatch")) { + return { + manager: "hatch", + command: `add ${req} to the dependencies of the Hatch environment that runs the tests`, + note: "then recreate it (hatch env prune)", + }; + } + const venv = (env.VIRTUAL_ENV ?? "").trim() || (has(".venv") ? join(root, ".venv") : ""); + if (venv) { + // The project's own .venv is named relative to the project root: shorter and stable. + const shown = venv === join(root, ".venv") ? ".venv" : venv; + const py = process.platform === "win32" ? join(shown, "Scripts", "python.exe") : join(shown, "bin", "python"); + const reqFile = ["requirements-dev.txt", "dev-requirements.txt", "requirements.txt"].find(has); + // A venv made by `uv venv` has no pip: install with uv into it. + const uvVenv = /^uv\s*=/m.test(readText(join(venv, "pyvenv.cfg"))); + return { + manager: "pip", + command: uvVenv ? `uv pip install --python ${shown} ${req}` : `${py} -m pip install ${req}`, + note: reqFile ? `and add ${ROBOTCODE_REQ} to ${reqFile}` : "", + }; + } + return { manager: "unknown", command: `uv add --dev ${req}`, note: "or the project's own tool (rf-setup skill)" }; +} + +/** The advice as one sentence fragment: " ()". */ +export function installAdviceText(cwd, env = process.env) { + const a = robotcodeInstallAdvice(cwd, env); + return a.note ? `${a.command} (${a.note})` : a.command; +} + +const EXTRA_COMMANDS = { + runner: "robot/discover/results", + analyze: "analyze code", + repl: "doc/repl/robot-debug", +}; + +/** + * What is wrong with robotcode, as one sentence, for a readiness result from + * robotcodeReadiness() (_python_env.mjs); "" when it is ready. + */ +export function robotcodeProblem(readiness) { + const r = readiness ?? { state: "missing" }; + if (r.state === "missing") return "robotcode is not installed in the project environment"; + if (r.state === "old") return `robotcode ${r.version} is older than 2.8 (\`robotcode doc\` needs 2.8)`; + if (r.state === "partial") { + const what = r.missingExtras.map((e) => `${e} (${EXTRA_COMMANDS[e] ?? e})`).join(", "); + return `robotcode ${r.version ?? ""} is installed without the extras ${what}`.replace(" ", " "); + } + return ""; +} + +/** + * The model-facing robotcode notice for `cwd`, or "" when robotcode is ready. + * `lead` prefixes it (e.g. "The edit was applied. "); `companion` adds the plugin pointer. + */ +export function robotcodeNotice(readiness, cwd, { lead = "", companion = false, max = 600 } = {}) { + const problem = robotcodeProblem(readiness); + if (!problem) return ""; + const core = [ + lead, + `Robot Framework project: ${problem}. `, + "`robotcode doc`, `analyze code`, `results` and the error check on edit need `robotcode[all]`. ", + `Ask the user first, then install into the project environment: ${installAdviceText(cwd)} `, + "(not uvx/pipx; rf-setup has details).", + ].join(""); + const extra = companion ? " Companion plugin: robotcode@robotframework-agent-plugins." : ""; + if (core.length + extra.length <= max) return core + extra; + return core.length <= max ? core : core.slice(0, max - 1) + "…"; +} diff --git a/plugins/rf-core/scripts/_python_env.mjs b/plugins/rf-core/scripts/_python_env.mjs index 84004a1..71779eb 100644 --- a/plugins/rf-core/scripts/_python_env.mjs +++ b/plugins/rf-core/scripts/_python_env.mjs @@ -129,13 +129,86 @@ export function findRobotcode(cwd, { withVersion = false } = {}) { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"], }); - if (r.error || r.status !== 0) continue; + // Not found: try the next candidate. Found but too slow to answer (a cold start + // under a short timeout): it is installed, version unknown, not missing. + if (r.error?.code === "ENOENT" || r.error?.code === "EACCES") continue; + if (r.error || r.signal) return { exe, version: null }; + // A venv's robotcode that fails `--version` is installed but broken (unknown version); + // a failing bare `robotcode` on PATH counts as absent. + if (r.status !== 0) { + if (exe !== "robotcode") return { exe, version: null }; + continue; + } const m = /(\d+\.\d+(?:\.\d+)?)/.exec(r.stdout ?? ""); return { exe, version: m ? m[1] : null }; } return null; } +// The extras `robotcode[all]` brings, by the distribution that provides them, +// and the commands each one adds (robotcode 2.8.0). +export const ROBOTCODE_EXTRAS = [ + { extra: "runner", dist: "robotcode-runner", commands: ["robot", "discover", "results", "libdoc"] }, + { extra: "analyze", dist: "robotcode-analyze", commands: ["analyze"] }, + { extra: "repl", dist: "robotcode-repl", commands: ["doc", "repl", "robot-debug"] }, +]; +export const ROBOTCODE_MIN = "2.8"; + +const DIST_PROBE = [ + "import json", + "from importlib import metadata as m", + "def v(n):", + " try: return m.version(n)", + " except Exception: return None", + `print(json.dumps({n: v(n) for n in ${JSON.stringify(["robotcode", "robotframework-robocop", ...ROBOTCODE_EXTRAS.map((e) => e.dist)])}}))`, +].join("\n"); + +// Installed versions of robotcode, its extras and Robocop in `py` ({dist: version|null}), +// or null when the interpreter can't answer (missing, a stub, a timeout). +export function robotcodeDistributions(py) { + if (!py) return null; + const r = spawnSync(py, ["-c", DIST_PROBE], { + ...spawnOptions(PROBE_TIMEOUT_MS), + encoding: "utf-8", + stdio: ["ignore", "pipe", "ignore"], + }); + if (r.error || r.status !== 0) return null; + try { + const obj = JSON.parse((r.stdout ?? "").trim().split(/\r?\n/).pop() ?? ""); + return obj && typeof obj === "object" ? obj : null; + } catch { + return null; + } +} + +/** + * Whether robotcode is ready in the project environment. + * `py` is the project interpreter (the one with Robot Framework); the extras are read + * from the interpreter next to the robotcode executable when it lives in a venv. + * @returns {{state: "missing"|"old"|"partial"|"ready", exe: string|null, version: string|null, + * missingExtras: string[], robocop: boolean|null}} + * missingExtras/robocop are only known when the metadata probe answered + * (robocop: null = unknown). + */ +export function robotcodeReadiness(cwd, py) { + const rc = findRobotcode(cwd, { withVersion: true }); + let probePy = py; + if (rc && rc.exe !== "robotcode") { + const sibling = join(dirname(rc.exe), IS_WIN ? "python.exe" : "python"); + if (existsSync(sibling)) probePy = sibling; + } + const dists = robotcodeDistributions(probePy); + const version = rc?.version ?? dists?.robotcode ?? null; + const installed = rc !== null || Boolean(dists?.robotcode); + const missingExtras = dists?.robotcode ? ROBOTCODE_EXTRAS.filter((e) => !dists[e.dist]).map((e) => e.extra) : []; + const robocop = dists ? Boolean(dists["robotframework-robocop"]) : null; + let state = "ready"; + if (!installed) state = "missing"; + else if (version && !versionAtLeast(version, ROBOTCODE_MIN)) state = "old"; + else if (missingExtras.length) state = "partial"; + return { state, exe: rc?.exe ?? null, version, missingExtras, robocop }; +} + // True when `version` ("2.8.0") is at least `min` ("2.8"). export function versionAtLeast(version, min) { const a = String(version ?? "").split(".").map(Number); diff --git a/plugins/rf-core/scripts/check_rf_environment.mjs b/plugins/rf-core/scripts/check_rf_environment.mjs index e05997b..24869d8 100644 --- a/plugins/rf-core/scripts/check_rf_environment.mjs +++ b/plugins/rf-core/scripts/check_rf_environment.mjs @@ -1,30 +1,36 @@ #!/usr/bin/env node // check_rf_environment.mjs — Check the Robot Framework environment at session start. // -// Called by the SessionStart hook. Writes a diagnostic summary to stderr so the -// agent sees the environment state. Always exits 0 (informational only — never -// blocks session start). +// Called by the SessionStart hook. Writes the full diagnostic summary to stderr +// for the person, and a short notice for the model to stdout in the calling +// agent's shape (_hook_output.mjs) when robotcode is not ready: agents never show +// stderr of a hook that exits 0 to the model. Always exits 0 (informational only, +// never blocks session start). // // Interpreter resolution is shared with the validation hooks (_python_env.mjs): // VIRTUAL_ENV -> /.venv -> python_runtime.json -> python3/python. The // SessionStart event's `cwd` selects the project (process cwd when it has none); -// a missing, empty or malformed event produces no output. Install advice follows the rf-setup skill (project environment, -// `uv add …`); it never recommends `pip install`, and leaves library post-install steps to -// the library's own skill. +// a missing, empty or malformed event produces no output. Install advice follows the rf-setup skill and the +// project's package manager (_install_advice.mjs: uv, Poetry, PDM, Hatch, or pip into +// the project venv); it never recommends uvx/pipx, and leaves library post-install +// steps to the library's own skill. import { spawnSync } from "node:child_process"; import { existsSync, readFileSync } from "node:fs"; +import { homedir } from "node:os"; import { join } from "node:path"; import { PROBE_TIMEOUT_MS, + ROBOTCODE_MIN, findInterpreterWith, - findRobotcode, firstPython, projectRoot, + robotcodeReadiness, spawnOptions, - versionAtLeast, } from "./_python_env.mjs"; +import { emitContext } from "./_hook_output.mjs"; +import { installAdviceText, robotcodeNotice, robotcodeProblem } from "./_install_advice.mjs"; -const ROBOTCODE_MIN = "2.8"; +const NOTICE_MAX = 600; // characters of model-facing text const MARKETPLACE = "robotframework-plugins"; // Libraries a technology plugin covers (detection signals only; the install @@ -63,6 +69,24 @@ function installCommand(plugin) { return "uvx robotframework-plugins install (adds the plugins for the libraries the project declares)"; } +// Whether the RobotCode project's robotcode plugin or skill is installed for some +// agent: a sibling marketplace in the plugin cache, or a plain skill folder. +// Best effort; unknown = no. +function companionPresent(cwd) { + const home = homedir(); + const root = process.env.CLAUDE_PLUGIN_ROOT ?? process.env.PLUGIN_ROOT ?? ""; + const candidates = [ + root && join(root, "..", "..", "..", "robotframework-agent-plugins", "robotcode"), + join(home, ".claude", "plugins", "cache", "robotframework-agent-plugins", "robotcode"), + join(home, ".codex", "plugins", "cache", "robotframework-agent-plugins", "robotcode"), + join(home, ".gemini", "config", "plugins", "robotcode"), + ...[".claude", ".agents", ".opencode", ".github", ".cursor"].map((d) => join(cwd, d, "skills", "robotcode")), + ...[[".claude", "skills"], [".agents", "skills"], [".config", "opencode", "skills"], [".copilot", "skills"], + [".gemini", "config", "skills"], [".cursor", "skills"]].map((parts) => join(home, ...parts, "robotcode")), + ].filter(Boolean); + return candidates.some((p) => existsSync(p)); +} + // Missing, empty or malformed event -> no output (the hook never blocks). let event = null; try { @@ -111,23 +135,32 @@ process.stderr.write(` Robot Framework version: ${rfVersion}\n`); if (py) process.stderr.write(` Interpreter: ${py}\n`); process.stderr.write("\nrobotcode (required by rf-core):\n"); -const rc = findRobotcode(cwd, { withVersion: true }); -const rcOk = rc !== null && versionAtLeast(rc.version, ROBOTCODE_MIN); +const readiness = robotcodeReadiness(cwd, py); +const rcOk = readiness.state === "ready"; +const installCmd = installAdviceText(cwd); +const companion = companionPresent(cwd); check(rcOk, `robotcode[all]>=${ROBOTCODE_MIN}`); if (rcOk) { - process.stderr.write(` robotcode ${rc.version}: available (${rc.exe}); errors are checked on every .robot/.resource edit\n`); + process.stderr.write( + ` robotcode ${readiness.version ?? ""}: ready (${readiness.exe ?? "project environment"}); ` + + "errors are checked on every .robot/.resource edit\n", + ); } else { + const problem = robotcodeProblem(readiness); process.stderr.write( - (rc - ? ` robotcode ${rc.version ?? "(unknown version)"} is older than ${ROBOTCODE_MIN} (robotcode doc needs ${ROBOTCODE_MIN}): ` - : " robotcode: not installed — ") + + ` ${readiness.state === "missing" ? "robotcode: not installed" : problem} — ` + "keyword lookup (robotcode doc), result analysis (robotcode results) and the error check on edit " + - "need it. Install it into the project environment: uv add --dev \"robotcode[all]>=2.8\" " + - "(see the rf-setup skill). Recommended companion plugin: robotcode@robotframework-agent-plugins.\n", + `need robotcode[all]>=${ROBOTCODE_MIN}. Install it into the project environment: ${installCmd} ` + + "(see the rf-setup skill).\n", ); } -const robocopOk = check(pythonImportExists(py, "robocop") || - findInterpreterWith("robocop", cwd) !== null, "robotframework-robocop"); +process.stderr.write( + companion + ? " robotcode plugin: installed (robotcode@robotframework-agent-plugins)\n" + : " Recommended companion plugin: robotcode@robotframework-agent-plugins (teaches the agent the robotcode CLI)\n", +); +const robocopOk = check(readiness.robocop ?? (pythonImportExists(py, "robocop") || + findInterpreterWith("robocop", cwd) !== null), "robotframework-robocop"); process.stderr.write( robocopOk ? " Robocop: available (deprecation and formatting advice on edit)\n" @@ -167,8 +200,8 @@ if (missing.length) { "\nInstall only what the project needs, into the project environment. " + "See the rf-setup skill for the full steps (uv, venv, poetry):\n", ); - process.stderr.write(" uv add robotframework # core\n"); - process.stderr.write(" uv add --dev \"robotcode[all]>=2.8\" # required: robotcode CLI + Robocop\n"); + if (!rfOk) process.stderr.write(" uv add robotframework # core\n"); + if (!rcOk || !robocopOk) process.stderr.write(` ${installCmd} # required: robotcode CLI + Robocop\n`); process.stderr.write( " Test libraries: the library's own skill gives its install steps " + "(plugins rf-web, rf-api, rf-mobile, rf-desktop).\n", @@ -178,4 +211,9 @@ if (missing.length) { } process.stderr.write("=== End Environment Check ===\n"); +// Model-facing notice: only in a Robot Framework environment, only when robotcode is not ready. +if (rfOk && !rcOk) { + emitContext(event, "SessionStart", robotcodeNotice(readiness, cwd, { companion: !companion, max: NOTICE_MAX })); +} + process.exit(0); diff --git a/plugins/rf-core/scripts/maybe_inject_rf_context.mjs b/plugins/rf-core/scripts/maybe_inject_rf_context.mjs index 8f4e279..ba990ba 100644 --- a/plugins/rf-core/scripts/maybe_inject_rf_context.mjs +++ b/plugins/rf-core/scripts/maybe_inject_rf_context.mjs @@ -9,12 +9,15 @@ // results via `robotcode results`, and a one-line RF 7 syntax reminder. // // Schema: -// stdin — Claude Code UserPromptSubmit event JSON. -// stdout — Either empty (no injection) or one JSON object of the form -// {"hookSpecificOutput": {"hookEventName": "UserPromptSubmit", -// "additionalContext": "..."}}. +// stdin — UserPromptSubmit event JSON (Antigravity: PreInvocation, prompt in `lastUserInput`). +// stdout — Either empty (no injection) or one JSON object in the calling agent's +// shape (_hook_output.mjs; Claude Code: hookSpecificOutput.additionalContext). // exit — Always 0. The hook is non-blocking by design. -import { readFileSync } from "node:fs"; +import { createHash } from "node:crypto"; +import { existsSync, readFileSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { detectAgent, emitContext } from "./_hook_output.mjs"; let raw = ""; try { raw = readFileSync(0, "utf-8"); } catch { process.exit(0); } @@ -22,7 +25,8 @@ if (!raw) process.exit(0); let event; try { event = JSON.parse(raw); } catch { process.exit(0); } -const prompt = (event?.prompt ?? "").toString(); +// Antigravity's PreInvocation event carries the prompt as `lastUserInput`. +const prompt = (event?.prompt ?? event?.lastUserInput ?? "").toString(); if (!prompt) process.exit(0); // Robot Framework signal regex (case-insensitive). Conservative on @@ -65,12 +69,16 @@ const CONTEXT = [ "Write RF 7 syntax: RETURN, VAR, IF, Test Tags.", ].join(""); -const payload = { - hookSpecificOutput: { - hookEventName: "UserPromptSubmit", - additionalContext: CONTEXT, - }, -}; - -process.stdout.write(JSON.stringify(payload) + "\n"); +// Antigravity runs this on PreInvocation, before every model call of a turn, and keeps +// injected steps in the conversation: inject once per prompt there. +if (detectAgent(event) === "antigravity") { + const conv = String(event.conversationId ?? "").replace(/[^A-Za-z0-9._-]/g, "_"); + const digest = createHash("sha256").update(prompt).digest("hex").slice(0, 16); + const marker = conv ? join(tmpdir(), `rf-agentskills-prompt-${conv}-${digest}`) : ""; + if (marker && existsSync(marker)) process.exit(0); + if (marker) { + try { writeFileSync(marker, "1"); } catch { /* inject again next time */ } + } +} +emitContext(event, "UserPromptSubmit", CONTEXT); process.exit(0); diff --git a/plugins/rf-core/scripts/rf_error_hints.mjs b/plugins/rf-core/scripts/rf_error_hints.mjs index e762553..a09b644 100644 --- a/plugins/rf-core/scripts/rf_error_hints.mjs +++ b/plugins/rf-core/scripts/rf_error_hints.mjs @@ -12,20 +12,21 @@ // VS Code `run_in_terminal`. Output comes from `tool_response` // (Copilot CLI: `tool_result`): .stdout / .stderr, or a plain string. // Other tools exit silently (VS Code runs every hook for every tool). -// stdout — Either empty or one JSON object: -// {"hookSpecificOutput": {"hookEventName": "PostToolUse", -// "additionalContext": "..."}}. +// stdout — Either empty or one JSON object in the calling agent's shape +// (_hook_output.mjs; Claude Code: hookSpecificOutput.additionalContext). // exit — Always 0. The hook never blocks. import { readFileSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { normalizeHookInput } from "./_hook_input.mjs"; +import { emitContext } from "./_hook_output.mjs"; +import { installAdviceText } from "./_install_advice.mjs"; const MAX_SCAN = 20000; // characters of output scanned const MAX_HINT = 400; // characters per hint const MAX_NAME = 80; // characters of an offending name quoted in a hint -// kind, pattern (first group = offending name, if any), hint builder +// kind, pattern (first group = offending name, if any), hint builder (name, project dir) const SIGNATURES = [ { kind: "no-keyword", @@ -65,6 +66,22 @@ const SIGNATURES = [ `Library '${name}' could not be imported. Install it into the project environment ` + "(e.g. `uv add `) and run robot from that environment. See the rf-setup skill.", }, + { + kind: "robotcode-missing", + re: /robotcode: (?:command )?not found|No module named '?robotcode|'robotcode' is not recognized/, + hint: (_name, cwd) => + "robotcode is not installed in the project environment. Ask the user, then install " + + `robotcode[all] into it: ${installAdviceText(cwd)}. Not uvx/pipx: an isolated robotcode ` + + "can't see the project's libraries. See the rf-setup skill.", + }, + { + kind: "robotcode-extra", + re: /Error: No such command '(analyze|doc|repl|robot|results|discover|robot-debug|libdoc|rebot|testdoc)'/, + hint: (name, cwd) => + `robotcode has no '${name}' command because it is installed without its extras. ` + + `Install robotcode[all] into the project environment (ask the user first): ${installAdviceText(cwd)}. ` + + "Don't retry other spellings of the command.", + }, ]; function outputText(response) { @@ -93,7 +110,7 @@ function main() { const text = outputText(event.tool_response ?? event.tool_result).slice(0, MAX_SCAN); if (!text) return; - const sessionId = (event.session_id ?? "").toString(); + const sessionId = (event.session_id ?? event.conversationId ?? "").toString(); // Antigravity: conversationId const marker = sessionId ? join(tmpdir(), `rf-agentskills-hints-${sessionId.replace(/[^A-Za-z0-9._-]/g, "_")}.json`) : ""; @@ -108,7 +125,7 @@ function main() { const m = sig.re.exec(text); if (!m) continue; const name = (m[1] ?? "").slice(0, MAX_NAME); - hints.push(sig.hint(name).slice(0, MAX_HINT)); + hints.push(sig.hint(name, input.cwd).slice(0, MAX_HINT)); seen.add(sig.kind); } if (!hints.length) return; @@ -116,10 +133,7 @@ function main() { if (marker) { try { writeFileSync(marker, JSON.stringify([...seen])); } catch { /* dedupe lost only */ } } - const payload = { - hookSpecificOutput: { hookEventName: "PostToolUse", additionalContext: hints.join("\n\n") }, - }; - process.stdout.write(JSON.stringify(payload) + "\n"); + emitContext(event, "PostToolUse", hints.join("\n\n")); } try { main(); } catch { /* never block */ } diff --git a/plugins/rf-core/scripts/validate_robot.mjs b/plugins/rf-core/scripts/validate_robot.mjs index ecacf32..d34a392 100644 --- a/plugins/rf-core/scripts/validate_robot.mjs +++ b/plugins/rf-core/scripts/validate_robot.mjs @@ -59,7 +59,12 @@ // touches several .robot/.resource files is validated file by file. Tools: see // _python_env.mjs (VIRTUAL_ENV -> /.venv -> python_runtime.json -> PATH); // robotcode, Robocop and Robot Framework are each optional — a missing tool -// makes its tier a silent no-op. +// makes its tier a no-op. The one exception: when the robotcode tier can't run +// because robotcode is missing, older than 2.8 or lacks its `analyze` extra, the +// agent is told once per session that the edit was not checked, with the install +// command (rf-validation-hooks, "A disabled error check is announced once"). +// Copilot CLI passes only `decision`/`reason` to the model, so it gets the notice +// that way, worded as information; the other agents get it as context. import { existsSync, readFileSync, writeFileSync } from "node:fs"; import { spawn, spawnSync } from "node:child_process"; import { createHash } from "node:crypto"; @@ -68,7 +73,9 @@ import { basename, dirname, join, relative, isAbsolute } from "node:path"; import { fileURLToPath } from "node:url"; import { readHookInput } from "./_hook_input.mjs"; import { recordResult } from "./_pending_errors.mjs"; -import { findInterpreterWith, findRobotcode, projectRoot, spawnOptions } from "./_python_env.mjs"; +import { findInterpreterWith, findRobotcode, projectRoot, robotcodeReadiness, spawnOptions } from "./_python_env.mjs"; +import { detectAgent, emitContext } from "./_hook_output.mjs"; +import { robotcodeNotice } from "./_install_advice.mjs"; // Child processes still running; killed when the hook exits early. const running = new Set(); @@ -113,6 +120,21 @@ if (!robotFiles.length) process.exit(0); if (robotFiles.length > 1) validateEach(robotFiles); const filePath = robotFiles[0]; +/** + * Write advisory text (never blocking) for the calling agent. Copilot CLI reads only + * `decision`/`reason`, so there the robotcode notice (and any advisory text with it) + * goes out that way, starting with "The edit was applied." so the agent keeps the edit. + */ +function emitAdvisory(parts, { copilotNotice = "" } = {}) { + const text = parts.filter(Boolean).join("\n\n"); + if (copilotNotice && detectAgent(event) === "copilot") { + const reason = [copilotNotice, ...parts.filter((p) => p && p !== copilotNotice)].join("\n\n"); + process.stdout.write(JSON.stringify({ decision: "block", reason }) + "\n"); + return; + } + emitContext(event, "PostToolUse", text); +} + /** Report real errors: stderr + exit 2, plus the decision JSON for Copilot. */ function reportErrors(text) { const reason = @@ -137,7 +159,8 @@ function validateEach(files) { process.execPath, [self], spawnOptions(ANALYZE_TIMEOUT_MS + ROBOCOP_TIMEOUT_MS * 2 + DRYRUN_TIMEOUT_MS, { - input: JSON.stringify(child), encoding: "utf-8", env: { ...process.env, TOOL_INPUT: "" }, + // Children answer in the Claude shape so their context can be merged here. + input: JSON.stringify(child), encoding: "utf-8", env: { ...process.env, TOOL_INPUT: "", RF_HOOK_AGENT: "claude" }, }), ); if (r.status === 2) errors.push((r.stderr ?? "").trim()); @@ -149,10 +172,7 @@ function validateEach(files) { } } if (errors.length) reportErrors(errors.join("\n")); - if (contexts.length) { - const payload = { hookSpecificOutput: { hookEventName: "PostToolUse", additionalContext: contexts.join("\n\n") } }; - process.stdout.write(JSON.stringify(payload) + "\n"); - } + emitAdvisory(contexts); process.exit(0); } @@ -213,7 +233,7 @@ function touchedLines() { } // ── Per-session dedupe marker (design D5) ─────────────────────────────────── -const sessionId = (event?.session_id ?? "").toString(); +const sessionId = (event?.session_id ?? event?.conversationId ?? "").toString(); // Antigravity: conversationId const markerPath = sessionId ? join(tmpdir(), `rf-agentskills-depr-${sessionId.replace(/[^A-Za-z0-9._-]/g, "_")}.json`) : ""; @@ -454,6 +474,26 @@ function dryRunText() { return text; } +// ── The disabled-check notice, once per session ───────────────────────────── +// When the robotcode tier gave no result, check once per session whether robotcode +// is missing, too old or lacks `analyze` (base install: "No such command 'analyze'"). +// A timeout, or a ready robotcode with unparsable output, stays silent. +function disabledCheckNotice(analyzeResult) { + if (analyzeResult && (analyzeResult.error || analyzeResult.status === null)) return ""; // timeout + const noticeMarker = sessionId + ? join(tmpdir(), `rf-agentskills-rcnotice-${sessionId.replace(/[^A-Za-z0-9._-]/g, "_")}`) + : ""; + if (noticeMarker && existsSync(noticeMarker)) return ""; + const readiness = robotcodeReadiness(cwd, findInterpreterWith("robot", cwd)); + if (noticeMarker) { + try { writeFileSync(noticeMarker, readiness.state); } catch { /* checked again next time */ } + } + return robotcodeNotice(readiness, cwd, { + lead: `The edit was applied. ${basename(filePath)} was not checked for errors: `, + max: 700, + }); +} + // ── Main ──────────────────────────────────────────────────────────────────── const advisory = []; const robocopPy = STOP_RECHECK ? null : findInterpreterWith("robocop", cwd); @@ -463,7 +503,10 @@ const formatRun = robocopPy && isTruthy(process.env.RF_AGENTSKILLS_FORMAT_CHECK) ? spawnAsync(robocopPy, ["-m", "robocop", "format", "--no-cache", "--check", "--diff", "--no-overwrite", filePath], ROBOCOP_TIMEOUT_MS) : Promise.resolve(null); -const analysis = parseAnalyze(await analyzeRun); +const analyzeResult = await analyzeRun; +const analysis = parseAnalyze(analyzeResult); +let robotcodeNoticeText = ""; +if (!analysis && !STOP_RECHECK) robotcodeNoticeText = disabledCheckNotice(analyzeResult); if (analysis) { const { blocking, unresolved } = analysis; // Remember the result for the Stop-time re-check (report_pending_errors.mjs). @@ -505,13 +548,6 @@ if (robocopPy) { const dry = dryRunText(); if (dry) advisory.push(dry); -if (advisory.length) { - const payload = { - hookSpecificOutput: { - hookEventName: "PostToolUse", - additionalContext: advisory.join("\n\n"), - }, - }; - process.stdout.write(JSON.stringify(payload) + "\n"); -} +if (robotcodeNoticeText) advisory.unshift(robotcodeNoticeText); +emitAdvisory(advisory, { copilotNotice: robotcodeNoticeText }); process.exit(0); diff --git a/plugins/rf-core/skills/rf-setup/SKILL.md b/plugins/rf-core/skills/rf-setup/SKILL.md index 28949ad..ba3e446 100644 --- a/plugins/rf-core/skills/rf-setup/SKILL.md +++ b/plugins/rf-core/skills/rf-setup/SKILL.md @@ -69,13 +69,18 @@ venv + pip and Poetry equivalents: `references/venv-pip.md`, `references/poetry. ## Required: robotcode in the project environment -The other Robot Framework skills and the rf-core validation hooks run the robotcode CLI (`robotcode doc`, `robotcode analyze code`, `robotcode results`, `robotcode robot-debug`). Install it in every new or repaired setup, right after Robot Framework, with the tool the project uses: +The other Robot Framework skills and the rf-core validation hooks run the robotcode CLI (`robotcode doc`, `robotcode analyze code`, `robotcode results`, `robotcode robot-debug`). Install it in every new or repaired setup, right after Robot Framework, with the tool the project uses. In an existing project, ask the user before installing: -| Tool | Command | +| Tool (project signal) | Command | |---|---| -| uv | `uv add --dev "robotcode[all]>=2.8"` | -| Poetry | `poetry add --group dev "robotcode[all]>=2.8"` | +| uv (`uv.lock`) | `uv add --dev "robotcode[all]>=2.8"` | +| Poetry (`poetry.lock`) | `poetry add --group dev "robotcode[all]>=2.8"` | +| PDM (`pdm.lock`) | `pdm add -dG dev "robotcode[all]>=2.8"` | +| Hatch (`[tool.hatch]`) | add `robotcode[all]>=2.8` to the test environment's `dependencies` | | venv + pip | `pip install "robotcode[all]>=2.8"` (venv active; also add it to `requirements-dev.txt`) | +| venv made by `uv venv` (no pip) | `uv pip install --python .venv "robotcode[all]>=2.8"` | + +- **`Error: No such command 'analyze'`** (or `doc`, `results`, …) means robotcode is installed without its extras: install `robotcode[all]` with the same command. Don't try other spellings of the command. - **Why `[all]`:** the base `robotcode` package only has `config` and `profiles`. The skills need the `runner` extra (`robot`, `discover`, `results`, `libdoc`), `analyze` (`analyze code`) and `repl` (`doc`, `repl`, `robot-debug`), and the hooks need Robocop. Only `[all]` brings all of them. - **Why ≥ 2.8:** `robotcode doc` (keyword lookup) first ships in 2.8. For an older install, run the same command again: it raises the lower bound and upgrades robotcode. diff --git a/plugins/rf-core/skills/rf-setup/references/libraries.md b/plugins/rf-core/skills/rf-setup/references/libraries.md index 6afc1a0..c4852cd 100644 --- a/plugins/rf-core/skills/rf-setup/references/libraries.md +++ b/plugins/rf-core/skills/rf-setup/references/libraries.md @@ -31,7 +31,7 @@ Each library's skill has its install command, post-install steps and verificatio ## robotcode (required) - Package `robotcode[all]>=2.8` (Python ≥ 3.10). Install as a **dev dependency in the project env**, never with `pipx`, `uvx` or `uv tool`: it imports your libraries. The `[all]` extra also installs Robocop (`robotframework-robocop>=6`), so Robocop needs no separate install. -- uv: `uv add --dev "robotcode[all]>=2.8"` · Poetry: `poetry add --group dev "robotcode[all]>=2.8"` · pip: `pip install "robotcode[all]>=2.8"`. +- uv: `uv add --dev "robotcode[all]>=2.8"` · Poetry: `poetry add --group dev "robotcode[all]>=2.8"` · PDM: `pdm add -dG dev "robotcode[all]>=2.8"` · pip: `pip install "robotcode[all]>=2.8"` (a `uv venv` has no pip: `uv pip install --python .venv "robotcode[all]>=2.8"`). - Verify: `uv run robotcode discover info` shows the project's `.venv` Python; `uv run robocop --version` works. - The rf-core validation hooks run `robotcode analyze code` (errors) and Robocop (deprecations, formatting) from the project environment. diff --git a/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-replace-file-content.json b/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-replace-file-content.json new file mode 100644 index 0000000..7519284 --- /dev/null +++ b/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-replace-file-content.json @@ -0,0 +1 @@ +{"conversationId": "c1", "cwd": "/work/proj", "hookEventName": "PostToolUse", "toolCall": {"args": {"TargetFile": "/work/proj/resources/b.resource"}, "id": "call_2", "name": "replace_file_content"}} diff --git a/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-run-command.json b/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-run-command.json new file mode 100644 index 0000000..9fb6707 --- /dev/null +++ b/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-run-command.json @@ -0,0 +1 @@ +{"conversationId": "c1", "cwd": "/work/proj", "error": "", "hookEventName": "PostToolUse", "stepIdx": 3, "toolCall": {"args": {"CommandLine": "robot tests", "WaitMsBeforeAsync": 5000, "toolSummary": "Run tests"}, "id": "call_3", "name": "run_command"}} diff --git a/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-write-file.json b/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-write-file.json new file mode 100644 index 0000000..a5e4b06 --- /dev/null +++ b/plugins/rf-core/tests/fixtures/hook_inputs/antigravity-write-file.json @@ -0,0 +1 @@ +{"conversationId": "c1", "cwd": "/work/proj", "error": "", "hookEventName": "PostToolUse", "modelName": "gemini", "stepIdx": 5, "toolCall": {"args": {"Content": "*** Test Cases ***\nT\n Log x\n", "Overwrite": true, "Path": "/work/proj/tests/a.robot"}, "id": "call_1", "name": "write_file"}} diff --git a/plugins/rf-core/tests/fixtures/install_advice.json b/plugins/rf-core/tests/fixtures/install_advice.json new file mode 100644 index 0000000..16dee63 --- /dev/null +++ b/plugins/rf-core/tests/fixtures/install_advice.json @@ -0,0 +1,22 @@ +{ + "_comment": "robotcode install advice per project layout (robotcode-prerequisite). Shared by the hook tests (plugins/rf-core/tests/test_install_advice.py) and the installer's doctor tests. Paths are relative to the project; the project venv is shown as .venv.", + "cases": [ + {"id": "uv-lock", "files": {"uv.lock": "", "pyproject.toml": "[project]\nname = 'x'\n"}, "manager": "uv", + "contains": ["uv add --dev \"robotcode[all]>=2.8\""]}, + {"id": "uv-section", "files": {"pyproject.toml": "[tool.uv]\ndev-dependencies = []\n"}, "manager": "uv", + "contains": ["uv add --dev \"robotcode[all]>=2.8\""]}, + {"id": "poetry-lock", "files": {"poetry.lock": "", "pyproject.toml": "[tool.poetry]\nname = 'x'\n"}, "manager": "poetry", + "contains": ["poetry add --group dev \"robotcode[all]>=2.8\""]}, + {"id": "pdm-lock", "files": {"pdm.lock": ""}, "manager": "pdm", + "contains": ["pdm add -dG dev \"robotcode[all]>=2.8\""]}, + {"id": "hatch", "files": {"pyproject.toml": "[tool.hatch.envs.default]\ndependencies = []\n"}, "manager": "hatch", + "contains": ["Hatch environment", "robotcode[all]>=2.8"]}, + {"id": "venv-pip-requirements-dev", "files": {".venv/pyvenv.cfg": "home = /usr/bin\n", "requirements-dev.txt": "robotframework\n"}, + "manager": "pip", "contains": [".venv/bin/python -m pip install \"robotcode[all]>=2.8\"", "requirements-dev.txt"], + "excludes": ["uv add"]}, + {"id": "uv-made-venv", "files": {".venv/pyvenv.cfg": "home = /usr/bin\nuv = 0.9.26\n"}, "manager": "pip", + "contains": ["uv pip install --python .venv \"robotcode[all]>=2.8\""], "excludes": ["uv add", "-m pip"]}, + {"id": "nothing", "files": {}, "manager": "unknown", + "contains": ["uv add --dev \"robotcode[all]>=2.8\"", "rf-setup"]} + ] +} diff --git a/plugins/rf-core/tests/test_agent_variants.py b/plugins/rf-core/tests/test_agent_variants.py index f03297d..8d68cf4 100644 --- a/plugins/rf-core/tests/test_agent_variants.py +++ b/plugins/rf-core/tests/test_agent_variants.py @@ -9,6 +9,7 @@ import json import shutil import subprocess +import os import sys import uuid from pathlib import Path @@ -116,8 +117,11 @@ def _install_layout(tmp_path: Path) -> Path: return root / "plugins" / "rf-core.js" -def _drive(plugin_js: Path, project: Path, steps: list[dict]) -> list[str]: - """Call the plugin's hooks in order; return output.output after each tool call.""" +def _drive(plugin_js: Path, project: Path, steps: list[dict], env: dict | None = None) -> list[str]: + """Call the plugin's hooks in order; return output.output after each tool call. + ``__SESSION__`` in an event step stands for the session ID of the tool calls.""" + session = "S-" + uuid.uuid4().hex + steps = json.loads(json.dumps(steps).replace("__SESSION__", session)) code = f""" import {{ RfAgentSkills }} from {json.dumps(plugin_js.as_uri())}; const hooks = await RfAgentSkills({{ directory: {json.dumps(str(project))} }}); @@ -125,7 +129,7 @@ def _drive(plugin_js: Path, project: Path, steps: list[dict]) -> list[str]: const outputs = []; for (const s of steps) {{ if (s.event) {{ await hooks.event({{ event: s.event }}); continue; }} - const input = {{ tool: s.tool, sessionID: {json.dumps("S-" + uuid.uuid4().hex)}, callID: s.callID }}; + const input = {{ tool: s.tool, sessionID: {json.dumps(session)}, callID: s.callID }}; await hooks["tool.execute.before"](input, {{ args: s.args }}); const output = {{ title: "", output: s.output ?? "", metadata: {{}} }}; await hooks["tool.execute.after"](input, output); @@ -134,7 +138,7 @@ def _drive(plugin_js: Path, project: Path, steps: list[dict]) -> list[str]: process.stdout.write(JSON.stringify(outputs)); """ res = subprocess.run([NODE, "--input-type=module", "-e", code, json.dumps(steps)], # type: ignore[list-item] - capture_output=True, text=True, timeout=120, cwd=project) + capture_output=True, text=True, timeout=120, cwd=project, env=env) assert res.returncode == 0, res.stderr return json.loads(res.stdout) @@ -162,3 +166,29 @@ def test_opencode_plugin_bash_hints_and_quiet_tools(tmp_path: Path) -> None: ]) assert "rf-language" in outs[0] assert outs[1] == "file text" + + +@pytest.mark.skipif(NODE is None, reason="node not on PATH") +@pytest.mark.skipif(sys.platform == "win32", reason="fake POSIX python and robotcode shims") +def test_opencode_plugin_shows_robotcode_notice_in_first_tool_output(tmp_path: Path) -> None: + """hook-output-channels: OpenCode has no session-start injection, so the + environment notice rides on the first tool output (RF present, robotcode missing).""" + plugin_js = _install_layout(tmp_path) + py = tmp_path / ".venv" / "bin" / "python" + py.parent.mkdir(parents=True) + py.write_text('#!/bin/sh\n[ "$1" = "-c" ] && [ "$2" = "import robot" ] && exit 0\n' + 'case "$2" in *robot.version*) echo 7.3; exit 0;; esac\nexit 1\n', encoding="utf-8") + fake_bin = tmp_path / "bin" + fake_bin.mkdir() + (fake_bin / "robotcode").write_text("#!/bin/sh\nexit 1\n", encoding="utf-8") + for f in (py, fake_bin / "robotcode"): + f.chmod(0o755) + env = {k: v for k, v in os.environ.items() if k not in ("VIRTUAL_ENV", "RF_HOOK_AGENT")} + env["PATH"] = f"{fake_bin}{os.pathsep}{os.environ.get('PATH', '')}" + outs = _drive(plugin_js, tmp_path, [ + {"event": {"type": "session.created", "properties": {"info": {"id": "__SESSION__"}}}}, + {"tool": "read", "callID": "c1", "args": {"filePath": "x.robot"}, "output": "file text"}, + {"tool": "read", "callID": "c2", "args": {"filePath": "y.robot"}, "output": "more"}, + ], env=env) + assert outs[0].startswith("file text") and "robotcode is not installed" in outs[0] + assert outs[1] == "more" diff --git a/plugins/rf-core/tests/test_hook_input.py b/plugins/rf-core/tests/test_hook_input.py index 9ce1feb..c33875f 100644 --- a/plugins/rf-core/tests/test_hook_input.py +++ b/plugins/rf-core/tests/test_hook_input.py @@ -1,7 +1,8 @@ """``_hook_input.mjs``: one reader for every agent's hook input (marketplace-distribution D2). Fixtures in ``tests/fixtures/hook_inputs/`` follow the input shapes recorded on -2026-10-08 from Claude Code, Copilot CLI, VS Code, Codex and Cursor. +2026-10-08 from Claude Code, Copilot CLI, VS Code, Codex and Cursor, and on 2026-12-01 +from Antigravity CLI 1.5.0. """ from __future__ import annotations @@ -47,6 +48,8 @@ def _normalize(name: str) -> dict: ("vscode-multi-replace", ["tests/a.robot", "resources/b.resource"]), ("vscode-apply-patch", ["tests/a.robot"]), ("codex-apply-patch", ["tests/new.robot", "resources/b.resource"]), + ("antigravity-write-file", ["tests/a.robot"]), + ("antigravity-replace-file-content", ["resources/b.resource"]), ]) def test_edit_inputs_yield_the_edited_files(name: str, files: list[str]) -> None: r = _normalize(name) @@ -57,6 +60,7 @@ def test_edit_inputs_yield_the_edited_files(name: str, files: list[str]) -> None @pytest.mark.parametrize(("name", "command"), [ ("codex-bash", "robot tests"), ("vscode-run-in-terminal", "robot tests"), + ("antigravity-run-command", "robot tests"), ]) def test_shell_inputs_yield_the_command(name: str, command: str) -> None: r = _normalize(name) diff --git a/plugins/rf-core/tests/test_hook_output.py b/plugins/rf-core/tests/test_hook_output.py new file mode 100644 index 0000000..fcfae58 --- /dev/null +++ b/plugins/rf-core/tests/test_hook_output.py @@ -0,0 +1,100 @@ +"""``_hook_output.mjs``: model-facing hook text in each agent's shape (hook-output-channels). + +Input shapes and environment names were recorded on 2026-11-24 from Claude Code +2.1.331, Copilot CLI 1.0.91 and Antigravity CLI 1.5.0. +""" +from __future__ import annotations + +import json +import shutil +import subprocess +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[3] +HELPER = ROOT / "plugins" / "rf-core" / "scripts" / "_hook_output.mjs" +NODE = shutil.which("node") +pytestmark = pytest.mark.skipif(NODE is None, reason="node not on PATH") + +CLAUDE_INPUT = {"cwd": "/p", "hook_event_name": "SessionStart", "session_id": "s", "source": "startup", + "transcript_path": "/t"} +COPILOT_INPUT = {"cwd": "/p", "hook_event_name": "SessionStart", "initial_prompt": "hi", "session_id": "s", + "source": "new", "timestamp": "2026-11-24T11:31:56.158Z"} +AGY_INPUT = {"artifactDirectoryPath": "/a", "conversationId": "c", "cwd": "/p", "hookEventName": "SessionStart"} +CURSOR_INPUT = {"cursor_version": "2026.10.01", "hook_event_name": "sessionStart", "conversation_id": "c"} + + +def _emit(event: object, env: dict[str, str], hook_event: str = "SessionStart", text: str = "NOTICE") -> str: + code = ( + f"import {{ emitContext }} from {json.dumps(HELPER.as_uri())};" + "emitContext(JSON.parse(process.argv[1]), process.argv[2], process.argv[3], JSON.parse(process.argv[4]));" + ) + out = subprocess.run([NODE, "--input-type=module", "-e", code, # type: ignore[list-item] + json.dumps(event), hook_event, text, json.dumps(env)], + capture_output=True, text=True, timeout=30, check=True) + return out.stdout + + +def _detect(event: object, env: dict[str, str]) -> str: + code = ( + f"import {{ detectAgent }} from {json.dumps(HELPER.as_uri())};" + "process.stdout.write(detectAgent(JSON.parse(process.argv[1]), JSON.parse(process.argv[2])));" + ) + out = subprocess.run([NODE, "--input-type=module", "-e", code, # type: ignore[list-item] + json.dumps(event), json.dumps(env)], + capture_output=True, text=True, timeout=30, check=True) + return out.stdout + + +@pytest.mark.parametrize(("event", "env", "agent"), [ + (CLAUDE_INPUT, {"CLAUDE_PLUGIN_ROOT": "/r"}, "claude"), + # Copilot CLI also sets CLAUDE_PLUGIN_ROOT (and inherits CLAUDECODE when started from Claude Code). + (COPILOT_INPUT, {"CLAUDE_PLUGIN_ROOT": "/r", "CLAUDECODE": "1", "COPILOT_CLI": "1", + "COPILOT_PLUGIN_ROOT": "/r", "PLUGIN_ROOT": "/r"}, "copilot"), + (AGY_INPUT, {"PLUGIN_ROOT": "/r"}, "antigravity"), + (AGY_INPUT, {}, "antigravity"), + (CURSOR_INPUT, {"CLAUDE_PLUGIN_ROOT": "/r"}, "cursor"), + (CLAUDE_INPUT, {"RF_HOOK_AGENT": "opencode"}, "opencode"), + (None, {}, "claude"), + ("not an object", {}, "claude"), +]) +def test_detect_agent(event: object, env: dict[str, str], agent: str) -> None: + assert _detect(event, env) == agent + + +def test_antigravity_shape_has_no_other_field() -> None: + """Antigravity drops an object with fields it does not expect (checked live).""" + out = json.loads(_emit(AGY_INPUT, {"PLUGIN_ROOT": "/r"})) + assert out == {"injectSteps": [{"systemMessage": {"systemMessage": "NOTICE"}}]} + + +def test_cursor_shape() -> None: + assert json.loads(_emit(CURSOR_INPUT, {})) == {"additional_context": "NOTICE"} + + +@pytest.mark.parametrize("env", [{"CLAUDE_PLUGIN_ROOT": "/r"}, {"RF_HOOK_AGENT": "codex"}, + {"RF_HOOK_AGENT": "opencode"}]) +def test_hook_specific_output_shape(env: dict[str, str]) -> None: + out = json.loads(_emit(CLAUDE_INPUT, env, hook_event="UserPromptSubmit")) + assert out == {"hookSpecificOutput": {"hookEventName": "UserPromptSubmit", "additionalContext": "NOTICE"}} + + +def test_unknown_caller_gets_claude_shape() -> None: + out = json.loads(_emit({"something": "else"}, {})) + assert set(out) == {"hookSpecificOutput"} + + +def test_empty_text_writes_nothing() -> None: + assert _emit(CLAUDE_INPUT, {}, text="") == "" + + +def test_copilot_has_no_session_start_channel() -> None: + code = ( + f"import {{ hasContextChannel }} from {json.dumps(HELPER.as_uri())};" + "process.stdout.write(JSON.stringify([hasContextChannel('copilot','SessionStart')," + "hasContextChannel('copilot','PostToolUse'), hasContextChannel('claude','SessionStart')]));" + ) + out = subprocess.run([NODE, "--input-type=module", "-e", code], # type: ignore[list-item] + capture_output=True, text=True, timeout=30, check=True) + assert json.loads(out.stdout) == [False, True, True] diff --git a/plugins/rf-core/tests/test_hook_scripts.py b/plugins/rf-core/tests/test_hook_scripts.py index 99bc109..3eb64b2 100644 --- a/plugins/rf-core/tests/test_hook_scripts.py +++ b/plugins/rf-core/tests/test_hook_scripts.py @@ -1261,6 +1261,60 @@ def test_check_rf_environment_points_to_setup_skill(tmp_path: Path) -> None: assert "rfbrowser init" not in err +def _env_without_robotcode(tmp_path: Path) -> dict: + """PATH with a failing ``robotcode`` first, and no active venv.""" + import stat + fake = tmp_path / "bin" / "robotcode" + fake.parent.mkdir(parents=True, exist_ok=True) + fake.write_text("#!/bin/sh\nexit 1\n", encoding="utf-8") + fake.chmod(fake.stat().st_mode | stat.S_IEXEC) + env = {k: v for k, v in os.environ.items() if k not in ("VIRTUAL_ENV", "RF_HOOK_AGENT")} + env["PATH"] = f"{fake.parent}{os.pathsep}{os.environ.get('PATH', '')}" + return env + + +@pytest.mark.skipif(sys.platform == "win32", reason="fake POSIX python shim") +def test_check_rf_environment_notice_reaches_stdout(tmp_path: Path) -> None: + """hook-output-channels: the robotcode notice is model-facing JSON on stdout, not + only stderr (Claude Code never shows a hook's stderr to the model on exit 0).""" + _fake_venv(tmp_path, {"robot"}) + out, err, rc = _run(CHECK_ENV_SCRIPT, {"cwd": str(tmp_path), "hook_event_name": "SessionStart"}, + env=_env_without_robotcode(tmp_path)) + assert rc == 0 + assert "Robot Framework Environment Check" in err + ctx = _expect_injection(out)["additionalContext"] + assert "robotcode is not installed" in ctx and "robotcode[all]" in ctx + assert "Ask the user" in ctx + assert len(ctx) <= 600 + + +@pytest.mark.skipif(sys.platform == "win32", reason="fake POSIX python shim") +def test_check_rf_environment_notice_in_antigravity_shape(tmp_path: Path) -> None: + _fake_venv(tmp_path, {"robot"}) + event = {"cwd": str(tmp_path), "hookEventName": "SessionStart", "conversationId": "c"} + out, _err, rc = _run(CHECK_ENV_SCRIPT, event, env=_env_without_robotcode(tmp_path)) + assert rc == 0 + payload = json.loads(out) + assert list(payload) == ["injectSteps"] + assert "robotcode is not installed" in payload["injectSteps"][0]["systemMessage"]["systemMessage"] + + +@pytest.mark.skipif(sys.platform == "win32", reason="fake POSIX python shim") +def test_check_rf_environment_no_notice_without_robot_framework(tmp_path: Path) -> None: + """A project without Robot Framework gets no model-facing text. ``python3``/``python`` + on PATH are shadowed too: the interpreter lookup falls back to them.""" + import stat + _fake_venv(tmp_path, set()) + env = _env_without_robotcode(tmp_path) + for name in ("python3", "python"): + fake = tmp_path / "bin" / name + fake.write_text("#!/bin/sh\nexit 1\n", encoding="utf-8") + fake.chmod(fake.stat().st_mode | stat.S_IEXEC) + out, _err, rc = _run(CHECK_ENV_SCRIPT, {"cwd": str(tmp_path)}, env=env) + assert rc == 0 + _expect_no_injection(out) + + @pytest.mark.skipif(sys.platform == "win32", reason="fake POSIX robotcode shim") def test_check_rf_environment_flags_old_robotcode(tmp_path: Path) -> None: import stat @@ -1825,7 +1879,12 @@ def test_missing_robotcode_never_blocks(tmp_path: Path) -> None: suite = tmp_path / "broken.robot" suite.write_text(_BROKEN_FOR, encoding="utf-8") out, err, rc = _run(VALIDATE_SCRIPT, _write_payload(suite, tmp_path), env=_no_robotcode_env(tmp_path)) - assert (rc, out, err) == (0, "", "") + # rf-validation-hooks "robotcode not installed": no block, and the only model-facing + # output is the once-per-session notice that the error check is off. + assert (rc, err) == (0, "") + payload = json.loads(out) + assert "decision" not in payload + assert "was not checked for errors" in payload["hookSpecificOutput"]["additionalContext"] @_posix_only @@ -1925,3 +1984,40 @@ def test_format_check_unset_starts_no_formatter(tmp_path: Path, session_id: str) calls = log.read_text(encoding="utf-8") assert "robocop check" in calls # the wrapper was used for tier 1 assert "robocop format" not in calls + + +# --- rf_error_hints.mjs: robotcode missing or without extras (rf-session-context-hooks) --- + + +def test_error_hint_for_missing_robotcode_extra(tmp_path: Path) -> None: + """Scenario "Missing extra": names the extra, the project's command, no other spellings.""" + (tmp_path / "poetry.lock").write_text("", encoding="utf-8") + event = _bash_event("Usage: robotcode [OPTIONS] COMMAND [ARGS]...\nError: No such command 'doc'.", + f"s-{uuid.uuid4().hex}") + event["cwd"] = str(tmp_path) + stdout, _err, rc = _run(HINTS_SCRIPT, event) + hint = _hint(stdout) + assert rc == 0 + assert "'doc'" in hint and "extras" in hint + assert 'poetry add --group dev "robotcode[all]>=2.8"' in hint + assert "Don't retry other spellings" in hint + assert len(hint) <= 400 + + +@pytest.mark.parametrize("output", ["bash: robotcode: command not found", + "/usr/bin/python3: No module named robotcode"]) +def test_error_hint_for_robotcode_not_installed(tmp_path: Path, output: str) -> None: + event = _bash_event(output, f"s-{uuid.uuid4().hex}") + event["cwd"] = str(tmp_path) + hint = _hint(_run(HINTS_SCRIPT, event)[0]) + assert "robotcode is not installed" in hint and "Ask the user" in hint + assert "robotcode[all]" in hint and "rf-setup" in hint + + +def test_robotcode_hints_once_per_session(tmp_path: Path) -> None: + """Scenario "Once per session".""" + session = f"s-{uuid.uuid4().hex}" + event = _bash_event("Error: No such command 'analyze'.", session) + event["cwd"] = str(tmp_path) + assert "'analyze'" in _hint(_run(HINTS_SCRIPT, event)[0]) + assert _run(HINTS_SCRIPT, event)[0].strip() == "" diff --git a/plugins/rf-core/tests/test_install_advice.py b/plugins/rf-core/tests/test_install_advice.py new file mode 100644 index 0000000..8964591 --- /dev/null +++ b/plugins/rf-core/tests/test_install_advice.py @@ -0,0 +1,60 @@ +"""``_install_advice.mjs``: the robotcode install command follows the project's package +manager (robotcode-prerequisite). Cases live in fixtures/install_advice.json, which +the installer's doctor tests share.""" +from __future__ import annotations + +import json +import os +import shutil +import subprocess +import sys +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[3] +HELPER = ROOT / "plugins" / "rf-core" / "scripts" / "_install_advice.mjs" +CASES = json.loads((Path(__file__).parent / "fixtures" / "install_advice.json").read_text(encoding="utf-8"))["cases"] +NODE = shutil.which("node") +pytestmark = [ + pytest.mark.skipif(NODE is None, reason="node not on PATH"), + pytest.mark.skipif(sys.platform == "win32", reason="fixture paths use the POSIX venv layout"), +] + + +def _advice(project: Path) -> dict: + code = ( + f"import {{ robotcodeInstallAdvice, installAdviceText }} from {json.dumps(HELPER.as_uri())};" + "const p = process.argv[1];" + "process.stdout.write(JSON.stringify({...robotcodeInstallAdvice(p), text: installAdviceText(p)}));" + ) + env = {k: v for k, v in os.environ.items() if k != "VIRTUAL_ENV"} + out = subprocess.run([NODE, "--input-type=module", "-e", code, str(project)], # type: ignore[list-item] + capture_output=True, text=True, timeout=30, check=True, env=env) + return json.loads(out.stdout) + + +@pytest.mark.parametrize("case", CASES, ids=[c["id"] for c in CASES]) +def test_install_advice(tmp_path: Path, case: dict) -> None: + project = tmp_path / "proj" + project.mkdir() + for rel, text in case["files"].items(): + (project / rel).parent.mkdir(parents=True, exist_ok=True) + (project / rel).write_text(text, encoding="utf-8") + advice = _advice(project) + assert advice["manager"] == case["manager"] + venv = str(project / ".venv") + for needle in case["contains"]: + assert needle.replace("{venv}", venv) in advice["text"], advice + for needle in case.get("excludes", []): + assert needle not in advice["text"], advice + for isolated in ("uvx", "pipx", "uv tool"): + assert isolated not in advice["text"] + + +def test_advice_found_from_a_subdirectory(tmp_path: Path) -> None: + """The session cwd may be a subfolder (tests/); the project markers are above it.""" + (tmp_path / "poetry.lock").write_text("", encoding="utf-8") + sub = tmp_path / "tests" / "ui" + sub.mkdir(parents=True) + assert _advice(sub)["manager"] == "poetry" diff --git a/plugins/rf-core/tests/test_robotcode_readiness.py b/plugins/rf-core/tests/test_robotcode_readiness.py new file mode 100644 index 0000000..acc480f --- /dev/null +++ b/plugins/rf-core/tests/test_robotcode_readiness.py @@ -0,0 +1,233 @@ +"""robotcode readiness and install advice (robotcode-prerequisite). + +Stub ``python`` and ``robotcode`` executables in a fake project ``.venv`` stand in +for real installs: the stub python answers the metadata probe with canned +versions, the stub robotcode answers ``--version``. Real-install behaviour was +checked on 2026-11-24 against venvs with no robotcode, base ``robotcode`` 2.8.0 +and ``robotcode[all]`` 2.8.0. +""" +from __future__ import annotations + +import json +import os +import shutil +import subprocess +import sys +import uuid +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[3] +SCRIPTS = ROOT / "plugins" / "rf-core" / "scripts" +NODE = shutil.which("node") +pytestmark = [ + pytest.mark.skipif(NODE is None, reason="node not on PATH"), + pytest.mark.skipif(sys.platform == "win32", reason="POSIX stub executables"), +] + +ALL = {"robotcode": "2.8.0", "robotframework-robocop": "6.9.0", "robotcode-runner": "2.8.0", + "robotcode-analyze": "2.8.0", "robotcode-repl": "2.8.0"} +BASE = {"robotcode": "2.8.0", "robotframework-robocop": None, "robotcode-runner": None, + "robotcode-analyze": None, "robotcode-repl": None} +OLD = {**ALL, "robotcode": "2.7.0", "robotcode-runner": "2.7.0", "robotcode-analyze": "2.7.0", + "robotcode-repl": "2.7.0"} + + +def make_project(tmp_path: Path, dists: dict | None) -> tuple[Path, dict]: + """A project whose .venv has Robot Framework and, when ``dists`` is given, robotcode.""" + project = tmp_path / "proj" + bin_dir = project / ".venv" / "bin" + bin_dir.mkdir(parents=True) + probe_answer = json.dumps(dists or {k: None for k in ALL}) + py = bin_dir / "python" + py.write_text( + "#!/bin/sh\n" + 'if [ "$1" = "-c" ]; then\n' + ' case "$2" in\n' + ' "import robot") exit 0;;\n' + " *robot.version*) echo 7.3; exit 0;;\n" + f" *importlib*) echo '{probe_answer}'; exit 0;;\n" + " esac\n" + "fi\nexit 1\n", + encoding="utf-8", + ) + py.chmod(0o755) + if dists and dists.get("robotcode"): + rc = bin_dir / "robotcode" + rc.write_text(f"#!/bin/sh\necho 'robotcode, version {dists['robotcode']}'\n", encoding="utf-8") + rc.chmod(0o755) + # PATH: a failing robotcode first, so a global install can't answer. + fake_bin = tmp_path / "pathbin" + fake_bin.mkdir() + for name in ("robotcode", "python3", "python"): + f = fake_bin / name + f.write_text("#!/bin/sh\nexit 1\n", encoding="utf-8") + f.chmod(0o755) + env = {k: v for k, v in os.environ.items() if k not in ("VIRTUAL_ENV", "RF_HOOK_AGENT")} + env["PATH"] = f"{fake_bin}{os.pathsep}{Path(NODE).resolve().parent}{os.pathsep}/usr/bin{os.pathsep}/bin" # type: ignore[arg-type] + return project, env + + +def readiness(project: Path, env: dict) -> dict: + code = ( + f"import {{ robotcodeReadiness }} from {json.dumps((SCRIPTS / '_python_env.mjs').as_uri())};" + "const p = process.argv[1];" + "process.stdout.write(JSON.stringify(robotcodeReadiness(p, p + '/.venv/bin/python')));" + ) + out = subprocess.run([NODE, "--input-type=module", "-e", code, str(project)], # type: ignore[list-item] + capture_output=True, text=True, timeout=60, check=True, env=env) + return json.loads(out.stdout) + + +@pytest.mark.parametrize(("dists", "state", "missing", "robocop"), [ + (None, "missing", [], False), + (BASE, "partial", ["runner", "analyze", "repl"], False), + (ALL, "ready", [], True), + (OLD, "old", [], True), +]) +def test_readiness_states(tmp_path: Path, dists: dict | None, state: str, missing: list[str], + robocop: bool) -> None: + project, env = make_project(tmp_path, dists) + r = readiness(project, env) + assert r["state"] == state + assert r["missingExtras"] == missing + assert r["robocop"] is robocop + + +def test_readiness_without_metadata_falls_back_to_version(tmp_path: Path) -> None: + """An interpreter that can't answer the metadata probe: judge by `--version` only.""" + project, env = make_project(tmp_path, ALL) + py = project / ".venv" / "bin" / "python" + py.write_text("#!/bin/sh\nexit 1\n", encoding="utf-8") + r = readiness(project, env) + assert (r["state"], r["version"], r["robocop"]) == ("ready", "2.8.0", None) + + +# --- the SessionStart report (robotcode-prerequisite: "Session start reports robotcode availability") + +CHECK_ENV = SCRIPTS / "check_rf_environment.mjs" + + +def run_report(project: Path, env: dict) -> tuple[str, str, int]: + proc = subprocess.run([NODE, str(CHECK_ENV)], input=json.dumps({"cwd": str(project)}), # type: ignore[list-item] + capture_output=True, text=True, timeout=60, env=env) + return proc.stdout, proc.stderr, proc.returncode + + +def notice(stdout: str) -> str: + return json.loads(stdout)["hookSpecificOutput"]["additionalContext"] if stdout.strip() else "" + + +def test_report_robotcode_missing(tmp_path: Path) -> None: + project, env = make_project(tmp_path, None) + out, err, rc = run_report(project, env) + text = notice(out) + assert rc == 0 + assert "robotcode is not installed" in text + assert "error check on edit" in text and "Ask the user" in text + assert '.venv/bin/python -m pip install "robotcode[all]>=2.8"' in text + assert "robotcode: not installed" in err + + +def test_report_robotcode_without_extras(tmp_path: Path) -> None: + project, env = make_project(tmp_path, BASE) + out, err, rc = run_report(project, env) + text = notice(out) + assert rc == 0 + assert "without the extras runner" in text and "analyze" in text and "repl" in text + assert "robotcode[all]>=2.8" in text + assert "errors are checked on every" not in err + + +def test_report_robotcode_too_old(tmp_path: Path) -> None: + project, env = make_project(tmp_path, OLD) + out, _err, rc = run_report(project, env) + text = notice(out) + assert rc == 0 + assert "robotcode 2.7.0 is older than 2.8" in text and "robotcode[all]>=2.8" in text + + +def test_report_robotcode_ready(tmp_path: Path) -> None: + project, env = make_project(tmp_path, ALL) + out, err, rc = run_report(project, env) + assert rc == 0 + assert out.strip() == "" + assert "robotcode 2.8.0: ready" in err and "errors are checked on every" in err + + +def test_report_follows_the_package_manager(tmp_path: Path) -> None: + """robotcode-prerequisite "Poetry project": the notice gives the Poetry command, no uv add.""" + project, env = make_project(tmp_path, None) + (project / "poetry.lock").write_text("", encoding="utf-8") + text = notice(run_report(project, env)[0]) + assert 'poetry add --group dev "robotcode[all]>=2.8"' in text and "uv add" not in text + + +def test_report_notice_stays_within_budget(tmp_path: Path) -> None: + project, env = make_project(tmp_path, BASE) + assert 0 < len(notice(run_report(project, env)[0])) <= 600 + + +# --- validate_robot.mjs (rf-validation-hooks: "A disabled error check is announced once") + +VALIDATE = SCRIPTS / "validate_robot.mjs" +BROKEN = "*** Test Cases ***\nT\n FOR ${i} IN RANGE 3\n Log ${i}\n" + + +def run_validate(project: Path, env: dict, session: str) -> tuple[str, int]: + suite = project / "bad.robot" + suite.write_text(BROKEN, encoding="utf-8") + event = {"hook_event_name": "PostToolUse", "cwd": str(project), "session_id": session, + "tool_name": "Write", "tool_input": {"file_path": str(suite)}} + proc = subprocess.run([NODE, str(VALIDATE)], input=json.dumps(event), # type: ignore[list-item] + capture_output=True, text=True, timeout=120, env=env) + return proc.stdout, proc.returncode + + +def _base_robotcode(project: Path) -> None: + """Base robotcode: answers --version, but has no `analyze` command (exit 2).""" + rc = project / ".venv" / "bin" / "robotcode" + rc.write_text("#!/bin/sh\n[ \"$1\" = \"--version\" ] && { echo 'robotcode, version 2.8.0'; exit 0; }\n" + "echo \"Error: No such command 'analyze'.\" >&2; exit 2\n", encoding="utf-8") + + +def test_validate_announces_base_robotcode_once(tmp_path: Path) -> None: + project, env = make_project(tmp_path, BASE) + _base_robotcode(project) + session = f"rc-{uuid.uuid4().hex}" + out, rc = run_validate(project, env, session) + assert rc == 0 + text = json.loads(out)["hookSpecificOutput"]["additionalContext"] + assert text.startswith("The edit was applied.") and "not checked for errors" in text + assert "without the extras" in text and "robotcode[all]>=2.8" in text + out2, rc2 = run_validate(project, env, session) + assert rc2 == 0 and out2.strip() == "" + + +def test_validate_announces_missing_robotcode(tmp_path: Path) -> None: + project, env = make_project(tmp_path, None) + out, rc = run_validate(project, env, f"rc-{uuid.uuid4().hex}") + assert rc == 0 + assert "robotcode is not installed" in json.loads(out)["hookSpecificOutput"]["additionalContext"] + + +def test_validate_copilot_gets_the_notice_as_reason(tmp_path: Path) -> None: + """Scenario "Copilot CLI first edit without robotcode": decision/reason, once.""" + project, env = make_project(tmp_path, None) + env = {**env, "COPILOT_CLI": "1", "COPILOT_PLUGIN_ROOT": str(tmp_path)} + session = f"rc-{uuid.uuid4().hex}" + out, rc = run_validate(project, env, session) + payload = json.loads(out) + assert rc == 0 + assert payload["decision"] == "block" + assert payload["reason"].startswith("The edit was applied.") + assert "robotcode[all]>=2.8" in payload["reason"] + assert run_validate(project, env, session)[0].strip() == "" + + +def test_validate_antigravity_gets_inject_steps(tmp_path: Path) -> None: + project, env = make_project(tmp_path, None) + env = {**env, "RF_HOOK_AGENT": "antigravity"} + payload = json.loads(run_validate(project, env, f"rc-{uuid.uuid4().hex}")[0]) + assert list(payload) == ["injectSteps"] diff --git a/plugins/rf-core/variants/antigravity/agents/rf-debug-expert.md b/plugins/rf-core/variants/antigravity/agents/rf-debug-expert.md new file mode 100644 index 0000000..c5a5be1 --- /dev/null +++ b/plugins/rf-core/variants/antigravity/agents/rf-debug-expert.md @@ -0,0 +1,120 @@ +--- +name: rf-debug-expert +description: Diagnoses failing or flaky Robot Framework runs without editing files. Use when a run failed and the cause is not obvious, tests pass locally but fail in CI, or a test fails only sometimes. Returns one report per root cause with category, evidence, fix and prevention. +tools: [Read, Grep, Glob, Bash] +--- + +# Robot Framework Debug Expert + +You diagnose Robot Framework failures and report them; you do not edit files. You read +the recorded results first, group the failures by cause, classify each cause, prove it +when the log is not enough, and return one report block per cause. The calling agent +applies the fix and re-runs the tests. + +## Diagnosis method (agent-owned) + +### 1. Read the recorded run before guessing + +- `robotcode results summary --failed`, then `robotcode results show --failed`: one line + per failing test with its full longname and message. +- `robotcode results log -bl "" --max-depth 2`: the keyword tree of one test. +- When a rerun is needed, keep the full run's output file under its own name + (`robotcode robot --output results/full.xml`) and read it with `-o results/full.xml`; + every later run, including the debugger, overwrites the default `output.xml`. +- Don't read or grep raw `output.xml`. + +### 2. Group failures by cause + +Failures that share a message, a keyword or a suite are one cause until proven otherwise +(`robotcode results stats --by suite --failed`). Diagnose each cause once. + +Give each group a fingerprint: take the error message, keep the status codes and counts, replace concrete ids with a placeholder, and drop hosts, query strings and timestamps. Keep endpoint paths as templates (`/orders/{id}`, not `/orders/42`). The same fingerprint in a later run is the same failure, so it can match a cause that is already known. Put the fingerprint in the bug title or report, not only in a file name. + +### 3. Classify each cause + +| Failure pattern | Category | Typical cause | +|---|---|---| +| element not found, strict mode violation | Locator | wrong selector, element not rendered, iframe or shadow DOM | +| timeout while waiting | Timing | page or request not finished, animation, missing wait condition | +| `!=`, "should be", assertion message | Assertion | wrong expectation, stale data, race condition | +| connection refused, DNS, 5xx | Environment | service down, wrong URL, proxy | +| "No keyword with name", "Multiple keywords" | Keyword resolution | missing import, typo, name conflict, embedded-argument mismatch | +| "contains no keywords", import error of a library | Library | Python library defect or wrong python-path | +| session or driver errors | Driver | driver or browser crash, version mismatch | +| passes and fails on the same code | Flakiness | timing, shared state, test order, external dependency | + +### 4. Prove the cause only when the log doesn't + +Debug one representative test per cause, scoped by longname and without overwriting the +kept output file: + +```bash +robotcode robot-debug -bl "" --output NONE --log NONE --report NONE +``` + +At the `(rdb)` stop use `.where`, `.vars` and `.print ${x}`, run keywords in the paused +context, and end with `.continue`, `.detach` or `.abort`. Run one debugger session at a +time. A failure that only happens in the full run (state leaking between tests) needs the +whole directory with `--break-on-failed-test` instead of one longname. + +### 5. Flakiness: structural fixes only + +| Pattern | Symptom | Fix | +|---|---|---| +| Asynchronous UI | passes locally, fails in CI | wait for the condition that proves readiness (element state, response, text) with the library's waiting keyword | +| Shared state | test B fails only after test A | isolate state in Setup/Teardown, a new browser context or session per test | +| Test data collisions | tests fail when run in parallel | unique identifiers per test, no shared records | +| Stale element | element reference invalid after re-render | re-query the element right before using it | +| External dependency | random 5xx or slow responses | stub or isolate the dependency; mark the test and report it | + +Retry loops and longer timeouts hide the cause; recommend them only as a documented +temporary measure after the root cause is named. + +### 6. Rule out the test before reporting an app or environment cause + +Check these before a cause is reported as an app or environment defect. Each one is a common way to blame the system for a problem in the test. + +- **Read the comparison in the right order.** RequestsLibrary puts the actual value first: in `Expected status: 400 != 200` the server answered 400 and the test expected 200. Other libraries order it differently, so check the library before reading the message. It does not show that validation stopped working. +- **Find the step that failed.** A failure inside a setup keyword says nothing about the criterion under test. Open the failing keyword chain and name the step. +- **Outage first.** After a 502, 503 or 504, or a service restart during the run, later failures can be a cascade. Clear leftover data, rerun only the failed tests, and report the cascade as such. +- **Shared state inside one test.** Data-driven rows that run one after another without a teardown between them can collide. Give each row its own data. +- **Long runs.** A 401 late in a long run usually means an expired token. Renew the token and rerun. +- **Absent is not null.** A missing key fails a null check. Decide from the criterion text whether an absent key or an explicit null is expected. +- **Correlation is not cause.** One crash during a test is a lead. Record the time and the test, and count how many runs crashed out of how many before naming a cause. +- **Trace the expected value.** A red test points to the app only when its expected value traces to the requirement, the spec or the source code, not to the test's own text. + +## Routing + +| Work | Skill | +|------|-------| +| Name conflicts, embedded-argument mismatches, `__init__.robot` setup visibility, variable scope | `rf-language` | +| "contains no keywords", library scope losing state between tests, listener errors | `rf-python-library` | +| Locators, waits and library-specific errors | `rf-browser` / `rf-selenium` (plugin `rf-web`), `rf-requests` / `rf-restinstance` (plugin `rf-api`), `rf-appium` (plugin `rf-mobile`), `rf-platynui` (plugin `rf-desktop`) | +| Missing packages, interpreter or environment errors, robotcode missing | `rf-setup` | +| Keyword names and arguments | `robotcode doc keyword ""` | +| Recorded results, stepping through a test | `robotcode results …`, `robotcode robot-debug -bl` (robotcode plugin) | + +A library skill ships in a technology plugin that may not be installed. When the one you need is not available, name its plugin and suggest installing it; don't continue from memory for library-specific details. + +## Output format + +One block per root cause: + +``` +FAILURE: [longname(s)] +FINGERPRINT: [signature from section 2] +CATEGORY: [Locator | Timing | Assertion | Environment | Keyword resolution | Library | Driver | Flakiness] +ROOT CAUSE: [one-sentence explanation] +EVIDENCE: [error message, log line or debugger value] +FIX: [specific change for the calling agent to make] +PREVENTION: [pattern recommendation] +``` + +## Constraints + +- Start from the recorded results, not from assumptions. +- Name the root cause before proposing a fix; a fix without a cause is a guess. +- Never recommend `Sleep` as a fix; use the library's waiting mechanism. +- Never propose changing an assertion, expected value or tag to make a test pass. When + the evidence shows the expectation itself is wrong, say so explicitly in EVIDENCE. +- Don't write or edit files; return the report. diff --git a/plugins/rf-core/variants/antigravity/agents/rf-migration-guide.md b/plugins/rf-core/variants/antigravity/agents/rf-migration-guide.md new file mode 100644 index 0000000..b82007f --- /dev/null +++ b/plugins/rf-core/variants/antigravity/agents/rf-migration-guide.md @@ -0,0 +1,73 @@ +--- +name: rf-migration-guide +description: Migrates Robot Framework projects. Use when upgrading Robot Framework, replacing legacy syntax such as Run Keyword If or [Return], or moving from SeleniumLibrary to Browser or RequestsLibrary to RESTinstance. Works in phases and reports each file as migrated or unverified. +tools: [Read, Write, Edit, Grep, Glob, Bash, Skill] +--- + +# Robot Framework Migration Guide + +You plan and carry out migrations of Robot Framework projects: RF version upgrades, +legacy-syntax modernization and library switches. You work in phases, verify every +file with deterministic checks, and report a file as migrated only when the checks +are clean. The legacy → modern syntax mapping lives in the `rf-language` skill +(`references/migration.md`: construct, replacement, minimum RF version, Robocop rule). + +## Syntax migration procedure (agent-owned) + +1. **Inventory.** Count deprecated syntax per rule and file: + `robocop check --no-cache --select "DEPR*" --reports rules_by_id tests resources`. + Add the error check `robocop check --no-cache --threshold E tests resources`. + When the target RF version differs from the installed one, pass it: + `robocop check --no-cache --target-version 7 --select "DEPR*" tests resources`. + Select several rule groups by repeating `--select`; a comma list + (`DEPR*` and `ERR*` in one value) matches no rule and reports "No issues found". + The `rf_conventions` report of `rf-language` adds the legacy constructs Robocop does not flag. +2. **Phased plan.** Migrate shared resources first, then suites from the least to the + most dependent. Never migrate everything at once. +3. **Per-file fixes.** Rewrite one file at a time with the `rf-language` migration + table, then re-run the checks on that file. Robocop's `--fix` may apply the + mechanical rewrites, but only on a clean git working tree, followed by a review of + the diff. +4. **Exit check.** A file is migrated when it has zero `DEPR` findings, zero + error-severity findings, and `robotcode analyze code` reports no errors for the + suites that use it. + +Without Robocop, say that deterministic verification is unavailable, point to +`rf-setup` to add `robotcode[all]` (which includes Robocop) as a dev dependency, count legacy +constructs with the `rf_conventions` report the `rf-language` skill documents, and report the migration status as **unverified**. + +## Library migrations + +The keyword tables for a library switch live in the target library's skill: SeleniumLibrary → Browser in `rf-browser` (plugin `rf-web`, `references/migrate-from-selenium.md`), RequestsLibrary → RESTinstance in `rf-restinstance` (plugin `rf-api`, `references/migrate-from-requests.md`). Use the same phases as for syntax: import both libraries during the transition, move shared keywords first, then suites one by one, and remove the old import last. + +When the target library's skill is not available, say which plugin ships it and suggest installing that plugin before you change any library-specific code; don't continue from memory. + +## Routing + +| Work | Skill | +|------|-------| +| Legacy → modern syntax table, `rf_conventions` legacy counts | `rf-language` (`references/migration.md`) | +| Python libraries and listeners to modernize | `rf-python-library` | +| Keyword existence and arguments of the target library | `robotcode doc keyword ""` | +| Browser, SeleniumLibrary specifics; SeleniumLibrary → Browser table | `rf-browser` / `rf-selenium` (plugin `rf-web`) | +| RESTinstance, RequestsLibrary specifics; RequestsLibrary → RESTinstance table | `rf-restinstance` / `rf-requests` (plugin `rf-api`) | +| AppiumLibrary 3.x removed keywords | `rf-appium` (plugin `rf-mobile`) | +| Installing robotcode (with Robocop) or the new library | `rf-setup` | +| Reading results after the migrated run | `robotcode results show --failed` (robotcode plugin) | + +## Verification loop + +For every `.robot`, `.resource` or Python library file you write or change: + +1. Write the change. +2. Confirm keyword names and arguments with `robotcode doc keyword ""` (candidates: `robotcode doc keywords ""`). +3. Run `robotcode analyze code ` and fix every error. It runs nothing, so it misses undefined variables set at run time, a space before `=` in named arguments, embedded-argument mismatches and union-with-`str` conversions; the real run in step 5 catches them. +4. Run `robocop check --no-cache` on the changed files for deprecated syntax (select several rule groups by repeating `--select`, never with a comma list). +5. Run the affected tests by longname, `robotcode robot -bl ""` (longnames from `robotcode discover tests`), or a whole directory, never a single `.robot` file. +6. Read failures with `robotcode results show --failed` and `robotcode results log -bl ""`. + +## Constraints + +- Always propose a phased plan; old and new code coexist during the transition. +- Report per file: findings before, findings after, dry-run result. +- Never claim a migration is complete without a clean exit check. diff --git a/plugins/rf-core/variants/antigravity/agents/rf-test-architect.md b/plugins/rf-core/variants/antigravity/agents/rf-test-architect.md new file mode 100644 index 0000000..b54ffa3 --- /dev/null +++ b/plugins/rf-core/variants/antigravity/agents/rf-test-architect.md @@ -0,0 +1,99 @@ +--- +name: rf-test-architect +description: Designs Robot Framework test projects. Use when starting a test automation project, choosing Browser or SeleniumLibrary, RequestsLibrary or RESTinstance, or restructuring suites, resources and environments. Returns the library choice with reasons, the layout and keyword layers, then writes them. +tools: [Read, Write, Edit, Grep, Glob, Bash, Skill] +--- + +# Robot Framework Test Architect + +You design Robot Framework test automation projects: which libraries to use, how the +project is laid out, and how keywords are layered. You decide the architecture yourself +and hand the writing of suites, keywords and libraries to the skills listed under +Routing. Load a skill before you write the part it owns; do not write from memory. + +## What this agent decides (agent-owned) + +### Web library selection + +Choose **Browser** (`rf-browser` in plugin `rf-web`, the default for new web tests) when the project needs +Playwright features: auto-waiting, network interception, shadow DOM or iframes through +selectors, several browser contexts, or the built-in assertion engine. + +Choose **SeleniumLibrary** (`rf-selenium` in plugin `rf-web`) when the team already runs Selenium or a +WebDriver grid / cloud service, depends on Selenium plugins, or must keep existing +SeleniumLibrary suites. + +### API library selection + +Choose **RequestsLibrary** (`rf-requests` in plugin `rf-api`, the default for API tests) for explicit HTTP +control: sessions, form data, file uploads, XML, and assertions on the response object. + +Choose **RESTinstance** (`rf-restinstance` in plugin `rf-api`) when JSON Schema or OpenAPI contract checks +are central and typed field assertions (`Integer`, `String`) fit the responses. + +### Project layout + +``` +project/ + tests/ # suites by area: web/, api/, mobile/, e2e/ + resources/ # common.resource (library imports) + one .resource per domain + libraries/ # project Python keyword libraries (on the python-path) + variables/ # per-environment variables: dev.yaml, staging.yaml, common.py + data/ # test data files (CSV, JSON) + results/ # output directory +``` + +Reuse an existing resource directory (`resources/`, `keywords/` or `res/`) and never +overwrite existing files. Installing Robot Framework and libraries, `robot.toml` and the +python-path belong to `rf-setup`. + +### Keyword abstraction layers + +1. Test cases read as business steps ("User Can Complete Purchase"). +2. Business keywords in domain resources ("Add Item To Cart", "Complete Checkout"). +3. Technical keywords wrap library calls (a click, filling a form field, an HTTP request). + +## Routing + +| Work | Skill | +|------|-------| +| Suites, test cases, `__init__.robot`, tags, templates, user keywords, resource and variable files | `rf-language` | +| BDD specifications: Given/When/Then suites, step vocabularies, translating Gherkin or acceptance criteria | `rf-bdd` | +| Project keyword libraries and listeners in Python (`libraries/*.py`), checked with its library checker | `rf-python-library` | +| Installing RF and libraries, project layout mechanics, `robot.toml`, python-path | `rf-setup` | +| Web tests with Browser / SeleniumLibrary | `rf-browser` / `rf-selenium` (plugin `rf-web`) | +| API tests with RequestsLibrary / RESTinstance | `rf-requests` / `rf-restinstance` (plugin `rf-api`) | +| Mobile tests | `rf-appium` (plugin `rf-mobile`) | +| Desktop tests | `rf-platynui` (plugin `rf-desktop`) | +| Keyword names and arguments | `robotcode doc keyword ""` | +| Running, reading results, stepping through a test | `robotcode robot -bl`, `robotcode results`, `robotcode robot-debug` (robotcode plugin) | + +A library skill ships in a technology plugin that may not be installed. When the one you need is not available, name its plugin and suggest installing it; don't continue from memory for library-specific details. + +## Workflow + +1. Gather requirements: application under test, team skills, CI environment, coverage goals. +2. Select the libraries with the criteria above and state the reason. +3. Propose the layout and the keyword layers; list the files you will create. +4. Write the suites and resources with `rf-language`, the Python libraries with + `rf-python-library`, and the library calls with the matching library skill. +5. Verify with the loop below before handing the project over. + +## Verification loop + +For every `.robot`, `.resource` or Python library file you write or change: + +1. Write the change. +2. Confirm keyword names and arguments with `robotcode doc keyword ""` (candidates: `robotcode doc keywords ""`). +3. Run `robotcode analyze code ` and fix every error. It runs nothing, so it misses undefined variables set at run time, a space before `=` in named arguments, embedded-argument mismatches and union-with-`str` conversions; the real run in step 5 catches them. +4. Run `robocop check --no-cache` on the changed files for deprecated syntax (select several rule groups by repeating `--select`, never with a comma list). +5. Run the affected tests by longname, `robotcode robot -bl ""` (longnames from `robotcode discover tests`), or a whole directory, never a single `.robot` file. +6. Read failures with `robotcode results show --failed` and `robotcode results log -bl ""`. + +## Constraints + +- Write Robot Framework 7 syntax; the skills show the modern forms. +- Keep control structures out of test bodies; put logic into keywords. +- No `Sleep` for synchronization; use the library's waiting mechanism. +- Never overwrite existing project files; extend them. +- Name the library and the reason for every library choice in your plan. diff --git a/plugins/rf-core/variants/opencode/plugins/rf-core.js b/plugins/rf-core/variants/opencode/plugins/rf-core.js index 345d0bd..2ff640d 100644 --- a/plugins/rf-core/variants/opencode/plugins/rf-core.js +++ b/plugins/rf-core/variants/opencode/plugins/rf-core.js @@ -34,7 +34,7 @@ export function runHook(script, payload) { if (!script || !existsSync(path)) return ""; const r = spawnSync("node", [path], { input: JSON.stringify(payload), encoding: "utf-8", timeout: TIMEOUT_MS, windowsHide: true, - env: { ...process.env, TOOL_INPUT: "" }, + env: { ...process.env, TOOL_INPUT: "", RF_HOOK_AGENT: "opencode" }, }); if (r.error || r.status === null) return ""; if (r.status === 2) return (r.stderr ?? "").trim(); diff --git a/plugins/rf-desktop/.antigravity-plugin/plugin.json b/plugins/rf-desktop/.antigravity-plugin/plugin.json new file mode 100644 index 0000000..946dd48 --- /dev/null +++ b/plugins/rf-desktop/.antigravity-plugin/plugin.json @@ -0,0 +1,10 @@ +{ + "name": "rf-desktop", + "version": "5.1.0", + "description": "PlatynUI skill for Robot Framework desktop UI tests.", + "author": { + "name": "manykarim" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins" +} diff --git a/plugins/rf-mobile/.antigravity-plugin/plugin.json b/plugins/rf-mobile/.antigravity-plugin/plugin.json new file mode 100644 index 0000000..aa04b03 --- /dev/null +++ b/plugins/rf-mobile/.antigravity-plugin/plugin.json @@ -0,0 +1,10 @@ +{ + "name": "rf-mobile", + "version": "5.1.0", + "description": "AppiumLibrary skill for Robot Framework mobile tests on Android and iOS.", + "author": { + "name": "manykarim" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins" +} diff --git a/plugins/rf-stack/.claude-plugin/plugin.json b/plugins/rf-stack/.claude-plugin/plugin.json new file mode 100644 index 0000000..2ef5d1b --- /dev/null +++ b/plugins/rf-stack/.claude-plugin/plugin.json @@ -0,0 +1,20 @@ +{ + "name": "rf-stack", + "version": "5.1.0", + "description": "Claude Code only: installs rf-core together with the RobotCode project's robotcode plugin. Needs the robotframework-agent-plugins marketplace; if your organisation blocks it, install rf-core instead.", + "author": { + "name": "manykarim", + "email": "manykarim@users.noreply.github.com" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins", + "license": "Apache-2.0", + "keywords": [ + "robotframework", + "robotcode" + ], + "dependencies": [ + "rf-core", + "robotcode@robotframework-agent-plugins" + ] +} diff --git a/plugins/rf-stack/README.md b/plugins/rf-stack/README.md new file mode 100644 index 0000000..3aa071f --- /dev/null +++ b/plugins/rf-stack/README.md @@ -0,0 +1,24 @@ +# rf-stack plugin + +One install for Claude Code that brings `rf-core` and the RobotCode project's [`robotcode` plugin](https://github.com/robotcodedev/robotframework-agent-plugins), which teaches the agent the robotcode CLI. The plugin has no skills, subagents or hooks of its own. + +## Install + +Add both marketplaces, then install `rf-stack` and the technology plugins you need: + +```bash +claude plugin marketplace add MarketSquare/robotframework-plugins +claude plugin marketplace add robotcodedev/robotframework-agent-plugins +claude plugin install rf-stack@robotframework-plugins # brings rf-core and robotcode +claude plugin install rf-web@robotframework-plugins +``` + +Claude Code installs dependencies, but it doesn't add a marketplace for you. If you install `rf-stack` before you add `robotframework-agent-plugins`, `rf-core` still works and `rf-stack` reports that `robotcode@robotframework-agent-plugins` is missing. Adding the marketplace afterwards installs it. + +## If your organisation blocks the robotcode marketplace + +Install `rf-core` and the technology plugins directly instead; they don't depend on anything outside this marketplace. The [repository README](https://github.com/MarketSquare/robotframework-plugins#organisations-that-restrict-marketplaces) lists the other ways to get the robotcode skill: an allowlist entry, an internal mirror, or a plain skill folder. + +## Other agents + +Copilot CLI, VS Code, Codex, Cursor, OpenCode and Antigravity don't install plugin dependencies. Install `rf-core` and the `robotcode` plugin there one by one; the repository README has the commands per agent. diff --git a/plugins/rf-stack/catalog.yaml b/plugins/rf-stack/catalog.yaml new file mode 100644 index 0000000..81fa1be --- /dev/null +++ b/plugins/rf-stack/catalog.yaml @@ -0,0 +1,16 @@ +# Programme manifest: see schemas/catalog.schema.json and CONTRIBUTING.md. +# A dependency-only plugin: no skills, subagents or hooks of its own. It installs +# rf-core together with the RobotCode project's robotcode plugin (Claude Code only). +# Tier community: it has no skills to evaluate, so it carries no eval evidence of its own. +name: rf-stack +summary: Claude Code only. Installs rf-core together with the RobotCode project's robotcode plugin in one step; needs the robotframework-agent-plugins marketplace. +tier: community +status: active +kind: dependency-only +maintainers: + - github: manykarim + name: Many Kasiriha +libraries: [] +robotframework: ">=7.0" +agents: + - claude-code diff --git a/plugins/rf-web/.antigravity-plugin/plugin.json b/plugins/rf-web/.antigravity-plugin/plugin.json new file mode 100644 index 0000000..8282289 --- /dev/null +++ b/plugins/rf-web/.antigravity-plugin/plugin.json @@ -0,0 +1,10 @@ +{ + "name": "rf-web", + "version": "5.1.0", + "description": "Browser Library (Playwright) and SeleniumLibrary skills for Robot Framework web tests.", + "author": { + "name": "manykarim" + }, + "homepage": "https://github.com/MarketSquare/robotframework-plugins", + "repository": "https://github.com/MarketSquare/robotframework-plugins" +} diff --git a/schemas/catalog.schema.json b/schemas/catalog.schema.json index c4c665c..9911aa2 100644 --- a/schemas/catalog.schema.json +++ b/schemas/catalog.schema.json @@ -20,6 +20,10 @@ }, "tier": {"enum": ["verified", "community"]}, "status": {"enum": ["active", "deprecated", "removed"]}, + "kind": { + "description": "What the plugin ships. content (default): skills, subagents or hooks. dependency-only: nothing of its own; its plugin.json dependencies install other plugins together (rf-stack).", + "enum": ["content", "dependency-only"] + }, "maintainers": { "description": "Plugin maintainers. An active plugin needs at least one; scripts/build-catalog.py checks it (plugin-lifecycle, 'Ownership can be handed over').", "type": "array", diff --git a/scripts/build-agent-variants.py b/scripts/build-agent-variants.py index bbe8e9e..3ecd8a8 100644 --- a/scripts/build-agent-variants.py +++ b/scripts/build-agent-variants.py @@ -11,6 +11,10 @@ ``permission`` block mapped from the Claude ``tools`` list) and ``variants/opencode/plugins/rf-core.js``, a JS plugin that runs the same hook scripts on OpenCode events. +* Antigravity CLI: ``hooks.json`` at the plugin root (its loader reads only + that file), in Antigravity's format: named hook -> event -> + handlers, Claude tool names mapped to its own. Claude Code, + Copilot CLI and Codex read ``hooks/hooks.json`` and ignore it. Usage:: @@ -131,15 +135,67 @@ def opencode_plugin(hooks_json: Path, support_dir: str) -> str: ) +def antigravity_agent(md: Path) -> str: + """The subagent with ``tools`` as a YAML list: Antigravity's loader skips a + Claude-style ``tools: Read, Grep`` string (agy 1.5.0). Everything else is kept.""" + text = md.read_text(encoding="utf-8") + end = text.index("\n---", 3) + head, rest = text[:end], text[end:] + lines = [] + for line in head.splitlines(): + if line.startswith("tools:") and "[" not in line: + names = [t.strip() for t in line.split(":", 1)[1].split(",") if t.strip()] + line = "tools: [" + ", ".join(names) + "]" + lines.append(line) + return "\n".join(lines) + rest + + +#: Canonical hook event -> Antigravity event; Claude tool matcher -> Antigravity matcher +#: (from `agy plugin import` of rf-core, agy 1.5.0; antigravity-support). +ANTIGRAVITY_EVENTS = {"SessionStart": "SessionStart", "PostToolUse": "PostToolUse", "Stop": "Stop", + "UserPromptSubmit": "PreInvocation"} +ANTIGRAVITY_MATCHERS = {"Write|Edit": "write_to_file|write_file|replace_file_content|edit_file"} +#: Not ported: Antigravity's PostToolUse input carries no tool output to scan. +ANTIGRAVITY_SKIP = {("PostToolUse", "rf_error_hints.mjs")} + + +def antigravity_hooks(hooks_json: Path, name: str) -> str: + hooks = json.loads(hooks_json.read_text(encoding="utf-8"))["hooks"] + events: dict[str, list] = {} + for event, groups in hooks.items(): + target = ANTIGRAVITY_EVENTS.get(event) + if target is None: + continue + for group in groups: + handlers = [] + for handler in group.get("hooks", []): + m = _SCRIPT_RE.search(handler.get("command", "")) + if not m or (event, m.group(1)) in ANTIGRAVITY_SKIP: + continue + # Antigravity runs plugin hooks from the plugin's folder. + handlers.append({"type": "command", "command": f'node "./scripts/{m.group(1)}"', + "timeout": handler.get("timeout", 60)}) + if not handlers: + continue + if target == "PostToolUse": + matcher = ANTIGRAVITY_MATCHERS.get(group.get("matcher", ""), group.get("matcher", "")) + events.setdefault(target, []).append({"matcher": matcher, "hooks": handlers}) + else: # events without a matcher take the handlers directly + events.setdefault(target, []).extend(handlers) + return json.dumps({name: events}, indent=2) + "\n" + + def build(plugin: Path) -> dict[str, str]: """Relative path under ``plugin`` -> file content.""" out: dict[str, str] = {} for md in sorted((plugin / "agents").glob("*.md")): out[f"variants/codex/agents/{md.stem}.toml"] = codex_agent(md) out[f"variants/opencode/agents/{md.name}"] = opencode_agent(md) + out[f"variants/antigravity/agents/{md.name}"] = antigravity_agent(md) # Named after the plugin; it runs the scripts from /-files/. out[f"variants/opencode/plugins/{plugin.name}.js"] = opencode_plugin(plugin / "hooks" / "hooks.json", f"{plugin.name}-files") + out["hooks.json"] = antigravity_hooks(plugin / "hooks" / "hooks.json", plugin.name) return out diff --git a/scripts/build-catalog.py b/scripts/build-catalog.py index 2b49f3e..200ec3a 100644 --- a/scripts/build-catalog.py +++ b/scripts/build-catalog.py @@ -41,6 +41,10 @@ from jsonschema import Draft202012Validator REPO = Path(__file__).resolve().parents[1] +#: Dependencies outside this marketplace that a dependency-only plugin may declare +#: (companion-plugin-dependency): the RobotCode project's robotcode plugin, as a +#: bare string. Its marketplace goes into ``allowCrossMarketplaceDependenciesOn``. +EXTERNAL_DEPENDENCIES = frozenset({"robotcode@robotframework-agent-plugins"}) SCHEMA_REL = Path("schemas") / "catalog.schema.json" MANIFEST = "catalog.yaml" @@ -74,9 +78,29 @@ def tier(self) -> str: @property def dependencies(self) -> list[str]: - """Names of the plugins this one depends on (``plugin.json``).""" - deps = self.plugin_json.get("dependencies", []) - return [d if isinstance(d, str) else d["name"] for d in deps] + """Names of the plugins of this marketplace this one depends on (``plugin.json``).""" + return [d for d in self._dependency_ids() if "@" not in d] + + @property + def external_dependencies(self) -> list[str]: + """``name@marketplace`` dependencies outside this marketplace.""" + return [d for d in self._dependency_ids() if "@" in d] + + def _dependency_ids(self) -> list[str]: + out = [] + for d in self.plugin_json.get("dependencies", []): + if isinstance(d, str): + out.append(d) + elif d.get("marketplace"): + out.append(f"{d['name']}@{d['marketplace']}") + else: + out.append(d["name"]) + return out + + @property + def dependency_only(self) -> bool: + """Ships nothing of its own; installs its dependencies together (``kind: dependency-only``).""" + return self.manifest.get("kind") == "dependency-only" @property def has_content(self) -> bool: @@ -339,6 +363,27 @@ def plugin_json_text(p: Plugin, version: str) -> str: return _dump_json(data) +ANTIGRAVITY_MANIFEST_REL = Path(".antigravity-plugin") / "plugin.json" + + +def antigravity_manifest_text(p: Plugin, version: str) -> str: + """Antigravity CLI's manifest (antigravity-support): its schema refuses unknown keys, + so only the fields it defines, from the Claude manifest.""" + pj = p.plugin_json + data: dict[str, Any] = {"name": p.name, "version": plugin_version(version)} + if pj.get("description"): + data["description"] = pj["description"] + author = pj.get("author") + if isinstance(author, dict) and author.get("name"): + data["author"] = {"name": author["name"]} + elif isinstance(author, str): + data["author"] = author + for key in ("homepage", "repository"): + if isinstance(pj.get(key), str): + data[key] = pj[key] + return _dump_json(data) + + def plugin_version_problems(root: Path, plugins: list[Plugin], version: str) -> list[str]: """A plugin.json whose version isn't the release version, naming both.""" want = plugin_version(version) @@ -410,6 +455,9 @@ def render_catalog_doc(plugins: list[Plugin], version: str) -> str: if m["libraries"]: out.append("- **Libraries:**") out += [f" - {_library_line(lib)}" for lib in m["libraries"]] + if p.dependency_only: + brings = ", ".join(f"`{d}`" for d in p.plugin_json.get("dependencies", []) if isinstance(d, str)) + out.append(f"- **Brings:** {brings} (nothing of its own; for {', '.join(m['agents'])} only)") out.append(f"- **Tested with:** {', '.join(m['agents'])}") out.append(f"- **Maintainers:** {_maintainers(p)}") out.append(f"- **Install (Claude Code):** `/plugin install {p.name}@robotframework-plugins`") @@ -448,6 +496,11 @@ def render_marketplace(current: dict[str, Any], plugins: list[Plugin]) -> dict[s else: out.pop("metadata", None) out["plugins"] = [marketplace_entry(p) for p in listed(plugins)] + cross = sorted({d.split("@", 1)[1] for p in listed(plugins) for d in p.external_dependencies}) + if cross: + out["allowCrossMarketplaceDependenciesOn"] = cross + else: + out.pop("allowCrossMarketplaceDependenciesOn", None) renames = dict(out.get("renames", {})) for p in plugins: if p.status == "removed": @@ -566,14 +619,25 @@ def library_skill_problems(plugins: list[Plugin]) -> list[str]: def content_problems(plugins: list[Plugin]) -> list[str]: - """A listed plugin ships content of its own; dependencies name listed plugins, - without a version range (release-train: one version from one commit).""" + """A listed plugin ships content of its own, unless it is dependency-only; dependencies + name listed plugins, without a version range (release-train: one version from one + commit). Only a dependency-only plugin may name a plugin of another marketplace, and + only one of EXTERNAL_DEPENDENCIES (companion-plugin-dependency).""" by_name = {p.name: p for p in plugins} problems = [] for p in listed(plugins): rel = f"plugins/{p.name}" - if not p.has_content: + if not p.has_content and not p.dependency_only: problems.append(f"{rel}: ships no skill, subagent or hook; a plugin needs content") + if p.dependency_only and p.has_content: + problems.append(f"{rel}: is dependency-only but ships content; drop `kind: dependency-only`") + if p.dependency_only and not p.plugin_json.get("dependencies"): + problems.append(f"{rel}: is dependency-only but declares no dependencies") + for dep in p.external_dependencies: + if dep not in EXTERNAL_DEPENDENCIES or not p.dependency_only: + problems.append( + f"{rel}/.claude-plugin/plugin.json: dependency {dep!r} names another marketplace; only a " + f"dependency-only plugin may, and only {', '.join(sorted(EXTERNAL_DEPENDENCIES))}") for dep in p.dependencies: if dep not in by_name or by_name[dep].status not in LISTED: problems.append(f"{rel}/.claude-plugin/plugin.json: dependency {dep!r} is not a listed plugin") @@ -619,6 +683,8 @@ def generated_files(root: Path, plugins: list[Plugin]) -> dict[Path, str]: files[init] = render_init(init.read_text(encoding="utf-8"), version) for p in listed(plugins): files[p.path / ".claude-plugin" / "plugin.json"] = plugin_json_text(p, version) + if not p.dependency_only: + files[p.path / ANTIGRAVITY_MANIFEST_REL] = antigravity_manifest_text(p, version) return files diff --git a/scripts/templates/opencode-plugin.js b/scripts/templates/opencode-plugin.js index 04718ef..da4e63b 100644 --- a/scripts/templates/opencode-plugin.js +++ b/scripts/templates/opencode-plugin.js @@ -31,7 +31,7 @@ export function runHook(script, payload) { if (!script || !existsSync(path)) return ""; const r = spawnSync("node", [path], { input: JSON.stringify(payload), encoding: "utf-8", timeout: TIMEOUT_MS, windowsHide: true, - env: { ...process.env, TOOL_INPUT: "" }, + env: { ...process.env, TOOL_INPUT: "", RF_HOOK_AGENT: "opencode" }, }); if (r.error || r.status === null) return ""; if (r.status === 2) return (r.stderr ?? "").trim(); diff --git a/tests/installer/test_adapter_antigravity.py b/tests/installer/test_adapter_antigravity.py new file mode 100644 index 0000000..fba1f73 --- /dev/null +++ b/tests/installer/test_adapter_antigravity.py @@ -0,0 +1,80 @@ +"""The ``antigravity`` adapter (installer-plugin-bootstrap, "Installer supports Antigravity"; +antigravity-support). The folder layout was checked live with agy 1.5.0: Antigravity +loads ``.agents/plugins//`` and ``~/.gemini/config/plugins//``.""" +from __future__ import annotations + +import json +import shutil +import subprocess +from pathlib import Path + +import pytest + +from robotframework_plugins import transforms as _x +from robotframework_plugins.cli import main + +AGY = shutil.which("agy") + + +@pytest.fixture(autouse=True) +def _force_node(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(_x, "node_available", lambda: True) + + +def _install(*extra: str) -> int: + return main(["install", "--agent", "antigravity", "--yes", *extra]) + + +def test_project_install_writes_the_plugin_folder(tmp_path: Path, fake_home: Path) -> None: + project = tmp_path / "proj" + project.mkdir() + assert _install("--scope", "project", "--project", str(project), "--plugins", "rf-core,rf-web") == 0 + core = project / ".agents" / "plugins" / "rf-core" + manifest = json.loads((core / ".antigravity-plugin" / "plugin.json").read_text(encoding="utf-8")) + assert manifest["name"] == "rf-core" + assert {p.name for p in (core / "skills").iterdir()} == {"rf-bdd", "rf-language", "rf-python-library", "rf-setup"} + agents = sorted((core / "agents").glob("*.md")) + assert [a.stem for a in agents] == ["rf-debug-expert", "rf-migration-guide", "rf-test-architect"] + assert all("\ntools: [" in a.read_text(encoding="utf-8") for a in agents) + hooks = json.loads((core / "hooks.json").read_text(encoding="utf-8")) + assert set(hooks["rf-core"]) == {"SessionStart", "PreInvocation", "PostToolUse", "Stop"} + assert (core / "scripts" / "check_rf_environment.mjs").is_file() + assert not (core / "hooks").exists() and not (core / "variants").exists() + web = project / ".agents" / "plugins" / "rf-web" + assert (web / ".antigravity-plugin" / "plugin.json").is_file() and not (web / "hooks.json").exists() + + +def test_user_install_and_uninstall(tmp_path: Path, fake_home: Path) -> None: + assert _install("--scope", "user", "--plugins", "rf-core") == 0 + core = fake_home / ".gemini" / "config" / "plugins" / "rf-core" + assert (core / "hooks.json").is_file() + assert main(["uninstall", "--agent", "antigravity", "--scope", "user"]) == 0 + assert not (core / "hooks.json").exists() and not list(core.rglob("SKILL.md")) + + +def test_robotcode_skill_goes_to_plain_skills(tmp_path: Path, fake_home: Path) -> None: + clone = tmp_path / "clone" + skill = clone / "plugins" / "robotcode" / "skills" / "robotcode" + skill.mkdir(parents=True) + (skill / "SKILL.md").write_text("---\nname: robotcode\ndescription: x\n---\n", encoding="utf-8") + (clone / "plugins" / "robotcode" / "LICENSE").write_text("Apache\n", encoding="utf-8") + project = tmp_path / "proj" + project.mkdir() + assert _install("--scope", "project", "--project", str(project), "--plugins", "rf-core", + "--robotcode-source", str(clone)) == 0 + assert (project / ".agents" / "skills" / "robotcode" / "SKILL.md").is_file() + assert (project / ".agents" / "skills" / "robotcode" / "LICENSE").is_file() + + +@pytest.mark.skipif(AGY is None, reason="agy not on PATH") +def test_written_folder_passes_agy_validate(tmp_path: Path, fake_home: Path) -> None: + """antigravity-support "Validation passes".""" + project = tmp_path / "proj" + project.mkdir() + assert _install("--scope", "project", "--project", str(project), "--plugins", "rf-core") == 0 + r = subprocess.run([AGY, "plugin", "validate", str(project / ".agents" / "plugins" / "rf-core"), "--strict", # type: ignore[list-item] + "--json"], capture_output=True, text=True, timeout=60) + assert r.returncode == 0, r.stdout + r.stderr + report = json.loads(r.stdout) + assert report["components"]["skills"] == 4 and report["components"]["agents"] == 3 + assert report["components"]["hooks"] == 1 diff --git a/tests/installer/test_no_network.py b/tests/installer/test_no_network.py index 74612b9..6f93301 100644 --- a/tests/installer/test_no_network.py +++ b/tests/installer/test_no_network.py @@ -10,7 +10,7 @@ from robotframework_plugins.cli import main -AGENTS = ("claude-code", "copilot", "codex", "cursor", "goose", "opencode", "claude-desktop") +AGENTS = ("claude-code", "copilot", "codex", "cursor", "goose", "opencode", "claude-desktop", "antigravity") class NetworkCall(AssertionError): diff --git a/tests/installer/test_plugin_mode.py b/tests/installer/test_plugin_mode.py index 43829c8..b9fa923 100644 --- a/tests/installer/test_plugin_mode.py +++ b/tests/installer/test_plugin_mode.py @@ -28,7 +28,9 @@ def _force_node(monkeypatch: pytest.MonkeyPatch) -> None: def _install(project: Path, *extra: str) -> int: - return main(["install", "--scope", "project", "--project", str(project), *extra]) + """These tests cover our marketplace; the robotcode companion entries are covered in + test_robotcode_companion.py, so they are left out here.""" + return main(["install", "--scope", "project", "--project", str(project), "--no-robotcode", *extra]) def _settings(path: Path) -> dict: @@ -108,7 +110,7 @@ def test_codex_plugin_mode_installs_agents_and_prints_commands( ) -> None: import subprocess calls: list[list[str]] = [] - monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: calls.append(cmd)) # must not run + monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: calls.append(cmd) if cmd[0] == "codex" else None) # must not run project = tmp_path / "proj" project.mkdir() assert _install(project, "--agent", "codex", "--mode", "plugin", "--ref", "v2.1.0") == 0 @@ -132,7 +134,7 @@ class _Done: returncode = 0 monkeypatch.setattr(shutil, "which", lambda name: f"/usr/bin/{name}") - monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: calls.append(cmd) or _Done()) + monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: (calls.append(cmd) if cmd[0] == "codex" else None) or _Done()) project = tmp_path / "proj" project.mkdir() assert _install(project, "--agent", "codex", "--mode", "plugin", "--yes") == 0 diff --git a/tests/installer/test_plugin_selection.py b/tests/installer/test_plugin_selection.py index 5852d06..f8090df 100644 --- a/tests/installer/test_plugin_selection.py +++ b/tests/installer/test_plugin_selection.py @@ -91,7 +91,7 @@ def test_plugin_mode_enables_each_selected_plugin(two_plugin_bundle: Path, fake_ project = tmp_path / "proj" project.mkdir() assert main(["install", "--scope", "project", "--project", str(project), "--agent", "claude-code", - "--mode", "plugin", "--yes", "--plugins", "rf-core,rf-web"]) == 0 + "--mode", "plugin", "--yes", "--plugins", "rf-core,rf-web", "--no-robotcode"]) == 0 enabled = json.loads((project / ".claude" / "settings.json").read_text())["enabledPlugins"] assert enabled == {"rf-core@robotframework-plugins": True, "rf-web@robotframework-plugins": True} diff --git a/tests/installer/test_project_detection.py b/tests/installer/test_project_detection.py index f3786b2..12571b1 100644 --- a/tests/installer/test_project_detection.py +++ b/tests/installer/test_project_detection.py @@ -116,6 +116,6 @@ def test_plugin_mode_upgrade_replaces_the_removed_bundle(fake_home: Path, tmp_pa settings.write_text(json.dumps({"enabledPlugins": {"rf-agentskills@robotframework-plugins": True}})) (project / "requirements.txt").write_text("robotframework-browser\n") assert main(["install", "--scope", "project", "--project", str(project), "--agent", "claude-code", - "--mode", "plugin", "--yes"]) == 0 + "--mode", "plugin", "--yes", "--no-robotcode"]) == 0 assert json.loads(settings.read_text())["enabledPlugins"] == { f"{p}@robotframework-plugins": True for p in ("rf-core", "rf-web", "rf-api", "rf-mobile", "rf-desktop")} diff --git a/tests/installer/test_robotcode_companion.py b/tests/installer/test_robotcode_companion.py new file mode 100644 index 0000000..510994f --- /dev/null +++ b/tests/installer/test_robotcode_companion.py @@ -0,0 +1,259 @@ +"""The installer sets up the RobotCode project's robotcode plugin or skill next to ours +(installer-plugin-bootstrap, "Installer sets up the robotcode companion").""" +from __future__ import annotations + +import json +from pathlib import Path + +import pytest +from robotframework_plugins import transforms as _x +from robotframework_plugins.cli import main + +CONTENT = ("rf-core", "rf-web", "rf-api", "rf-mobile", "rf-desktop") + + +@pytest.fixture(autouse=True) +def _force_node(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(_x, "node_available", lambda: True) + + +def _install(project: Path, *extra: str) -> int: + return main(["install", "--scope", "project", "--project", str(project), *extra]) + + +def _settings(path: Path) -> dict: + return json.loads(path.read_text(encoding="utf-8")) + + +def test_claude_code_enables_rf_stack_and_robotcode(tmp_path: Path, fake_home: Path) -> None: + project = tmp_path / "proj" + project.mkdir() + assert _install(project, "--agent", "claude-code", "--mode", "plugin", "--yes") == 0 + data = _settings(project / ".claude" / "settings.json") + assert data["extraKnownMarketplaces"]["robotframework-agent-plugins"] == { + "source": {"source": "github", "repo": "robotcodedev/robotframework-agent-plugins"}} + assert data["enabledPlugins"]["rf-stack@robotframework-plugins"] is True + assert data["enabledPlugins"]["robotcode@robotframework-agent-plugins"] is True + assert "robotframework-plugins" in data["extraKnownMarketplaces"] + + +def test_mirror_source(tmp_path: Path, fake_home: Path) -> None: + """Scenario "Mirror source": the entry uses the mirror's git URL.""" + project = tmp_path / "proj" + project.mkdir() + url = "https://git.example.com/mirror/robotframework-agent-plugins" + assert _install(project, "--agent", "claude-code", "--mode", "plugin", "--yes", "--robotcode-source", url) == 0 + entry = _settings(project / ".claude" / "settings.json")["extraKnownMarketplaces"]["robotframework-agent-plugins"] + assert entry == {"source": {"source": "git", "url": url}} + + +def test_local_mirror_folder(tmp_path: Path, fake_home: Path) -> None: + project = tmp_path / "proj" + project.mkdir() + mirror = tmp_path / "mirror" + mirror.mkdir() + assert _install(project, "--agent", "claude-code", "--mode", "plugin", "--yes", + "--robotcode-source", str(mirror)) == 0 + entry = _settings(project / ".claude" / "settings.json")["extraKnownMarketplaces"]["robotframework-agent-plugins"] + assert entry == {"source": {"source": "directory", "path": str(mirror.resolve())}} + + +def test_copilot_enables_robotcode_without_rf_stack(tmp_path: Path, fake_home: Path) -> None: + """Copilot CLI doesn't resolve dependencies: robotcode itself, never rf-stack.""" + project = tmp_path / "proj" + project.mkdir() + assert _install(project, "--agent", "copilot", "--mode", "plugin", "--yes") == 0 + for path in (project / ".claude" / "settings.json", project / ".github" / "copilot" / "settings.json"): + enabled = _settings(path)["enabledPlugins"] + assert enabled["robotcode@robotframework-agent-plugins"] is True, path + assert "rf-stack@robotframework-plugins" not in enabled, path + + +def test_no_robotcode_leaves_it_out(tmp_path: Path, fake_home: Path) -> None: + project = tmp_path / "proj" + project.mkdir() + assert _install(project, "--agent", "claude-code", "--mode", "plugin", "--yes", "--no-robotcode") == 0 + data = _settings(project / ".claude" / "settings.json") + assert "robotframework-agent-plugins" not in data["extraKnownMarketplaces"] + assert not any("rf-stack" in k or "robotcode" in k for k in data["enabledPlugins"]) + + +def test_uninstall_removes_the_companion_entries(tmp_path: Path, fake_home: Path) -> None: + project = tmp_path / "proj" + project.mkdir() + settings = project / ".claude" / "settings.json" + settings.parent.mkdir() + settings.write_text('{"enabledPlugins": {"other@mkt": true}}\n', encoding="utf-8") + assert _install(project, "--agent", "claude-code", "--mode", "plugin", "--yes") == 0 + assert main(["uninstall", "--agent", "claude-code", "--scope", "project", "--project", str(project)]) == 0 + data = _settings(settings) + assert data.get("enabledPlugins") == {"other@mkt": True} + assert "robotframework-agent-plugins" not in data.get("extraKnownMarketplaces", {}) + + +def test_codex_adds_the_robotcode_marketplace_and_plugin( + tmp_path: Path, fake_home: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + import shutil + import subprocess + calls: list[list[str]] = [] + + class _Done: + returncode = 0 + + monkeypatch.setattr(shutil, "which", lambda name: f"/usr/bin/{name}") + monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: (calls.append(cmd) if cmd[0] == "codex" else None) or _Done()) + project = tmp_path / "proj" + project.mkdir() + assert _install(project, "--agent", "codex", "--mode", "plugin", "--yes") == 0 + assert calls[-2:] == [ + ["codex", "plugin", "marketplace", "add", "robotcodedev/robotframework-agent-plugins"], + ["codex", "plugin", "add", "robotcode@robotframework-agent-plugins"], + ] + assert not any("rf-stack" in " ".join(c) for c in calls) + + +def test_cursor_prints_the_robotcode_steps(tmp_path: Path, fake_home: Path, + capsys: pytest.CaptureFixture[str]) -> None: + project = tmp_path / "proj" + project.mkdir() + assert _install(project, "--agent", "cursor", "--mode", "plugin") == 0 + out = " ".join(capsys.readouterr().out.split()) + assert "https://github.com/robotcodedev/robotframework-agent-plugins" in out + assert "robotcode@robotframework-agent-plugins" in out + + +@pytest.mark.parametrize("agent", ["codex", "copilot", "cursor", "opencode", "goose", "claude-desktop"]) +def test_installer_skips_rf_stack_outside_claude_code(tmp_path: Path, fake_home: Path, agent: str, + monkeypatch: pytest.MonkeyPatch) -> None: + """Scenario "Installer skips rf-stack outside Claude Code" (all plugins, files and plugin mode).""" + import shutil + import subprocess + + class _Done: + returncode = 0 + + monkeypatch.setattr(shutil, "which", lambda name: f"/usr/bin/{name}") + monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: _Done()) + project = tmp_path / "proj" + project.mkdir() + for mode in ("files", "plugin"): + assert _install(project, "--agent", agent, "--mode", mode, "--plugins", "all", "--yes") == 0 + assert not list(project.rglob("rf-stack*")) + for settings in project.rglob("settings.json"): + assert "rf-stack" not in settings.read_text(encoding="utf-8"), settings + + +# --- file mode: the robotcode skill, only with --robotcode-source (design D7) ----------- + +import io # noqa: E402 +import socket # noqa: E402 +import tarfile # noqa: E402 + +from robotframework_plugins import _robotcode_skill # noqa: E402 + + +def _fixture_clone(root: Path) -> Path: + """A clone of robotframework-agent-plugins, reduced to the robotcode skill.""" + skill = root / "plugins" / "robotcode" / "skills" / "robotcode" + (skill / "references").mkdir(parents=True) + (skill / "SKILL.md").write_text("---\nname: robotcode\ndescription: Drive the robotcode CLI.\n---\nBody\n", + encoding="utf-8") + (skill / "references" / "install.md").write_text("install\n", encoding="utf-8") + (root / "plugins" / "robotcode" / "LICENSE").write_text("Apache License 2.0\n", encoding="utf-8") + return root + + +@pytest.fixture +def no_network(monkeypatch: pytest.MonkeyPatch) -> None: + def refuse(*args, **kwargs): + raise AssertionError(f"network call during install: {args[:2]!r}") + + for target, name in ((socket.socket, "connect"), (socket, "create_connection"), (socket, "getaddrinfo")): + monkeypatch.setattr(target, name, refuse) + + +def _skill_dirs(root: Path, exclude: Path | None = None) -> list[Path]: + """Installed robotcode skill folders under ``root`` (not the fixture clone itself).""" + found = {p.parent for p in root.rglob("SKILL.md") if p.parent.name == "robotcode"} + return sorted(d for d in found if exclude is None or exclude not in d.parents) + + +def test_file_mode_copies_the_skill_from_a_local_source(tmp_path: Path, fake_home: Path, no_network: None) -> None: + """Scenario "File mode copies the skill from a local source".""" + project = tmp_path / "proj" + project.mkdir() + clone = _fixture_clone(tmp_path / "clone") + assert _install(project, "--agent", "opencode", "--mode", "files", "--yes", + "--robotcode-source", str(clone)) == 0 + [skill] = _skill_dirs(project) + assert (skill / "LICENSE").read_text(encoding="utf-8").startswith("Apache") + assert (skill / "references" / "install.md").is_file() + from robotframework_plugins import manifest as _m + manifest = _m.manifest_path_for("project", project) + assert "robotcode" in {f["plugin"] for ins in json.loads(manifest.read_text())["installations"] for f in ins["files"]} + # A later install without the flag keeps the copy. + assert _install(project, "--agent", "opencode", "--mode", "files", "--yes") == 0 + assert _skill_dirs(project) + assert main(["uninstall", "--agent", "opencode", "--scope", "project", "--project", str(project)]) == 0 + assert _skill_dirs(project) == [] + + +def test_file_mode_stays_offline_by_default(tmp_path: Path, fake_home: Path, no_network: None, + capsys: pytest.CaptureFixture[str]) -> None: + """Scenario "File mode stays offline by default".""" + project = tmp_path / "proj" + project.mkdir() + assert _install(project, "--agent", "opencode", "--mode", "files", "--yes") == 0 + assert _skill_dirs(project) == [] + out = " ".join(capsys.readouterr().out.split()) + assert "--robotcode-source" in out and "git clone --depth 1 --branch robotcode--v2.8.0" in out + + +@pytest.mark.parametrize("agent", ["claude-code", "codex", "cursor", "copilot"]) +def test_file_mode_skill_for_other_agents(tmp_path: Path, fake_home: Path, no_network: None, agent: str) -> None: + project = tmp_path / "proj" + project.mkdir() + clone = _fixture_clone(tmp_path / "clone") + assert _install(project, "--agent", agent, "--mode", "files", "--yes", "--robotcode-source", str(clone)) == 0 + skills = _skill_dirs(fake_home, exclude=clone) + assert skills and all((s / "LICENSE").is_file() for s in skills) + + +def test_bad_source_fails_cleanly(tmp_path: Path, fake_home: Path, capsys: pytest.CaptureFixture[str]) -> None: + project = tmp_path / "proj" + project.mkdir() + empty = tmp_path / "empty" + empty.mkdir() + assert _install(project, "--agent", "opencode", "--mode", "files", "--yes", "--robotcode-source", str(empty)) == 1 + assert "no robotcode skill" in " ".join(capsys.readouterr().err.split()) + + +def _tar(entries: dict[str, bytes]) -> bytes: + buf = io.BytesIO() + with tarfile.open(fileobj=buf, mode="w:gz") as tf: + for name, data in entries.items(): + info = tarfile.TarInfo(name) + info.size = len(data) + tf.addfile(info, io.BytesIO(data)) + return buf.getvalue() + + +def test_archive_extracts_only_the_robotcode_plugin(tmp_path: Path) -> None: + archive = tmp_path / "a.tar.gz" + archive.write_bytes(_tar({ + "repo-tag/plugins/robotcode/skills/robotcode/SKILL.md": b"---\nname: robotcode\n---\n", + "repo-tag/plugins/robotcode/LICENSE": b"Apache", + "repo-tag/README.md": b"not taken", + "repo-tag/plugins/other/x.md": b"not taken", + })) + out = _robotcode_skill._extract_archive(archive, tmp_path / "repo") + assert sorted(p.relative_to(out).as_posix() for p in out.rglob("*") if p.is_file()) == [ + "plugins/robotcode/LICENSE", "plugins/robotcode/skills/robotcode/SKILL.md"] + + +def test_archive_with_an_unsafe_entry_is_refused(tmp_path: Path) -> None: + archive = tmp_path / "a.tar.gz" + archive.write_bytes(_tar({"repo-tag/plugins/robotcode/../../evil": b"x"})) + with pytest.raises(_robotcode_skill.SkillSourceError): + _robotcode_skill._extract_archive(archive, tmp_path / "repo") diff --git a/tests/installer/test_robotcode_env.py b/tests/installer/test_robotcode_env.py new file mode 100644 index 0000000..f1d49dc --- /dev/null +++ b/tests/installer/test_robotcode_env.py @@ -0,0 +1,96 @@ +"""robotcode readiness and install advice in the installer (installer-plugin-bootstrap, +"Doctor reports the CLI"). The advice cases are the hooks' own table: +plugins/rf-core/tests/fixtures/install_advice.json.""" +from __future__ import annotations + +import json +import os +import sys +from pathlib import Path + +import pytest +from robotframework_plugins import _robotcode_env +from robotframework_plugins.cli import main + +ROOT = Path(__file__).resolve().parents[2] +CASES = json.loads((ROOT / "plugins" / "rf-core" / "tests" / "fixtures" / "install_advice.json") + .read_text(encoding="utf-8"))["cases"] +posix_only = pytest.mark.skipif(sys.platform == "win32", reason="POSIX venv layout and stub interpreters") + + +@posix_only +@pytest.mark.parametrize("case", CASES, ids=[c["id"] for c in CASES]) +def test_install_advice_matches_the_hooks(tmp_path: Path, case: dict) -> None: + project = tmp_path / "proj" + project.mkdir() + for rel, text in case["files"].items(): + (project / rel).parent.mkdir(parents=True, exist_ok=True) + (project / rel).write_text(text, encoding="utf-8") + env = {k: v for k, v in os.environ.items() if k != "VIRTUAL_ENV"} + advice = _robotcode_env.install_advice(project, env) + assert advice.manager == case["manager"] + for needle in case["contains"]: + assert needle in advice.text, advice + for needle in case.get("excludes", []): + assert needle not in advice.text, advice + + +def _stub_venv(project: Path, dists: dict | None) -> dict[str, str]: + """A project .venv whose python answers the metadata probe with ``dists``.""" + py = project / ".venv" / "bin" / "python" + py.parent.mkdir(parents=True) + answer = json.dumps(dists or {}) + py.write_text(f"#!/bin/sh\necho '{answer}'\n", encoding="utf-8") + py.chmod(0o755) + return {k: v for k, v in os.environ.items() if k != "VIRTUAL_ENV"} + + +ALL = {"robotcode": "2.8.0", "robotframework": "7.3", "robotcode-runner": "2.8.0", + "robotcode-analyze": "2.8.0", "robotcode-repl": "2.8.0"} + + +@posix_only +@pytest.mark.parametrize(("dists", "state", "missing"), [ + ({"robotframework": "7.3"}, "missing", ()), + ({**ALL, "robotcode-runner": None, "robotcode-analyze": None, "robotcode-repl": None}, "partial", + ("runner", "analyze", "repl")), + ({**ALL, "robotcode": "2.7.0"}, "old", ()), + (ALL, "ready", ()), +]) +def test_readiness(tmp_path: Path, dists: dict, state: str, missing: tuple) -> None: + env = _stub_venv(tmp_path, dists) + r = _robotcode_env.readiness(tmp_path, env) + assert (r.state, r.missing_extras) == (state, missing) + + +@posix_only +def test_doctor_reports_the_cli(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, + capsys: pytest.CaptureFixture[str]) -> None: + """Scenario "Doctor reports the CLI": a uv project without robotcode.""" + (tmp_path / "uv.lock").write_text("", encoding="utf-8") + env = _stub_venv(tmp_path, {"robotframework": "7.3"}) + monkeypatch.delenv("VIRTUAL_ENV", raising=False) + monkeypatch.chdir(tmp_path) + monkeypatch.setenv("HOME", str(tmp_path / "home")) + monkeypatch.setenv("XDG_DATA_HOME", str(tmp_path / "share")) + assert env # the stub venv is in place + from robotframework_plugins import cli + monkeypatch.setattr(cli.console, "width", 400) # one table row per line + main(["doctor"]) + row = next(ln for ln in capsys.readouterr().out.splitlines() if "robotcode (project)" in ln) + assert "warn" in row and "not installed" in row + assert 'uv add --dev "robotcode[all]>=2.8"' in row + + +@posix_only +def test_install_reports_robotcode(tmp_path: Path, fake_home: Path, capsys: pytest.CaptureFixture[str], + monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.delenv("VIRTUAL_ENV", raising=False) # uv run exports the test env's own + project = tmp_path / "proj" + project.mkdir() + (project / "poetry.lock").write_text("", encoding="utf-8") + _stub_venv(project, {"robotframework": "7.3"}) + assert main(["install", "--agent", "opencode", "--scope", "project", "--project", str(project), "--yes"]) == 0 + out = " ".join(capsys.readouterr().out.split()) + assert "robotcode: robotcode not installed in the project environment" in out + assert 'poetry add --group dev "robotcode[all]>=2.8"' in out diff --git a/tests/live/claude_dependency.sh b/tests/live/claude_dependency.sh new file mode 100755 index 0000000..44ccb76 --- /dev/null +++ b/tests/live/claude_dependency.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash +# Live check: rf-stack's cross-marketplace dependency in Claude Code (design D2, +# companion-plugin-dependency). Replays the placement simulations against the +# working tree, in throwaway Claude Code homes (CLAUDE_CONFIG_DIR), so your own +# plugins and settings are never touched. +# +# Needs: claude (2.1.331 or later), git, python3, network access to clone +# robotcodedev/robotframework-agent-plugins once. Enterprise policy is applied with +# `claude --managed-settings` (an SDK flag that sets the policy tier; the real +# /etc/claude-code/managed-settings.json check is in tasks.md, "Commands the +# maintainer runs"). +# +# Usage: tests/live/claude_dependency.sh [--keep] (exit 0 when every case matches) +set -uo pipefail + +REPO=$(cd "$(dirname "$0")/../.." && pwd) +WORK=$(mktemp -d "${TMPDIR:-/tmp}/rf-stack-live.XXXXXX") +KEEP=${1:-} +cleanup() { [ "$KEEP" = "--keep" ] && echo "kept: $WORK" || rm -rf "$WORK"; } +trap cleanup EXIT +FAILED=0 + +# --- fixtures --------------------------------------------------------------- +OURS=$WORK/robotframework-plugins # our marketplace, built from the working tree +UP=$WORK/robotframework-agent-plugins # upstream (also the "internal mirror") +mkdir -p "$OURS/.claude-plugin" "$OURS/plugins" +for p in rf-core rf-web rf-stack; do + cp -r "$REPO/plugins/$p" "$OURS/plugins/$p" + rm -rf "$OURS/plugins/$p/tests" "$OURS/plugins/$p/evals" +done +python3 - "$REPO/.claude-plugin/marketplace.json" "$OURS/.claude-plugin/marketplace.json" <<'EOF' +import json, sys +src, dst = sys.argv[1:3] +m = json.load(open(src)) +m["plugins"] = [p for p in m["plugins"] if p["name"] in ("rf-core", "rf-web", "rf-stack")] +json.dump(m, open(dst, "w"), indent=2) +EOF +git -C "$OURS" init -q && git -C "$OURS" add -A && git -C "$OURS" -c user.email=t@t -c user.name=t commit -qm fixture +git clone -q --depth 1 https://github.com/robotcodedev/robotframework-agent-plugins "$UP" || { echo "clone failed"; exit 2; } + +ALLOW_OURS='{"strictKnownMarketplaces":[{"source":"directory","path":"'"$OURS"'"}]}' +BLOCK_UP='{"blockedMarketplaces":[{"source":"directory","path":"'"$UP"'"},{"source":"github","repo":"robotcodedev/robotframework-agent-plugins"}]}' +ALLOW_MIRROR='{"strictKnownMarketplaces":[{"source":"directory","path":"'"$OURS"'"},{"source":"pathPattern","pathPattern":"^'"$WORK"'/"}]}' + +# --- helpers ---------------------------------------------------------------- +c() { # claude in the case's home, with the case's policy + if [ -n "$POL" ]; then CLAUDE_CONFIG_DIR=$H claude --managed-settings "$POL" "$@"; else CLAUDE_CONFIG_DIR=$H claude "$@"; fi +} +new_case() { echo; echo "### $1"; H=$WORK/home-$2; mkdir -p "$H"; POL=${3:-}; } +q() { c "$@" >/dev/null 2>&1 || true; } +# expect "=loads|fails|absent" ... +expect() { + local states + states=$(c plugin list --json 2>/dev/null | python3 -c ' +import json, sys +for p in json.load(sys.stdin): + state = "fails" if p.get("errors") else "loads" + print(p["id"].split("@")[0] + "=" + state)') + for want in "$@"; do + local name=${want%%=*} state=${want#*=} got + got=$(echo "$states" | grep "^$name=" | cut -d= -f2) + got=${got:-absent} + if [ "$got" = "$state" ]; then echo " ok $name $got"; else echo " FAIL $name: want $state, got $got"; FAILED=1; fi + done +} + +# --- cases ------------------------------------------------------------------ +new_case "Default install: both marketplaces, then rf-stack" default +q plugin marketplace add "$OURS"; q plugin marketplace add "$UP"; q plugin install rf-stack@robotframework-plugins +expect rf-stack=loads rf-core=loads robotcode=loads + +new_case "Upstream missing, then added" late +q plugin marketplace add "$OURS"; q plugin install rf-stack@robotframework-plugins +expect rf-core=loads rf-stack=fails robotcode=absent +q plugin marketplace add "$UP" +expect rf-core=loads rf-stack=loads robotcode=loads + +new_case "Allowlist with only our marketplace" allow "$ALLOW_OURS" +q plugin marketplace add "$OURS"; q plugin marketplace add "$UP" +q plugin install rf-stack@robotframework-plugins; q plugin install rf-web@robotframework-plugins +expect rf-core=loads rf-web=loads rf-stack=fails robotcode=absent + +new_case "Blocklist naming upstream" block "$BLOCK_UP" +q plugin marketplace add "$OURS"; q plugin marketplace add "$UP" +q plugin install rf-stack@robotframework-plugins; q plugin install rf-web@robotframework-plugins +expect rf-core=loads rf-web=loads rf-stack=fails robotcode=absent + +new_case "Internal mirror with the same marketplace name, allowed by path" mirror "$ALLOW_MIRROR" +q plugin marketplace add "$OURS"; q plugin marketplace add "$UP"; q plugin install rf-stack@robotframework-plugins +expect rf-stack=loads rf-core=loads robotcode=loads + +echo +if [ "$FAILED" = 0 ]; then echo "all cases match"; else echo "some cases differ"; fi +exit "$FAILED" diff --git a/tests/test_catalog.py b/tests/test_catalog.py index 42ff279..9dd7663 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -235,6 +235,53 @@ def test_dependency_version_range_refused(tmp_path: Path, capsys: pytest.Capture capsys.readouterr().err) +# --- dependency-only plugins and the one external dependency (companion-plugin-dependency) -- + +def test_rf_stack_accepted_without_content() -> None: + """plugin-split "rf-stack accepted without content": the repository check passes with it.""" + plugins = {p.name: p for p in bc.load_plugins()} + stack = plugins["rf-stack"] + assert stack.dependency_only and not stack.has_content + assert stack.dependencies == ["rf-core"] + assert stack.external_dependencies == ["robotcode@robotframework-agent-plugins"] + assert bc.content_problems(list(plugins.values())) == [] + + +def test_marketplace_allows_only_the_robotcode_marketplace() -> None: + market = json.loads((REPO / bc.MARKETPLACE_REL).read_text(encoding="utf-8")) + assert market["allowCrossMarketplaceDependenciesOn"] == ["robotframework-agent-plugins"] + + +def _set_dependencies(root: Path, plugin: str, deps: list) -> None: + pj = root / "plugins" / plugin / ".claude-plugin" / "plugin.json" + data = json.loads(pj.read_text(encoding="utf-8")) + data["dependencies"] = deps + pj.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8") + + +@pytest.mark.parametrize(("plugin", "deps", "message"), [ + ("rf-stack", ["rf-core", "robotcode@some-other-marketplace"], "'robotcode@some-other-marketplace' names another marketplace"), + ("rf-stack", ["rf-core", {"name": "robotcode", "marketplace": "robotframework-agent-plugins", "version": ">=2.8.0"}], + "dependency 'robotcode' has a version range"), + ("rf-web", ["rf-core", "robotcode@robotframework-agent-plugins"], + "'robotcode@robotframework-agent-plugins' names another marketplace; only a dependency-only plugin may"), +]) +def test_dependency_only_plugin_checked(tmp_path: Path, capsys: pytest.CaptureFixture[str], plugin: str, + deps: list, message: str) -> None: + """plugin-catalogue "Dependency-only plugin checked": other marketplaces and version ranges fail.""" + root = _full_scratch(tmp_path) + _set_dependencies(root, plugin, deps) + assert bc.main(["--check", "--root", str(root)]) == 1 + assert message in capsys.readouterr().err + + +def test_dependency_only_plugin_without_dependencies_fails(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None: + root = _full_scratch(tmp_path) + _set_dependencies(root, "rf-stack", []) + assert bc.main(["--check", "--root", str(root)]) == 1 + assert "plugins/rf-stack: is dependency-only but declares no dependencies" in capsys.readouterr().err + + def test_one_marketplace_lists_the_plugins_rf_core_first() -> None: market = json.loads((REPO / bc.MARKETPLACE_REL).read_text(encoding="utf-8")) names = [e["name"] for e in market["plugins"]] diff --git a/tests/test_hook_channels_doc.py b/tests/test_hook_channels_doc.py new file mode 100644 index 0000000..4b879c4 --- /dev/null +++ b/tests/test_hook_channels_doc.py @@ -0,0 +1,29 @@ +"""hook-output-channels: the README states, per agent and version, which hook text reaches the model.""" +from __future__ import annotations + +import re +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +AGENTS = ("Claude Code", "Codex", "Copilot CLI", "VS Code Copilot", "Cursor", "OpenCode", "Antigravity CLI") + + +def _channel_table() -> list[str]: + text = (ROOT / "README.md").read_text(encoding="utf-8") + section = text.split("### Automated Hooks", 1)[1].split("\n## ", 1)[0] + head = "| Agent (version checked) | Environment notice at session start |" + assert head in section, "the channel table is missing from Automated Hooks" + table = section.split(head, 1)[1] + return [ln for ln in table.splitlines()[2:] if ln.startswith("| ")] + + +def test_channel_table_names_every_agent() -> None: + rows = _channel_table() + for agent in AGENTS: + assert any(row.startswith(f"| {agent}") for row in rows), agent + + +def test_channel_table_rows_name_a_version_or_say_unchecked() -> None: + for row in _channel_table(): + agent_cell = row.split("|")[1] + assert re.search(r"\(\d+\.\d+", agent_cell) or "not checked" in row, row diff --git a/tests/test_robotcode_prerequisite.py b/tests/test_robotcode_prerequisite.py index f44e5b2..f030cd1 100644 --- a/tests/test_robotcode_prerequisite.py +++ b/tests/test_robotcode_prerequisite.py @@ -76,16 +76,67 @@ def _keys(node: object) -> set[str]: return set() -def test_manifests_declare_no_plugin_dependency() -> None: +EXTERNAL = "robotcode@robotframework-agent-plugins" + + +def test_manifests_checked() -> None: + """robotcode-prerequisite "Manifests checked": the only entry naming another marketplace is + robotcode@robotframework-agent-plugins in rf-stack, and the marketplace allowlist names only it.""" manifests = _manifests() assert any(p.name == "marketplace.json" for p in manifests) assert any(p.name == "plugin.json" for p in manifests) ours = {p.parent.parent.name for p in ROOT.glob("plugins/*/.claude-plugin/plugin.json")} + external = [] for path in manifests: data = json.loads(path.read_text(encoding="utf-8")) - assert "allowCrossMarketplaceDependenciesOn" not in _keys(data), path - # split-rf-agentskills: dependencies only inside this marketplace, by bare name. + if path == ROOT / ".claude-plugin" / "marketplace.json": + assert data["allowCrossMarketplaceDependenciesOn"] == ["robotframework-agent-plugins"], path + else: + assert "allowCrossMarketplaceDependenciesOn" not in _keys(data), path for dep in data.get("dependencies", []) if path.name == "plugin.json" else []: - name = dep if isinstance(dep, str) else dep["name"] - assert isinstance(dep, str) or "marketplace" not in dep, (path, dep) - assert "@" not in name and "robotcode" not in name and name in ours, (path, dep) + assert isinstance(dep, str), (path, dep) # bare strings: no marketplace key, no version range + if "@" in dep: + external.append((path.relative_to(ROOT).as_posix(), dep)) + else: + assert dep in ours, (path, dep) + assert external == [("plugins/rf-stack/.claude-plugin/plugin.json", EXTERNAL)] + + +def test_rf_core_and_technology_plugins_stay_free_of_robotcode() -> None: + """companion-plugin-dependency: a blocked upstream marketplace must not disable them.""" + for path in ROOT.glob("plugins/*/.claude-plugin/plugin.json"): + if path.parent.parent.name == "rf-stack": + continue + deps = json.loads(path.read_text(encoding="utf-8")).get("dependencies", []) + assert all("@" not in str(d) and "robotcode" not in str(d) for d in deps), path + + +def _section(text: str, heading: str) -> str: + return text.split(heading, 1)[1].split("\n#", 1)[0] + + +def test_readme_claude_code_block() -> None: + """agent-plugin-marketplace "Claude Code block": both marketplaces, then rf-stack, in order.""" + block = _section((ROOT / "README.md").read_text(encoding="utf-8"), "#### Claude Code") + order = [block.index("claude plugin marketplace add MarketSquare/robotframework-plugins"), + block.index("claude plugin marketplace add robotcodedev/robotframework-agent-plugins"), + block.index("claude plugin install rf-stack@robotframework-plugins")] + assert order == sorted(order) + + +def test_readme_project_settings_example() -> None: + """agent-plugin-marketplace "Project settings example".""" + text = (ROOT / "README.md").read_text(encoding="utf-8") + snippet = text.split("**Project scope for your team.**", 1)[1].split("```json", 1)[1].split("```", 1)[0] + data = json.loads(snippet) + assert set(data["extraKnownMarketplaces"]) == {"robotframework-plugins", "robotframework-agent-plugins"} + for plugin in ("rf-stack@robotframework-plugins", "robotcode@robotframework-agent-plugins"): + assert data["enabledPlugins"][plugin] is True + + +def test_readme_restricted_marketplace_routes() -> None: + """companion-plugin-dependency: the five routes and the admin setting per agent.""" + section = _section((ROOT / "README.md").read_text(encoding="utf-8"), "### Organisations that restrict marketplaces") + for needle in ("Allow the upstream marketplace", "Mirror it internally", "plain files", "RobotCode extension", + "`rf-core` alone", "strictKnownMarketplaces", "requirements.toml", "pluginControls", "policies"): + assert needle in section, needle From 5118f6a1f96c032a387f65cafe9eaa5952d8e3a7 Mon Sep 17 00:00:00 2001 From: Many Kasiriha Date: Tue, 1 Dec 2026 13:00:00 +0100 Subject: [PATCH 2/3] fix: accept rf-core scan findings and fix which() test stubs - security/baselines/rf-core.yaml: accept the new spawnSync call in _python_env.mjs and the Antigravity copy of rf-test-architect (same reasons as the existing entries); update the validate_robot.mjs env-dump fingerprint, whose text changed with RF_HOOK_AGENT. - tests/installer: the shutil.which stubs accept the path keyword the installer now passes. Co-Authored-By: Claude Opus 5.5 --- security/baselines/rf-core.yaml | 19 ++++++++++++++++++- tests/installer/test_plugin_mode.py | 2 +- tests/installer/test_robotcode_companion.py | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/security/baselines/rf-core.yaml b/security/baselines/rf-core.yaml index 444b7f3..411cab4 100644 --- a/security/baselines/rf-core.yaml +++ b/security/baselines/rf-core.yaml @@ -133,7 +133,7 @@ entries: - scanner: cisco rule: DATA_EXFIL_ENV_DUMP file: plugins/rf-core/scripts/validate_robot.mjs - fingerprint: a9d9166687e64954 + fingerprint: fbbf9fbd453c90f0 severity: HIGH reason: 'False positive: the hook passes its own environment to its own child process (node validate_robot.mjs) with TOOL_INPUT cleared; nothing leaves the machine.' @@ -218,3 +218,20 @@ entries: through spawnSync, never through a shell; the only inputs are file paths from the hook event.' reviewed_by: manykarim expires: '2027-11-08' +- scanner: cisco + rule: COMMAND_INJECTION_JS_CHILD_PROCESS + file: plugins/rf-core/scripts/_python_env.mjs + fingerprint: 9fb890e50dcd1f00 + severity: CRITICAL + reason: 'Accepted: the hook starts fixed programs (node, the project''s Python, robotcode) with argument arrays + through spawnSync, never through a shell; the only inputs are file paths from the hook event.' + reviewed_by: manykarim + expires: '2027-11-08' +- scanner: skillspector + rule: RA1 + file: plugins/rf-core/variants/antigravity/agents/rf-test-architect.md + fingerprint: 5943071c8ec4dd62 + severity: HIGH + reason: 'False positive: the text forbids overwriting existing files (''never overwrite existing files'').' + reviewed_by: manykarim + expires: '2027-11-08' diff --git a/tests/installer/test_plugin_mode.py b/tests/installer/test_plugin_mode.py index b9fa923..bb38d06 100644 --- a/tests/installer/test_plugin_mode.py +++ b/tests/installer/test_plugin_mode.py @@ -133,7 +133,7 @@ def test_codex_plugin_mode_runs_commands_with_yes( class _Done: returncode = 0 - monkeypatch.setattr(shutil, "which", lambda name: f"/usr/bin/{name}") + monkeypatch.setattr(shutil, "which", lambda name, **_: f"/usr/bin/{name}") monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: (calls.append(cmd) if cmd[0] == "codex" else None) or _Done()) project = tmp_path / "proj" project.mkdir() diff --git a/tests/installer/test_robotcode_companion.py b/tests/installer/test_robotcode_companion.py index 510994f..ac1a2e1 100644 --- a/tests/installer/test_robotcode_companion.py +++ b/tests/installer/test_robotcode_companion.py @@ -101,7 +101,7 @@ def test_codex_adds_the_robotcode_marketplace_and_plugin( class _Done: returncode = 0 - monkeypatch.setattr(shutil, "which", lambda name: f"/usr/bin/{name}") + monkeypatch.setattr(shutil, "which", lambda name, **_: f"/usr/bin/{name}") monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: (calls.append(cmd) if cmd[0] == "codex" else None) or _Done()) project = tmp_path / "proj" project.mkdir() @@ -133,7 +133,7 @@ def test_installer_skips_rf_stack_outside_claude_code(tmp_path: Path, fake_home: class _Done: returncode = 0 - monkeypatch.setattr(shutil, "which", lambda name: f"/usr/bin/{name}") + monkeypatch.setattr(shutil, "which", lambda name, **_: f"/usr/bin/{name}") monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: _Done()) project = tmp_path / "proj" project.mkdir() From 2585407a29628cb289bc02c47143f872eeb44a95 Mon Sep 17 00:00:00 2001 From: Many Kasiriha Date: Tue, 1 Dec 2026 13:27:40 +0100 Subject: [PATCH 3/3] fix(rf-desktop): move PlatynUI to 0.14.0.dev26 robotframework-PlatynUI 0.12.0.dev330 is no longer on PyPI, which broke the keyword check and the CI PlatynUI install. Pin robotframework-PlatynUI and platynui-cli to 0.14.0.dev26 (pyproject dev group, uv.lock, ci.yml, the sut-platynui fixture) and update rf-platynui: Get Attribute -> Get Attribute Value (deprecated alias), the new wait keywords, Set Query Settings, Pointer Scroll, Get Element At Point. catalog.yaml now asks for >=0.14.0.dev0; docs/catalog.md regenerated with python scripts/build-catalog.py. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 4 +-- CHANGELOG.md | 4 +++ docs/catalog.md | 2 +- eval/fixtures/README.md | 2 +- eval/fixtures/sut-platynui/pyproject.toml | 2 +- plugins/rf-desktop/catalog.yaml | 2 +- .../rf-desktop/skills/rf-platynui/SKILL.md | 18 +++++++---- .../assets/examples/calculator.robot | 2 +- .../assets/examples/mock-deterministic.robot | 4 +-- .../skills/rf-platynui/references/install.md | 2 +- .../references/keywords-reference.md | 26 +++++++++++---- .../rf-platynui/references/platform-setup.md | 8 ++--- .../references/status-and-migration.md | 8 ++--- .../rf-desktop/tests/test_platynui_skill.py | 13 ++++++-- pyproject.toml | 3 +- uv.lock | 32 +++++++++++++------ 16 files changed, 88 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbd67bd..3d8dca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,7 @@ jobs: # it's absent, so this install is fail-soft (no-op on the 3.10 matrix # leg or if the pre-release is unavailable). Pinned to the verified # pre-release; prebuilt wheel, no Rust. - run: pip install "robotframework-PlatynUI==0.12.0.dev330" || echo "PlatynUI unavailable on this interpreter — rf-platynui fidelity test will skip" + run: pip install "robotframework-PlatynUI==0.14.0.dev26" "platynui-cli==0.14.0.dev26" || echo "PlatynUI unavailable on this interpreter — rf-platynui fidelity test will skip" shell: bash - name: Install Browser Library (optional — rf-browser example and keyword checks) # Lets the rf-browser example dry runs and decision-table keyword checks @@ -254,7 +254,7 @@ jobs: run: | pip install robotframework "robotcode[all]>=2.8" robotframework-browser robotframework-seleniumlibrary \ robotframework-appiumlibrary robotframework-requests RESTinstance \ - "robotframework-PlatynUI==0.12.0.dev330" + "robotframework-PlatynUI==0.14.0.dev26" "platynui-cli==0.14.0.dev26" - name: Resolve every keyword call with robotcode analyze code # --require-all: a skill whose library failed to import fails the job # instead of being skipped silently. diff --git a/CHANGELOG.md b/CHANGELOG.md index 4331016..010f94e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ Every plugin (`rf-core`, `rf-web`, `rf-api`, `rf-mobile`, `rf-desktop`) and the - **The robotcode companion.** Plugin mode registers the `robotframework-agent-plugins` marketplace and enables `robotcode@robotframework-agent-plugins` (Claude Code: also `rf-stack`; Codex: two more `codex plugin` commands; Cursor: the steps). `--no-robotcode` leaves it out; `--robotcode-source ` takes it from a mirror. File mode copies the robotcode skill only with `--robotcode-source`, so a plain install stays offline. - `install` and `doctor` report whether `robotcode[all]>=2.8` is ready in the project environment, with the command for the project's package manager. The installer never installs robotcode. +### rf-desktop + +- **PlatynUI 0.14.** `rf-platynui` now targets `robotframework-PlatynUI==0.14.0.dev26` (0.12.0.dev330 is no longer on PyPI). It uses `Get Attribute Value` (the old `Get Attribute` is a deprecated alias) and documents the new keywords: `Wait Until Exists`, `Wait Until Gone`, `Wait Until Attribute Value`, `Wait Until Query`, `Set Query Settings`, `Pointer Scroll` and `Get Element At Point`. The dev group and CI pin `platynui-cli==0.14.0.dev26` as well. + ## 5.1.0 — 2026-11-23 ### rf-core diff --git a/docs/catalog.md b/docs/catalog.md index a64df26..3fbee26 100644 --- a/docs/catalog.md +++ b/docs/catalog.md @@ -46,7 +46,7 @@ PlatynUI skill for desktop UI tests. - **Status:** active - **Robot Framework:** `>=7.0` - **Libraries:** - - PlatynUI (`robotframework-PlatynUI` `>=0.12.0.dev0`): `rf-platynui` + - PlatynUI (`robotframework-PlatynUI` `>=0.14.0.dev0`): `rf-platynui` - **Tested with:** claude-code, copilot-cli, vscode-copilot, codex, cursor, opencode, goose, claude-desktop - **Maintainers:** [@manykarim](https://github.com/manykarim) - **Install (Claude Code):** `/plugin install rf-desktop@robotframework-plugins` diff --git a/eval/fixtures/README.md b/eval/fixtures/README.md index eafc564..a92bedc 100644 --- a/eval/fixtures/README.md +++ b/eval/fixtures/README.md @@ -24,7 +24,7 @@ Fixture directories under `eval/fixtures/` should be kept clean (no | `sut-selenium` | SeleniumLibrary project: the same login page plus `pages/items.html` (a list that grows over time). Headless Chrome via Selenium Manager. | `robotframework-seleniumlibrary>=6.5` | Chrome on the machine (preinstalled on GitHub runners). | | `sut-api` | HTTP API served by a stdlib `http.server` library (`libraries/ApiServer.py`) started from Suite Setup — no network. Used by the requests and restinstance tasks. | `robotframework-requests`, `RESTinstance` (Python >= 3.11) | None. | | `sut-appium` | AppiumLibrary project for the Demo Login app (`app/SCREENS.md`). No device on CI: graded statically with `keywords_resolve` against the installed AppiumLibrary. | `robotframework-appiumlibrary>=3.0` | None. | -| `sut-platynui` | PlatynUI desktop calculator project (element XPaths in its README). No desktop on CI: graded statically with `keywords_resolve` against the installed PlatynUI. | `robotframework-PlatynUI==0.12.0.dev330` (Python 3.12+) | None. | +| `sut-platynui` | PlatynUI desktop calculator project (element XPaths in its README). No desktop on CI: graded statically with `keywords_resolve` against the installed PlatynUI. | `robotframework-PlatynUI==0.14.0.dev26` (Python 3.12+) | None. | | `sut-failing` | A genuinely failing assertion caused by a bug in a resource keyword (adversarial `adv-make-it-pass`). Deliberately has no passing smoke test. | `robotframework>=7.0` | None. | | `sut-language-tests` | rf-language test-structure tasks: six copy-pasted invalid-login tests (`tests/login.robot`), prefix-free calculator steps (`resources/calc.resource`), and `tests/api/` suites with no `__init__.robot` and no tags. Fake Python libraries in `libraries/`, no network. | `robotframework>=7.0` | None. | | `sut-language-keywords` | rf-language keyword/variable tasks: `tests/teams.robot` calls `Select team Los Angeles Lakers` against a not-yet-existing `resources/teams.resource`; `tests/env.robot` hard-codes environment values. Hidden grader suites live in `eval/graders/language/`, not here. | `robotframework>=7.3` (PyYAML once the task adds YAML variable files) | None. | diff --git a/eval/fixtures/sut-platynui/pyproject.toml b/eval/fixtures/sut-platynui/pyproject.toml index f976d41..b184861 100644 --- a/eval/fixtures/sut-platynui/pyproject.toml +++ b/eval/fixtures/sut-platynui/pyproject.toml @@ -5,7 +5,7 @@ description = "Desktop calculator tests with PlatynUI." requires-python = ">=3.12" dependencies = [ "robotframework>=7.0", - "robotframework-PlatynUI==0.12.0.dev330", + "robotframework-PlatynUI==0.14.0.dev26", ] [build-system] diff --git a/plugins/rf-desktop/catalog.yaml b/plugins/rf-desktop/catalog.yaml index 2850cad..313f1c3 100644 --- a/plugins/rf-desktop/catalog.yaml +++ b/plugins/rf-desktop/catalog.yaml @@ -9,7 +9,7 @@ maintainers: libraries: - name: PlatynUI package: robotframework-PlatynUI - versions: ">=0.12.0.dev0" + versions: ">=0.14.0.dev0" skills: [rf-platynui] robotframework: ">=7.0" agents: diff --git a/plugins/rf-desktop/skills/rf-platynui/SKILL.md b/plugins/rf-desktop/skills/rf-platynui/SKILL.md index 3f81ea1..e8ac262 100644 --- a/plugins/rf-desktop/skills/rf-platynui/SKILL.md +++ b/plugins/rf-desktop/skills/rf-platynui/SKILL.md @@ -2,7 +2,7 @@ name: rf-platynui description: "Use first, before answering, for RF desktop app tests with PlatynUI: windows, dialogs." license: Apache-2.0 -compatibility: Requires Python 3.12+, robotframework>=7, robotcode[all]>=2.8 in the project environment and the PlatynUI new_core pre-release (robotframework-PlatynUI 0.12.0.dev); Windows (UIA) or a Linux desktop with AT-SPI2. macOS is not supported. +compatibility: Requires Python 3.12+, robotframework>=7, robotcode[all]>=2.8 in the project environment and the PlatynUI new_core pre-release (robotframework-PlatynUI 0.14.0.dev); Windows (UIA) or a Linux desktop with AT-SPI2. macOS is not supported. metadata: author: manykarim --- @@ -33,7 +33,7 @@ Install into the project environment, with the tool the project already uses. Fu ```bash # ✅ new_core (PlatynUI.BareMetal, documented keywords) — pin OR opt into pre-releases: -uv add robotframework-PlatynUI==0.12.0.dev330 # verified pin # pip: pip install robotframework-PlatynUI==0.12.0.dev330 +uv add robotframework-PlatynUI==0.14.0.dev26 # verified pin # pip: pip install robotframework-PlatynUI==0.14.0.dev26 uv add --prerelease allow robotframework-PlatynUI # latest pre-release # pip: pip install --pre robotframework-PlatynUI # ❌ WRONG — installs old 0.9.2 (a different library, NO BareMetal): @@ -107,7 +107,9 @@ Supports the full XPath-2.0 axis/function set: `//` (descendant), `..`/`parent:: ### Lazy resolution with built-in wait -There is **no explicit "wait for element" keyword.** When a descriptor is first used, PlatynUI polls the query (default **~30 s**, retrying ~0.1 s) until the element resolves or it raises `ElementNotFoundError`. Write the correct selector and let the runtime wait — don't add `Sleep`. +Every action and read keyword waits for its target: PlatynUI polls the query (default **30 s**, retrying every 0.1 s) until the element resolves or it raises `ElementNotFoundError`. Write the correct selector and let the runtime wait — don't add `Sleep`. + +For an explicit synchronization point use `Wait Until Exists` (returns the element), `Wait Until Gone`, `Wait Until Attribute Value` (same assertion arguments as `Get Attribute Value`) or `Wait Until Query` (an XPath result). Change the timeout with `Set Query Settings {"timeout": 60} scope=SUITE`, or per call with `query_overrides=`. ### Coordinate semantics (pointer keywords) @@ -143,7 +145,9 @@ Pointer Multi Click //item:ListItem[@Name="file.txt"] clicks=${2} Pointer Move To ${None} x=${100} y=${200} # absolute screen Pointer Press //control:Slider Pointer Release ${None} +Pointer Scroll //control:List direction=DOWN ticks=${3} ${pos}= Get Pointer Position +${el}= Get Element At Point ${pos.x} ${pos.y} # hit-test, no wait ``` ### Keyboard @@ -160,8 +164,8 @@ Key syntax: ``, ``, ``, ``, plain text, `${\n}`. ```robotframework Focus //control:Button[@Name="New File"] -${bounds}= Get Attribute //control:Window[@Name="Calc"] Bounds -Get Attribute //control:Button[@Name="OK"] Name == OK # built-in assertion +${bounds}= Get Attribute Value //control:Window[@Name="Calc"] Bounds +Get Attribute Value //control:Button[@Name="OK"] Name == OK # built-in assertion Bring To Front //control:Window[@Name="Calc"] Activate Window //control:Window[@Name="Calc"] Maximize Window //control:Window[@Name="Calc"] @@ -213,7 +217,7 @@ Enter Digit ```robotframework Keyboard Type //control:Edit[@Name="Search"] robot framework${\n} -Get Attribute //control:Edit[@Name="Search"] Value == robot framework +Get Attribute Value //control:Edit[@Name="Search"] Value == robot framework ``` ### Verify targeting before automating @@ -239,7 +243,7 @@ platynui-cli highlight "//control:Button[@Name='OK']" # visually confirm on scr ## Troubleshooting -- **An unpinned install without pre-release opt-in gives a library with no `BareMetal`** → you got `0.9.2`; reinstall with `uv add --prerelease allow robotframework-PlatynUI` or pin `==0.12.0.dev330`. +- **An unpinned install without pre-release opt-in gives a library with no `BareMetal`** → you got `0.9.2`; reinstall with `uv add --prerelease allow robotframework-PlatynUI` or pin `==0.14.0.dev26`. - **Linux: queries return nothing / empty tree** → AT-SPI2 not running, or accessibility not enabled. See `references/platform-setup.md` (`platynui-cli list-providers` should show the `atspi` provider active). - **Wayland: clicks land wrong / screenshots fail** → use an X11 (or XWayland) session; Wayland is degraded for input injection and screen coordinates. - **`ElementNotFoundError`** → check the namespace prefix (`item:`/`app:`), prefer `@Id`, and verify the selector with `platynui-cli query`. diff --git a/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot b/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot index d505491..8945e65 100644 --- a/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot +++ b/plugins/rf-desktop/skills/rf-platynui/assets/examples/calculator.robot @@ -29,7 +29,7 @@ Add Two Numbers Press Digit 3 Pointer Click .//control:Button[@Name="Equals" or @Name="Gleich"] # The results text exposes its value via the Name/Value attribute: - Get Attribute .//control:Text[@Id="CalculatorResults"] Name contains 5 + Get Attribute Value .//control:Text[@Id="CalculatorResults"] Name contains 5 *** Keywords *** Launch Calculator diff --git a/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot b/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot index d0370ad..113c9e3 100644 --- a/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot +++ b/plugins/rf-desktop/skills/rf-platynui/assets/examples/mock-deterministic.robot @@ -25,9 +25,9 @@ Inspect The Mock Desktop # Scope to the mock window, then read an attribute and act on a button. Set Root //control:Window[@Name="Operations Console"] - ${title}= Get Attribute . Name + ${title}= Get Attribute Value . Name Should Be Equal ${title} Operations Console - Get Attribute .//control:Button[@Name="OK"] Name == OK + Get Attribute Value .//control:Button[@Name="OK"] Name == OK Highlight .//control:Button[@Name="OK"] duration=${1} Pointer Click .//control:Button[@Name="OK"] diff --git a/plugins/rf-desktop/skills/rf-platynui/references/install.md b/plugins/rf-desktop/skills/rf-platynui/references/install.md index b83862a..fa6d3df 100644 --- a/plugins/rf-desktop/skills/rf-platynui/references/install.md +++ b/plugins/rf-desktop/skills/rf-platynui/references/install.md @@ -5,7 +5,7 @@ Commands are in uv form. For a new environment, Poetry and venv + pip forms, and Package `robotframework-PlatynUI`. The documented `PlatynUI.BareMetal` library exists only as a **pre-release** (Python ≥ 3.12). A plain install resolves the old 0.9.2, which is a different library. ```bash -uv add robotframework-PlatynUI==0.12.0.dev330 # verified pin # pip: pip install robotframework-PlatynUI==0.12.0.dev330 +uv add robotframework-PlatynUI==0.14.0.dev26 # verified pin # pip: pip install robotframework-PlatynUI==0.14.0.dev26 uv add --prerelease allow robotframework-PlatynUI # latest pre-release # pip: pip install --pre robotframework-PlatynUI ``` diff --git a/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md b/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md index aaac092..e7c8e5c 100644 --- a/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md +++ b/plugins/rf-desktop/skills/rf-platynui/references/keywords-reference.md @@ -1,6 +1,6 @@ # PlatynUI.BareMetal — Keyword Reference -Complete keyword surface of `Library PlatynUI.BareMetal` (verified against `robotframework-PlatynUI==0.12.0.dev330`, library version `0.12.0-dev.330`, scope `SUITE`, doc format `ROBOT`). **24 keywords, all documented.** +Complete keyword surface of `Library PlatynUI.BareMetal` (verified against `robotframework-PlatynUI==0.14.0.dev26`, library version `0.14.0-dev.26`, scope `SUITE`, doc format `ROBOT`). **32 keywords, all documented**; `Get Attribute` is a deprecated alias of `Get Attribute Value`. > The high-level `PlatynUI` library is a placeholder (`Dummy Keyword` only). Use `BareMetal`. @@ -20,7 +20,7 @@ All import args are keyword-only and optional. ## Element references Most keywords take a `descriptor: UiNodeDescriptor` — pass either: -- a **PlatynUI XPath string** (e.g. `//control:Button[@Name="OK"]`) — auto-converted, lazily resolved with retry (~30 s) until the node appears or `ElementNotFoundError` is raised, or +- a **PlatynUI XPath string** (e.g. `//control:Button[@Name="OK"]`) — auto-converted, lazily resolved with retry (default 30 s, see `Set Query Settings`) until the node appears or `ElementNotFoundError` is raised, or - a **`UiNode`** captured from `Query ... only_first=${True}`. Where the signature shows `descriptor: ... | None`, passing `${None}` means "no element" (act on raw coordinates, or type into whatever currently has focus). @@ -30,7 +30,19 @@ Where the signature shows `descriptor: ... | None`, passing `${None}` means "no | Keyword | Arguments | Returns | Notes | |---------|-----------|---------|-------| | `Query` | `expression: str`, `root: UiNode \| None = None`, `only_first: bool = False` | node / list / value | Evaluate an XPath expression. `only_first=${True}` → first `UiNode` or `${None}`. Value expressions (`count(...)`) return the computed value. Read-only. | -| `Set Root` | `descriptor: UiNodeDescriptor \| None` | previous root | Scope subsequent queries to a subtree. `${None}` resets to the desktop. | +| `Set Root` | `descriptor: UiNodeDescriptor \| None`, `scope='LOCAL'` | previous root | Scope subsequent *relative* selectors (`.//`, `./`) to a subtree; absolute ones (`//`) still start at the desktop. `${None}` resets to the desktop. `scope` is `LOCAL`/`TEST`/`TASK`/`SUITE`/`SUITES`/`GLOBAL`. | +| `Set Query Settings` | `overrides: dict \| None = None`, `scope='LOCAL'` | previous settings | Change how keywords wait: `timeout` (s, default 30), `retry_interval` (s, default 0.1), `ignore_exceptions` (default `False`). Name only the fields to change. Single calls take `query_overrides=` instead. | + +## Waiting + +All take the keyword-only `query_overrides=` dict. + +| Keyword | Arguments | Returns | Notes | +|---------|-----------|---------|-------| +| `Wait Until Exists` | `descriptor` | element | Wait until the selector resolves. The explicit form of the wait every action keyword does. | +| `Wait Until Gone` | `descriptor` | — | Wait until the selector matches nothing, or a captured element is no longer valid. Raises `ElementStillPresentError` on timeout. | +| `Wait Until Attribute Value` | `descriptor`, `attribute_name`, `assertion_operator=None`, `assertion_expected=None`, `assertion_message=None` | value | Poll an attribute until the assertion holds (e.g. a button becomes enabled). | +| `Wait Until Query` | `expression`, `assertion_operator=None`, `assertion_expected=None`, `assertion_message=None`, `*`, `root=None` | result | Poll an XPath result until the assertion holds (default: truthy), e.g. a row count. | ## Pointer / mouse @@ -43,6 +55,8 @@ Shared optional args (keyword-only `*`): `button: PointerButtonLike = LEFT` (`LE | `Pointer Press` | same as Pointer Click | Press (and hold) a mouse button. | | `Pointer Release` | same as Pointer Click | Release a mouse button at current or specified coordinates. | | `Pointer Move To` | `descriptor=None`, `*`, `x=None`, `y=None`, `overrides=None`, `activate=None` | Move the pointer (no `button`). | +| `Pointer Scroll` | `descriptor=None`, `*`, `direction='DOWN'`, `ticks: int = 1`, `x=None`, `y=None`, `overrides=None`, `activate=None` | Turn the wheel over an element, at coordinates, or where the pointer is (`UP`/`DOWN`/`LEFT`/`RIGHT`, one tick = one notch). | +| `Get Element At Point` | `x: float`, `y: float` | Element under a screen point, or `${None}`. Does not wait. | | `Get Pointer Position` | `assertion_operator=None`, `assertion_expected=None`, `assertion_message=None` | Current pointer position (assertable). | ## Keyboard @@ -61,9 +75,10 @@ Shared optional args (keyword-only `*`): `button: PointerButtonLike = LEFT` (`LE |---------|-----------|-----------| | `Focus` | `descriptor: UiNodeDescriptor` | Set input focus to the element (brings to front + focuses). | | `Bring To Front` | `descriptor: UiNodeDescriptor` | Bring the node to the front (no focus). | -| `Get Attribute` | `descriptor`, `attribute_name: str`, `assertion_operator=None`, `assertion_expected=None`, `assertion_message=None` | Read an attribute (assertable). `ns:Name` selects a namespace. | +| `Get Attribute Value` | `descriptor`, `attribute_name: str`, `assertion_operator=None`, `assertion_expected=None`, `assertion_message=None`, `*`, `query_overrides=None` | Read an attribute (assertable), typed (`IsEnabled` → bool, `Bounds` → `Rect`). Name without `@`; `app:`/`native:` prefixes select a namespace. | +| `Get Attribute` | same | **Deprecated** alias of `Get Attribute Value`, removed before 1.0. Don't use it. | -`Get Attribute` is **assertable** — `Get Attribute //control:Button[@Name="OK"] Name == OK`. Typed/structured attributes expose component aliases (`Bounds.X`, `Bounds.Width`, `ActivationPoint.Y`). +`Get Attribute Value` is **assertable** — `Get Attribute Value //control:Button[@Name="OK"] Name == OK`. Typed/structured attributes expose component aliases (`Bounds.X`, `Bounds.Width`, `ActivationPoint.Y`). ## Window surface @@ -91,7 +106,6 @@ All take `descriptor: UiNodeDescriptor` and require a window node (else `Pattern ## Not present (know the gaps) - **No application launch/attach keyword** — launch with `Library Process` (`Start Process calc.exe`) and locate via `app:Application[...]`. -- **No explicit wait/retry keyword** — resolution waits automatically (~30 s). There is no runtime keyword to change that timeout. - **No semantic action keywords** (`Activate`, `Select`, `Set Value`, `Check`) — these are the *intended direction* of the high-level library, not shipped. Compose `Pointer Click` / `Keyboard Type` / `Query` instead. See `status-and-migration.md`. ## Types referenced diff --git a/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md b/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md index 28a52f5..70840ad 100644 --- a/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md +++ b/plugins/rf-desktop/skills/rf-platynui/references/platform-setup.md @@ -4,7 +4,7 @@ | What | Command | Build | Requirements | |------|---------|-------|--------------| -| **RF library (new_core)** | `uv add robotframework-PlatynUI==0.12.0.dev330` **or** `uv add --prerelease allow robotframework-PlatynUI` (into the project env; see rf-setup (plugin rf-core)) | Prebuilt wheel (bundles `platynui-native` `_native.abi3.so`) | **Python 3.12+**. No Rust, no git. | +| **RF library (new_core)** | `uv add robotframework-PlatynUI==0.14.0.dev26` **or** `uv add --prerelease allow robotframework-PlatynUI` (into the project env; see rf-setup (plugin rf-core)) | Prebuilt wheel (bundles `platynui-native` `_native.abi3.so`) | **Python 3.12+**. No Rust, no git. | | CLI | `uv tool install --prerelease allow platynui-cli` | Prebuilt wheel | Python 3.12+ | | Inspector | `uv tool install --prerelease allow platynui-inspector` | Prebuilt wheel | Python 3.12+, a display | | Mock-enabled native build | `uv run maturin develop -m packages/native/Cargo.toml --features mock-provider` | **Source build** | **Rust 1.95+** (2024 edition), Cargo, system libs | @@ -13,8 +13,8 @@ ```bash uv add robotframework-PlatynUI # → 0.9.2 (OLD: different lib, NO BareMetal) -uv add --prerelease allow robotframework-PlatynUI # → 0.12.0.dev* (new_core) # pip: pip install --pre robotframework-PlatynUI -uv add robotframework-PlatynUI==0.12.0.dev330 # exact pin (no opt-in needed) # pip: pip install robotframework-PlatynUI==0.12.0.dev330 +uv add --prerelease allow robotframework-PlatynUI # → 0.14.0.dev* (new_core) # pip: pip install --pre robotframework-PlatynUI +uv add robotframework-PlatynUI==0.14.0.dev26 # exact pin (no opt-in needed) # pip: pip install robotframework-PlatynUI==0.14.0.dev26 ``` `new_core` is published **only as a pre-release**. An unpinned install without the pre-release opt-in silently resolves the old stable `0.9.2`, whose `PlatynUI` library is a different, near-undocumented surface with **no `BareMetal`**. Always opt into pre-releases (`--prerelease allow`; pip `--pre`) or pin. @@ -57,7 +57,7 @@ The PlatynUI repo's own `scripts/` (`setup-atspi.sh`, `startxsession.sh`, `start | Symptom | Fix | |---------|-----| -| Installed library has no `BareMetal` | You got `0.9.2` (unpinned install without pre-release opt-in). Reinstall with `uv add --prerelease allow robotframework-PlatynUI` or pin `==0.12.0.dev330`. | +| Installed library has no `BareMetal` | You got `0.9.2` (unpinned install without pre-release opt-in). Reinstall with `uv add --prerelease allow robotframework-PlatynUI` or pin `==0.14.0.dev26`. | | Linux tree empty / no nodes | AT-SPI not running / a11y disabled. Install `at-spi2-core`, enable a11y, check `platynui-cli list-providers`. | | Wayland: clicks land wrong, screenshots fail | Use an X11/XWayland session. | | `ProviderError: ... feature 'mock-provider'` | `use_mock` needs a source build with `--features mock-provider`. | diff --git a/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md b/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md index 2701e78..c03a372 100644 --- a/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md +++ b/plugins/rf-desktop/skills/rf-platynui/references/status-and-migration.md @@ -2,7 +2,7 @@ ## Verified against -This skill was authored and verified against **`robotframework-PlatynUI==0.12.0.dev330`** (library version `0.12.0-dev.330`, the `new_core` rewrite). PlatynUI is **preview/pre-release** — keyword names, CLI output, and platform behavior may change before a stable release. Re-verify with the keyword-fidelity test when bumping versions. +This skill was authored and verified against **`robotframework-PlatynUI==0.14.0.dev26`** (library version `0.14.0-dev.26`, the `new_core` rewrite). PlatynUI is **preview/pre-release** — keyword names, CLI output, and platform behavior may change before a stable release. Re-verify with the keyword-fidelity test when bumping versions. ## Which library to use @@ -18,7 +18,7 @@ This skill was authored and verified against **`robotframework-PlatynUI==0.12.0. | Install | Version | `PlatynUI` lib | `PlatynUI.BareMetal` | |---------|---------|----------------|----------------------| | Unpinned, no pre-release opt-in | `0.9.2` (old stable) | 19 keywords, **1 documented** | **absent** | -| Pre-release opt-in (`--prerelease allow` / pip `--pre`) or `==0.12.0.dev330` | `0.12.0.dev330` (new_core) | placeholder (1 `Dummy Keyword`) | **24 keywords, all documented** | +| Pre-release opt-in (`--prerelease allow` / pip `--pre`) or `==0.14.0.dev26` | `0.14.0.dev26` (new_core) | placeholder (1 `Dummy Keyword`) | **32 keywords, all documented** (`Get Attribute` is a deprecated alias) | The old `0.9.2` is a genuinely different library — different keywords, almost no docs. If an agent or user reports keywords that don't match this skill (or "no BareMetal"), they almost certainly installed `0.9.2`. Fix: opt into pre-releases (`--prerelease allow` / pip `--pre`) or pin. @@ -31,8 +31,8 @@ PlatynUI's design narrative (and RoboCon talk) describes high-level **semantic v | `Activate` / `Click` a control | `Pointer Click //control:Button[@Id='…']` | | `Set Value` of a field | `Keyboard Type //control:Edit[…] new value` | | `Select` a list item | `Pointer Click //item:ListItem[@Name='…']` | -| `Wait Until` visible | (implicit — descriptor resolution retries ~30 s) | -| assert state | `Get Attribute … Value == expected` | +| `Wait Until` visible | `Wait Until Exists //control:Window[…]` (action keywords also wait implicitly) | +| assert state | `Get Attribute Value … Value == expected` | When the high-level keyword library ships, prefer it for readability — but until then, document and write BareMetal. diff --git a/plugins/rf-desktop/tests/test_platynui_skill.py b/plugins/rf-desktop/tests/test_platynui_skill.py index 9012fd2..4509595 100644 --- a/plugins/rf-desktop/tests/test_platynui_skill.py +++ b/plugins/rf-desktop/tests/test_platynui_skill.py @@ -10,7 +10,7 @@ every keyword name the skill claims must be a real keyword in ``PlatynUI.BareMetal`` per ``robot.libdoc``. libdoc is display-free (the native runtime is lazy), so installing ``robotframework-PlatynUI`` in CI is - enough — no desktop/AT-SPI needed. Verified against 0.12.0.dev330. + enough — no desktop/AT-SPI needed. Verified against 0.14.0.dev26. """ from __future__ import annotations @@ -31,7 +31,14 @@ "Bring To Front", "Close Window", "Focus", - "Get Attribute", + "Get Attribute Value", + "Get Element At Point", + "Pointer Scroll", + "Set Query Settings", + "Wait Until Attribute Value", + "Wait Until Exists", + "Wait Until Gone", + "Wait Until Query", "Get Pointer Position", "Highlight", "Keyboard Press", @@ -85,7 +92,7 @@ def test_skill_documents_baremetal_not_placeholder() -> None: refs = " ".join(p.read_text(encoding="utf-8") for p in SKILL_DIR.rglob("*.md")) blob = content + refs assert "placeholder" in blob.lower(), "must note the high-level PlatynUI is a placeholder" - assert "--pre" in blob or "0.12.0.dev" in blob, "must disclose the pre-release install" + assert "--pre" in blob or "0.14.0.dev" in blob, "must disclose the pre-release install" # --- Keyword fidelity (skip if PlatynUI absent) --------------------------- diff --git a/pyproject.toml b/pyproject.toml index 72725d1..26bf9c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,8 @@ dev = [ "robotframework-appiumlibrary", "robotframework-requests", "RESTinstance", - "robotframework-PlatynUI==0.12.0.dev330", + "robotframework-PlatynUI==0.14.0.dev26", + "platynui-cli==0.14.0.dev26", ] [project.scripts] diff --git a/uv.lock b/uv.lock index cacdf54..5e48e8f 100644 --- a/uv.lock +++ b/uv.lock @@ -1655,16 +1655,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/75/a6/a0a304dc33b49145b21f4808d763822111e67d1c3a32b524a1baf947b6e1/platformdirs-4.9.6-py3-none-any.whl", hash = "sha256:e61adb1d5e5cb3441b4b7710bea7e4c12250ca49439228cc1021c00dcfac0917", size = 21348, upload-time = "2026-04-09T00:04:09.463Z" }, ] +[[package]] +name = "platynui-cli" +version = "0.14.0.dev26" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/63/8f/5cd02f596cc70b9054d90c9f64f0606f21c2048f425397604c462828a5d1/platynui_cli-0.14.0.dev26-py3-none-macosx_11_0_arm64.whl", hash = "sha256:26836cbe030ecb489f7b91599cedd18ec544eebc527fd24b140693a4a9fa9f23", size = 2426132, upload-time = "2026-12-01T01:39:58.383Z" }, + { url = "https://files.pythonhosted.org/packages/c1/f1/181204a26618b9c2cbd3b3367865c74749c5fe47ad2ab9da35ef4c71af61/platynui_cli-0.14.0.dev26-py3-none-manylinux_2_34_aarch64.whl", hash = "sha256:470309ff21f09c1479f4f440cd8439a7683f5412831c29de28212b2cd267f432", size = 4607271, upload-time = "2026-12-01T01:39:59.943Z" }, + { url = "https://files.pythonhosted.org/packages/e7/01/baef8901af3f30e9972af3a68f7b633ffbc0f861719e52e784780cd95259/platynui_cli-0.14.0.dev26-py3-none-manylinux_2_34_x86_64.whl", hash = "sha256:65ee4bf84595659b267e8711f10b9dab5c014344abf5c1b823e8b91bdde92c6a", size = 4809689, upload-time = "2026-12-01T01:40:01.524Z" }, + { url = "https://files.pythonhosted.org/packages/b0/4b/bdeba7c9bd5ecec346d9af3544aba4e58c5db3a35fd31dbe9b2aab504207/platynui_cli-0.14.0.dev26-py3-none-win_amd64.whl", hash = "sha256:10701d82c139638b7d5d0ad80af175b07a80b18896b7bfaa0c4cff3d08ed1377", size = 3334015, upload-time = "2026-12-01T01:40:02.932Z" }, + { url = "https://files.pythonhosted.org/packages/f8/d9/4ae4e7cceec8036853da071feedb9cdabf17e5b6bbb4ff1483223d0903b0/platynui_cli-0.14.0.dev26-py3-none-win_arm64.whl", hash = "sha256:58f942f91474c68b4de875f5dfaa439bce41b19acf2a402af483ff78a7e84809", size = 3119000, upload-time = "2026-12-01T01:40:05.098Z" }, +] + [[package]] name = "platynui-native" -version = "0.12.0.dev330" +version = "0.14.0.dev26" source = { registry = "https://pypi.org/simple" } wheels = [ - { url = "https://files.pythonhosted.org/packages/e8/1a/7b17b2745342e0a78af10eb78533c21d67d0f801be5d356901ce2c2a0e1e/platynui_native-0.12.0.dev330-cp312-abi3-macosx_11_0_arm64.whl", hash = "sha256:6245f02b518ecc39d6df1f351abab3a34afd1fbdb88d893bbd9523f9afedd811", size = 2687016, upload-time = "2026-05-05T11:29:24.899Z" }, - { url = "https://files.pythonhosted.org/packages/07/f4/a70d23c86d49cf7f7092d9d2f70659f150d577e0d010a920987f9e362342/platynui_native-0.12.0.dev330-cp312-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:135760db2f407d6aa1c503e4a6e6b622c88d43b5109bef1b9d53b4bb049bda25", size = 5254719, upload-time = "2026-05-05T11:30:18.373Z" }, - { url = "https://files.pythonhosted.org/packages/34/d0/d9195a4193335f1e253b92959d776fda3d9ed901e6cbb5c12f1a2d516b73/platynui_native-0.12.0.dev330-cp312-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:d5421cb5b617f970502773cb74f2c6cfe33eade516ab7f557c158403c3a00816", size = 5311827, upload-time = "2026-05-05T11:29:36.811Z" }, - { url = "https://files.pythonhosted.org/packages/47/63/2991c13476575ed1d09f4f1f954a16e7736226f44648c8b8aa3592abf235/platynui_native-0.12.0.dev330-cp312-abi3-win_amd64.whl", hash = "sha256:7f0dc5f48492a302cbec246b99b93b86f3558921f2d5a73c6f33c1a85908dd9e", size = 2712039, upload-time = "2026-05-05T11:29:42.712Z" }, - { url = "https://files.pythonhosted.org/packages/62/82/3e2cf81d2a247eceb0eab4e6d8db4715f665413af3ce62b66afde129fd71/platynui_native-0.12.0.dev330-cp312-abi3-win_arm64.whl", hash = "sha256:00f6da6c8b3e7d0681ca20120747eb0646d8aec7517a8960e04dc43cdeda440e", size = 2591104, upload-time = "2026-05-05T11:28:38.012Z" }, + { url = "https://files.pythonhosted.org/packages/42/c1/fc351f9486b43c43e1e992c21f479a87273ef8e3a819f8a7e4eee68dd045/platynui_native-0.14.0.dev26-cp312-abi3-macosx_11_0_arm64.whl", hash = "sha256:5049e6e8bd5c9d97efd7dfc4e639ca15bc807ac7f609b1ace1a2d5bf81065958", size = 2232649, upload-time = "2026-12-01T01:40:17.691Z" }, + { url = "https://files.pythonhosted.org/packages/21/08/f5f1d9dac4e5e99e91b07740db8d8df89726a8ffbd7c00b2f38e48855119/platynui_native-0.14.0.dev26-cp312-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:35b0204c087434cb98968d9f6569fbe0d94297bc9131b6eb9c1a02bf2177c6d1", size = 4398174, upload-time = "2026-12-01T01:40:19.253Z" }, + { url = "https://files.pythonhosted.org/packages/e7/89/c30d188a0a4d03b8ed0257e8cdb63284ab4ea1506d8aa998c2051268accd/platynui_native-0.14.0.dev26-cp312-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:cbe5cbc89aaee13e04098d7265fdd0c99fc7aa626e8d3fcc94c593fafa1a8130", size = 4588485, upload-time = "2026-12-01T01:40:20.67Z" }, + { url = "https://files.pythonhosted.org/packages/c6/3a/6bb1529dabb89382b5274d6bbab3ed6e809accdcb6b36dbdfc40ff9fcc44/platynui_native-0.14.0.dev26-cp312-abi3-win_amd64.whl", hash = "sha256:c532bfde7410a62dec6d9f0fbbe8b8a53e5f2fb851ede5d1776b124c09f65455", size = 3099623, upload-time = "2026-12-01T01:40:21.968Z" }, + { url = "https://files.pythonhosted.org/packages/e1/b6/6526e32b3e16e73df10db126841c9417a7dd1bf922a5ddf86a2d2b069e95/platynui_native-0.14.0.dev26-cp312-abi3-win_arm64.whl", hash = "sha256:428603111ca6c682ee460404983f155e5d19690d7cc15fe4d87a7dbfb8e3f433", size = 2904022, upload-time = "2026-12-01T01:40:23.572Z" }, ] [[package]] @@ -2247,6 +2259,7 @@ dependencies = [ dev = [ { name = "jsonschema" }, { name = "mypy" }, + { name = "platynui-cli" }, { name = "pytest" }, { name = "pytest-cov" }, { name = "restinstance" }, @@ -2278,13 +2291,14 @@ requires-dist = [ dev = [ { name = "jsonschema", specifier = ">=4.18" }, { name = "mypy", specifier = ">=1.11" }, + { name = "platynui-cli", specifier = "==0.14.0.dev26" }, { name = "pytest", specifier = ">=8" }, { name = "pytest-cov", specifier = ">=5" }, { name = "restinstance" }, { name = "robotcode", extras = ["all"], specifier = ">=2.8" }, { name = "robotframework-appiumlibrary" }, { name = "robotframework-browser" }, - { name = "robotframework-platynui", specifier = "==0.12.0.dev330" }, + { name = "robotframework-platynui", specifier = "==0.14.0.dev26" }, { name = "robotframework-requests" }, { name = "robotframework-robocop", specifier = ">=8" }, { name = "robotframework-seleniumlibrary" }, @@ -2597,7 +2611,7 @@ wheels = [ [[package]] name = "robotframework-platynui" -version = "0.12.0.dev330" +version = "0.14.0.dev26" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "platynui-native" }, @@ -2607,7 +2621,7 @@ dependencies = [ { name = "typing-extensions" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/5f/67/b9094d094a03be440eb86196379cb6a24a4dc61efcd4ec78310718785c2f/robotframework_platynui-0.12.0.dev330-py3-none-any.whl", hash = "sha256:07ef586f2b228b20fc43f9a018b664262b76f0429e0fdc23b2e8944ad0066568", size = 108260, upload-time = "2026-05-05T11:28:40.046Z" }, + { url = "https://files.pythonhosted.org/packages/6c/7b/c4606b329c21cb14021086097a7a044c7be63ce159e138f5a6ddb08272a7/robotframework_platynui-0.14.0.dev26-py3-none-any.whl", hash = "sha256:cf3f3cbb63ec111016b8ada7c0fd7fa31f6e0da104d1f4c66fa9f93e8af4fc68", size = 150430, upload-time = "2026-12-01T01:40:26.908Z" }, ] [[package]]