From dc7c1686925bbcf1692819706310886701a074d1 Mon Sep 17 00:00:00 2001 From: Igor Costa Date: Fri, 16 Oct 2026 02:35:02 +1300 Subject: [PATCH] [wrangler] Include Autohand Code CLI in skills installation --- .changeset/autohand-code-skills.md | 7 ++ packages/wrangler/package.json | 2 +- .../__tests__/agents-skills-install.test.ts | 84 +++++++++++++++++++ pnpm-lock.yaml | 10 +-- 4 files changed, 97 insertions(+), 6 deletions(-) create mode 100644 .changeset/autohand-code-skills.md diff --git a/.changeset/autohand-code-skills.md b/.changeset/autohand-code-skills.md new file mode 100644 index 00000000000..e2b08620588 --- /dev/null +++ b/.changeset/autohand-code-skills.md @@ -0,0 +1,7 @@ +--- +"wrangler": patch +--- + +Include Autohand Code CLI in Cloudflare skills installation and updates + +Update the Rosie agent registry so Wrangler detects Autohand Code CLI and installs Cloudflare skills into `~/.autohand/skills`. Existing Wrangler-managed installations can use the same skills update flow as other supported agents. diff --git a/packages/wrangler/package.json b/packages/wrangler/package.json index 62325d6b0d4..2e278aa40d9 100644 --- a/packages/wrangler/package.json +++ b/packages/wrangler/package.json @@ -170,7 +170,7 @@ "qr": "^0.6.0", "recast": "0.23.11", "resolve": "^1.22.8", - "rosie-skills": "^0.8.1", + "rosie-skills": "^0.8.5", "semiver": "^1.1.0", "shell-quote": "^1.9.0", "signal-exit": "catalog:default", diff --git a/packages/wrangler/src/__tests__/agents-skills-install.test.ts b/packages/wrangler/src/__tests__/agents-skills-install.test.ts index 31cd8d9632e..1149c42e5fa 100644 --- a/packages/wrangler/src/__tests__/agents-skills-install.test.ts +++ b/packages/wrangler/src/__tests__/agents-skills-install.test.ts @@ -79,6 +79,90 @@ const DEFAULT_INSTALL_RESULT = { installedInstruction: null, }; +describe("Autohand Code skills installation", () => { + runInTempDir(); + const std = mockConsoleMethods(); + const { setIsTTY } = useMockIsTTY(); + + afterEach(() => { + clearDialogs(); + }); + + test("detects Autohand with the real Rosie registry and installs and updates its skills", async ({ + expect, + }) => { + const rosie = + await vi.importActual("rosie-skills"); + createAgentDir(".autohand"); + const skillsPath = path.join(os.homedir(), ".autohand", "skills"); + mockRosieAgents.mockImplementation(rosie.agents); + mockRosieInstall.mockResolvedValue({ + ...DEFAULT_INSTALL_RESULT, + skills: [ + { + ...DEFAULT_INSTALL_RESULT.skills[0], + installedAgents: ["autohand-code"], + }, + ], + installedAgents: ["autohand-code"], + }); + mockGitHubSkillsApi(["cloudflare"], "old-sha"); + setIsTTY(true); + + const runSkillsInstallFlow = await freshImport(); + await runSkillsInstallFlow({ force: true }); + + expect(mockRosieInstall).toHaveBeenCalledWith( + "cloudflare/skills", + expect.objectContaining({ agent: ["autohand-code"], global: true }) + ); + expect(std.out).toContain( + "Successfully installed Cloudflare skills for: Autohand Code CLI" + ); + expect(readMetadataFile()).toMatchObject({ + accepted: true, + installFailed: false, + detectedAgents: [ + { + name: "Autohand Code CLI", + rosie: { id: "autohand-code", globalPath: skillsPath }, + }, + ], + }); + + mkdirSync(path.join(skillsPath, "cloudflare"), { recursive: true }); + // An update is only offered after the installation cooldown and cache expire. + writeMetadataFile({ + ...readMetadataFile(), + date: "2025-01-01T00:00:00Z", + }); + writeFileSync( + path.join(getGlobalConfigPath(), "cloudflare-skills-repo-cache.json"), + JSON.stringify({ lastUpdate: 0, skillNames: ["cloudflare"] }) + ); + mockGitHubSkillsApi(["cloudflare"], "new-sha"); + mockConfirm({ + text: "It looks like your Cloudflare skills might be out of date. Would you like Wrangler to update them for you?", + result: true, + }); + const runSkillsUpdateFlow = await freshUpdateImport(); + await runSkillsUpdateFlow({ command: "deploy" }); + + expect(mockRosieInstall).toHaveBeenCalledTimes(2); + expect(mockRosieInstall).toHaveBeenLastCalledWith( + "cloudflare/skills", + expect.objectContaining({ agent: ["autohand-code"], global: true }) + ); + expect(std.out).toContain( + "Successfully updated Cloudflare skills for: Autohand Code CLI" + ); + expect(readMetadataFile()).toMatchObject({ + installedTreeSha: "new-sha", + installFailed: false, + }); + }); +}); + /** Writes the skills-install metadata file to the global wrangler config path. */ function writeMetadataFile(content: Record): void { const configDir = getGlobalConfigPath(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f627dcf0ba..430d181b8b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4855,8 +4855,8 @@ importers: specifier: ^1.22.8 version: 1.22.8 rosie-skills: - specifier: ^0.8.1 - version: 0.8.1 + specifier: ^0.8.5 + version: 0.8.5 semiver: specifier: ^1.1.0 version: 1.1.0 @@ -14760,8 +14760,8 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - rosie-skills@0.8.1: - resolution: {integrity: sha512-byhpM6YcmlQfjPiOBL+6TGW9Wur3DHH4OcVFcGyRhjxeLLRfZg7dEfI2fFKmc6al/eNEPLQ7pSe+JNETk55Fzw==} + rosie-skills@0.8.5: + resolution: {integrity: sha512-Ho/mkbnaSr8VFSJdfoExrka9/lE+1vHZjBou5gEEebcDWpWEsDAKAy/hxZ1ayDPaacCIyFiTp5L6bZp82haabQ==} engines: {node: '>=18'} hasBin: true @@ -26509,7 +26509,7 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.57.1 fsevents: 2.3.3 - rosie-skills@0.8.1: + rosie-skills@0.8.5: dependencies: modern-tar: 0.7.6