From ebe538f9eca0c68cfd781d9e845c4a8615170da7 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Tue, 8 Sep 2026 21:17:37 +0900 Subject: [PATCH] feat(practical): add build-endpoints-workers on a stock create-hono Workers fixture Every existing fixture has only a typecheck script, so an agent never has a dev server to start; across 100 runs this week none did. On the create-hono Workers template as-is (npm run dev = wrangler dev, no typecheck script, no AGENTS.md) Haiku baseline ran npm run dev on its second command in 5/5 runs and hung until the timeout (0/5), while cli+skill passed 5/5 in about 30 seconds; Sonnet 5 baseline passed 4/5 but spent 6-12 commands per run wrestling wrangler. This is the failure mode the CLI was built for, measured for the first time. --- .github/workflows/eval.yml | 2 +- README.ja.md | 1 + README.md | 1 + apps/web/src/app.tsx | 1 + .../agent-dx/fixtures/hono-workers/README.md | 21 ++++++++++ .../fixtures/hono-workers/package.json | 16 ++++++++ .../fixtures/hono-workers/src/index.ts | 9 +++++ .../fixtures/hono-workers/tsconfig.json | 12 ++++++ .../fixtures/hono-workers/wrangler.jsonc | 38 +++++++++++++++++++ .../agent-dx/src/suites/practical/index.ts | 2 + .../tasks/build-endpoints-workers.ts | 17 +++++++++ 11 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 packages/agent-dx/fixtures/hono-workers/README.md create mode 100644 packages/agent-dx/fixtures/hono-workers/package.json create mode 100644 packages/agent-dx/fixtures/hono-workers/src/index.ts create mode 100644 packages/agent-dx/fixtures/hono-workers/tsconfig.json create mode 100644 packages/agent-dx/fixtures/hono-workers/wrangler.jsonc create mode 100644 packages/agent-dx/src/suites/practical/tasks/build-endpoints-workers.ts diff --git a/.github/workflows/eval.yml b/.github/workflows/eval.yml index 37b6b4b..08724e8 100644 --- a/.github/workflows/eval.yml +++ b/.github/workflows/eval.yml @@ -101,7 +101,7 @@ jobs: # suite exists for): the CLI as a devDependency, its verification # policy line in AGENTS.md, and the skill from honojs/skills. git clone --depth 1 https://github.com/honojs/skills /tmp/hono-skills - for task in build-endpoints build-shop session-users refactor-routes fix-404 fix-404-shadow; do + for task in build-endpoints build-endpoints-workers build-shop session-users refactor-routes fix-404 fix-404-shadow; do echo "::group::practical $task baseline" node packages/agent-dx/dist/cli.js \ --suite practical \ diff --git a/README.ja.md b/README.ja.md index 5072300..139ba74 100644 --- a/README.ja.md +++ b/README.ja.md @@ -79,6 +79,7 @@ pnpm build | `--task` | fixture | 依頼する変更 | | ------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------- | | `build-endpoints`(デフォルト) | `hono-fresh` | ゼロからusers CRUDを作り、実際に動くことを確認する | +| `build-endpoints-workers` | `hono-workers` | 同じ users CRUD を、`npm run dev` で `wrangler dev` が立つ素の create-hono Workers プロジェクトで | | `build-shop` | `hono-fresh` | プロンプトに実行可能な受け入れ仕様(`expect` 付きのリクエスト行)を添えて、ゼロからショップ API を作る | | `session-users` | `hono-fresh` | 1 つの会話で 4 回の変更依頼。最終状態がすべてのステップの契約を満たしていなければならない | | `refactor-routes` | `hono-shop-flat` | 肥大化した単一ファイルアプリ(27 ルート、shadowing しやすい兄弟ルート、大きな一覧)を挙動を変えずに分割 | diff --git a/README.md b/README.md index 22875b9..5d3a243 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ Run `agent-dx --list` for the up-to-date list. As of v0: | `--task` | Fixture | Change requested | | --------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------- | | `build-endpoints` (default) | `hono-fresh` | Build a users CRUD from scratch and make sure it works | +| `build-endpoints-workers` | `hono-workers` | The same users CRUD on a stock create-hono Workers project, where `npm run dev` starts `wrangler dev` | | `build-shop` | `hono-fresh` | Build a shop API from scratch against an executable acceptance spec (request lines with `expect`) in the prompt | | `session-users` | `hono-fresh` | Four change requests in one conversation; the final state must honor every step's contract | | `refactor-routes` | `hono-shop-flat` | Split a bloated single-file app (27 routes, shadow-prone siblings, large lists) into routers without changing behavior | diff --git a/apps/web/src/app.tsx b/apps/web/src/app.tsx index ff7455d..f38686c 100644 --- a/apps/web/src/app.tsx +++ b/apps/web/src/app.tsx @@ -656,6 +656,7 @@ const MODEL_ORDER = ['claude-haiku-4-5', 'claude-sonnet-5', 'claude-opus-5'] // Build → evolve → refactor → debug: the order tasks are listed in the CLI. const TASK_ORDER = [ 'build-endpoints', + 'build-endpoints-workers', 'build-shop', 'session-users', 'refactor-routes', diff --git a/packages/agent-dx/fixtures/hono-workers/README.md b/packages/agent-dx/fixtures/hono-workers/README.md new file mode 100644 index 0000000..9800770 --- /dev/null +++ b/packages/agent-dx/fixtures/hono-workers/README.md @@ -0,0 +1,21 @@ +```txt +npm install +npm run dev +``` + +```txt +npm run deploy +``` + +[For generating/synchronizing types based on your Worker configuration run](https://developers.cloudflare.com/workers/wrangler/commands/#types): + +```txt +npm run cf-typegen +``` + +Pass the `CloudflareBindings` as generics when instantiating `Hono`: + +```ts +// src/index.ts +const app = new Hono<{ Bindings: CloudflareBindings }>() +``` diff --git a/packages/agent-dx/fixtures/hono-workers/package.json b/packages/agent-dx/fixtures/hono-workers/package.json new file mode 100644 index 0000000..7f7a2cc --- /dev/null +++ b/packages/agent-dx/fixtures/hono-workers/package.json @@ -0,0 +1,16 @@ +{ + "name": "hono-workers", + "type": "module", + "scripts": { + "dev": "wrangler dev", + "deploy": "wrangler deploy --minify", + "cf-typegen": "wrangler types --env-interface CloudflareBindings" + }, + "dependencies": { + "hono": "^4.13.7" + }, + "devDependencies": { + "wrangler": "^4.110.0", + "typescript": "^5.9.3" + } +} diff --git a/packages/agent-dx/fixtures/hono-workers/src/index.ts b/packages/agent-dx/fixtures/hono-workers/src/index.ts new file mode 100644 index 0000000..3191383 --- /dev/null +++ b/packages/agent-dx/fixtures/hono-workers/src/index.ts @@ -0,0 +1,9 @@ +import { Hono } from 'hono' + +const app = new Hono() + +app.get('/', (c) => { + return c.text('Hello Hono!') +}) + +export default app diff --git a/packages/agent-dx/fixtures/hono-workers/tsconfig.json b/packages/agent-dx/fixtures/hono-workers/tsconfig.json new file mode 100644 index 0000000..5e1f025 --- /dev/null +++ b/packages/agent-dx/fixtures/hono-workers/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Bundler", + "strict": true, + "skipLibCheck": true, + "lib": ["ESNext"], + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + } +} diff --git a/packages/agent-dx/fixtures/hono-workers/wrangler.jsonc b/packages/agent-dx/fixtures/hono-workers/wrangler.jsonc new file mode 100644 index 0000000..9199465 --- /dev/null +++ b/packages/agent-dx/fixtures/hono-workers/wrangler.jsonc @@ -0,0 +1,38 @@ +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "hono-workers", + "main": "src/index.ts", + "compatibility_date": "2026-09-08", + // "compatibility_flags": [ + // "nodejs_compat" + // ], + // "vars": { + // "MY_VAR": "my-variable" + // }, + // "kv_namespaces": [ + // { + // "binding": "MY_KV_NAMESPACE", + // "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + // } + // ], + // "r2_buckets": [ + // { + // "binding": "MY_BUCKET", + // "bucket_name": "my-bucket" + // } + // ], + // "d1_databases": [ + // { + // "binding": "MY_DB", + // "database_name": "my-database", + // "database_id": "" + // } + // ], + // "ai": { + // "binding": "AI" + // }, + // "observability": { + // "enabled": true, + // "head_sampling_rate": 1 + // } +} diff --git a/packages/agent-dx/src/suites/practical/index.ts b/packages/agent-dx/src/suites/practical/index.ts index 7839ea8..78d3311 100644 --- a/packages/agent-dx/src/suites/practical/index.ts +++ b/packages/agent-dx/src/suites/practical/index.ts @@ -12,6 +12,7 @@ import { TOOL_VERSION } from '../../version.js' import { createWorkspaceFrom, persistWorkspace, removeWorkspace } from '../../workspace.js' import type { PracticalTask } from './task.js' import { buildEndpointsTask } from './tasks/build-endpoints.js' +import { buildEndpointsWorkersTask } from './tasks/build-endpoints-workers.js' import { buildShopTask } from './tasks/build-shop.js' import { fix404Task } from './tasks/fix-404.js' import { fix404ShadowTask } from './tasks/fix-404-shadow.js' @@ -29,6 +30,7 @@ import { sessionUsersTask } from './tasks/session-users.js' export const PRACTICAL_TASKS: Record = { [buildEndpointsTask.id]: buildEndpointsTask, + [buildEndpointsWorkersTask.id]: buildEndpointsWorkersTask, [buildShopTask.id]: buildShopTask, [sessionUsersTask.id]: sessionUsersTask, [refactorRoutesTask.id]: refactorRoutesTask, diff --git a/packages/agent-dx/src/suites/practical/tasks/build-endpoints-workers.ts b/packages/agent-dx/src/suites/practical/tasks/build-endpoints-workers.ts new file mode 100644 index 0000000..62ac206 --- /dev/null +++ b/packages/agent-dx/src/suites/practical/tasks/build-endpoints-workers.ts @@ -0,0 +1,17 @@ +import type { PracticalTask } from '../task.js' +import { buildEndpointsTask } from './build-endpoints.js' + +/** + * Task: the same users CRUD, on a stock create-hono Cloudflare Workers + * project — `npm run dev` starts `wrangler dev`, there is no typecheck + * script and no AGENTS.md. Every other fixture has no dev server, so the + * failure mode the Hono CLI was built for (the agent starts a server in + * the foreground to verify and never gets its shell back) cannot happen + * there. Here it can. Note for local runs: agents may `pkill -f wrangler`. + */ +export const buildEndpointsWorkersTask: PracticalTask = { + ...buildEndpointsTask, + id: 'build-endpoints-workers', + description: 'Build a users CRUD on a stock create-hono Workers project (wrangler dev available)', + fixture: 'hono-workers', +}