Skip to content

Fix template Hono RPC response inference#1449

Merged
parteeksingh24 merged 3 commits intomainfrom
fix/template-hono-rpc-types
May 6, 2026
Merged

Fix template Hono RPC response inference#1449
parteeksingh24 merged 3 commits intomainfrom
fix/template-hono-rpc-types

Conversation

@parteeksingh24
Copy link
Copy Markdown
Contributor

@parteeksingh24 parteeksingh24 commented May 6, 2026

Summary

  • Anchor default template JSON responses to schema-derived output types
  • Derive default and auth frontend response types from Hono InferResponseType
  • Add template probes for default and auth Hono RPC response contracts

Closes #1441.

Why

The default template could let a loose API response type flow into the frontend as
JSONValue[], causing generated projects to fail on the history response.

A simplified version of the bad shape:

const history = [] as unknown[];

return c.json({
  history,
  threadId: c.var.thread.id,
  translationCount,
});

That made the frontend see:

{ history: JSONValue[]; threadId: string | undefined; translationCount: number; }

instead of the expected history entry array.

This change makes the API response satisfy the schema-derived type before it is
returned:

type HistoryData = s.infer<typeof HistoryOutput>;

const result: HistoryData = {
  history,
  threadId: c.var.thread.id,
  translationCount,
};

return c.json(result);

The frontend now consumes the Hono-inferred response type directly:

type HistoryData = InferResponseType<typeof client.translate.history.$get>;

Testing

  • bunx biome format --write scripts/test-templates.ts templates/default/src/web/App.tsx templates/default/src/api/index.ts templates/auth/src/web/App.tsx
  • bunx biome lint scripts/test-templates.ts templates/default/src/api/index.ts templates/default/src/web/App.tsx templates/auth/src/web/App.tsx
  • bun scripts/test-templates.ts --skip-outdated
  • Negative check: default history as unknown[] fails typecheck at the API boundary
  • Negative check: auth /health.timestamp as number fails the Hono RPC probe
  • git diff --cached --check

References

Summary by CodeRabbit

  • New Features

    • Enhanced type safety for API responses in templates through improved type inference from route definitions.
    • Default and auth templates now provide stronger type definitions for API interactions.
  • Tests

    • Integrated new verification step that validates API response types match expected shapes for supported templates during testing workflow.

- Anchor default JSON responses to schema-derived types
- Derive template web types from `InferResponseType`
- Probe default and auth Hono RPC response contracts
@agentuity-agent
Copy link
Copy Markdown

agentuity-agent Bot commented May 6, 2026

The latest Agentuity deployment details.

Project Deployment Preview Updated (UTC)
docs 🟢 Ready (deploy_19b73de4b6b6200283ed43c494fdf95d) - 2026-05-06T20:13:02Z

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

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

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

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

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

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

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

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9282b4a9-2312-4865-a1e9-f45cf2cab723

📥 Commits

Reviewing files that changed from the base of the PR and between 64ef2b3 and ade7ddd.

📒 Files selected for processing (1)
  • scripts/test-templates.ts
📝 Walkthrough

Walkthrough

This PR introduces Hono RPC type-based response typing across default and auth templates. API handlers now construct explicitly typed result objects; frontends derive types from API responses using InferResponseType instead of manual interfaces. Template test script gains a verification step that typechecks template-specific Hono RPC response probes.

Changes

API Response Typing & Type Verification

Layer / File(s) Summary
API Response Shape
templates/default/src/api/index.ts
TranslateOutput adds translationCount field. New type aliases TranslateResult, HistoryOutput, and HistoryData represent response shapes. Handlers construct and return strongly typed result objects instead of inline literals.
Frontend Type Derivation
templates/default/src/web/App.tsx, templates/auth/src/web/App.tsx
Import InferResponseType to derive response types from API client. Default frontend replaces manual interfaces with HistoryData, TranslateResult, and HistoryEntry aliases. Auth frontend derives ProtectedRouteResult from /api/me route. Frontend state updates and handlers simplified to use inferred types.
Type Verification & Test Integration
scripts/test-templates.ts
New getTemplateHonoRpcResponseTypeProbe() generates template-specific TypeScript type-checking probes. New verifyHonoRpcResponseTypes() writes probe file and runs project typecheck. Step 4.5 inserted in test flow to conditionally verify response types for applicable templates and fail test if verification fails.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The pull request comprehensively addresses issue #1441 by anchoring API responses to schema-derived types and using Hono's InferResponseType for frontend typing.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing Hono RPC response type inference in default and auth templates, matching the stated objectives.

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


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

❤️ Share

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

📦 Canary Packages Published

version: 2.0.14-ade7ddd

Packages
Package Version URL
@agentuity/opencode 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-opencode-2.0.14-ade7ddd.tgz
@agentuity/auth 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-auth-2.0.14-ade7ddd.tgz
@agentuity/cli 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-cli-2.0.14-ade7ddd.tgz
@agentuity/runtime 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-runtime-2.0.14-ade7ddd.tgz
@agentuity/claude-code 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-claude-code-2.0.14-ade7ddd.tgz
@agentuity/coder 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-coder-2.0.14-ade7ddd.tgz
@agentuity/postgres 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-postgres-2.0.14-ade7ddd.tgz
@agentuity/schedule 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-schedule-2.0.14-ade7ddd.tgz
@agentuity/sandbox 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-sandbox-2.0.14-ade7ddd.tgz
@agentuity/core 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-core-2.0.14-ade7ddd.tgz
@agentuity/queue 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-queue-2.0.14-ade7ddd.tgz
@agentuity/react 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-react-2.0.14-ade7ddd.tgz
@agentuity/webhook 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-webhook-2.0.14-ade7ddd.tgz
@agentuity/schema 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-schema-2.0.14-ade7ddd.tgz
@agentuity/evals 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-evals-2.0.14-ade7ddd.tgz
@agentuity/frontend 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-frontend-2.0.14-ade7ddd.tgz
@agentuity/migrate 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-migrate-2.0.14-ade7ddd.tgz
@agentuity/workbench 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-workbench-2.0.14-ade7ddd.tgz
@agentuity/db 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-db-2.0.14-ade7ddd.tgz
@agentuity/drizzle 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-drizzle-2.0.14-ade7ddd.tgz
@agentuity/email 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-email-2.0.14-ade7ddd.tgz
@agentuity/vector 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-vector-2.0.14-ade7ddd.tgz
@agentuity/keyvalue 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-keyvalue-2.0.14-ade7ddd.tgz
@agentuity/coder-tui 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-coder-tui-2.0.14-ade7ddd.tgz
@agentuity/task 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-task-2.0.14-ade7ddd.tgz
@agentuity/server 2.0.14-ade7ddd https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-server-2.0.14-ade7ddd.tgz
Install

Add to your package.json:

{
  "dependencies": {
    "@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-opencode-2.0.14-ade7ddd.tgz",
    "@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-auth-2.0.14-ade7ddd.tgz",
    "@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-cli-2.0.14-ade7ddd.tgz",
    "@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-runtime-2.0.14-ade7ddd.tgz",
    "@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-claude-code-2.0.14-ade7ddd.tgz",
    "@agentuity/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-coder-2.0.14-ade7ddd.tgz",
    "@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-postgres-2.0.14-ade7ddd.tgz",
    "@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-schedule-2.0.14-ade7ddd.tgz",
    "@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-sandbox-2.0.14-ade7ddd.tgz",
    "@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-core-2.0.14-ade7ddd.tgz",
    "@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-queue-2.0.14-ade7ddd.tgz",
    "@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-react-2.0.14-ade7ddd.tgz",
    "@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-webhook-2.0.14-ade7ddd.tgz",
    "@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-schema-2.0.14-ade7ddd.tgz",
    "@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-evals-2.0.14-ade7ddd.tgz",
    "@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-frontend-2.0.14-ade7ddd.tgz",
    "@agentuity/migrate": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-migrate-2.0.14-ade7ddd.tgz",
    "@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-workbench-2.0.14-ade7ddd.tgz",
    "@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-db-2.0.14-ade7ddd.tgz",
    "@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-drizzle-2.0.14-ade7ddd.tgz",
    "@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-email-2.0.14-ade7ddd.tgz",
    "@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-vector-2.0.14-ade7ddd.tgz",
    "@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-keyvalue-2.0.14-ade7ddd.tgz",
    "@agentuity/coder-tui": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-coder-tui-2.0.14-ade7ddd.tgz",
    "@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-task-2.0.14-ade7ddd.tgz",
    "@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-server-2.0.14-ade7ddd.tgz"
  }
}

Or install directly:

bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-opencode-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-auth-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-cli-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-runtime-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-claude-code-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-coder-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-postgres-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-schedule-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-sandbox-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-core-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-queue-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-react-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-webhook-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-schema-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-evals-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-frontend-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-migrate-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-workbench-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-db-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-drizzle-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-email-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-vector-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-keyvalue-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-coder-tui-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-task-2.0.14-ade7ddd.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.14-ade7ddd/agentuity-server-2.0.14-ade7ddd.tgz

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
scripts/test-templates.ts (2)

537-624: 💤 Low value

Optional: deduplicate the boilerplate prelude across probes.

Both probe strings repeat the hc/InferResponseType/ApiRouter import block and the expectType declaration. As more templates gain probes, factoring this into a small helper (buildProbeSource(body: string): string) would keep them consistent and shorten diffs. Skip if you'd rather keep each probe self-contained for readability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test-templates.ts` around lines 537 - 624, The probe strings in
getTemplateHonoRpcResponseTypeProbe repeat identical prelude lines (imports of
hc/InferResponseType/ApiRouter and the expectType declaration); refactor by
adding a helper function (e.g., buildProbeSource(body: string): string) and have
getTemplateHonoRpcResponseTypeProbe return buildProbeSource(`<probe-specific
body>`) for each case; update the 'default' and 'auth' branches to pass only the
probe-specific type assertions and bodies to buildProbeSource and keep the
shared prelude centralized while preserving existing probe bodies and names.

626-634: 💤 Low value

Probe path assumes every probed template has src/web/.

writeFileSync(join(projectDir, 'src', 'web', 'hono-rpc-response-type-probe.ts'), …) will throw ENOENT if a future template gains a probe but lacks src/web/. Today both probed templates (default, auth) have that directory, so this is a future-proofing nit, not a current bug. Two cheap mitigations:

♻️ Option A — ensure the directory exists
-	const probePath = join(projectDir, 'src', 'web', 'hono-rpc-response-type-probe.ts');
-	writeFileSync(probePath, probeSource);
+	const probeDir = join(projectDir, 'src', 'web');
+	mkdirSync(probeDir, { recursive: true });
+	const probePath = join(probeDir, 'hono-rpc-response-type-probe.ts');
+	writeFileSync(probePath, probeSource);
♻️ Option B — return `{ source, relativePath }` from the generator

Have getTemplateHonoRpcResponseTypeProbe return { source, relativePath } so each template can place the probe wherever its tsconfig includes (e.g., src/api/... for non-web templates). Adjust the import path inside each probe accordingly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test-templates.ts` around lines 626 - 634, The probe writer
verifyHonoRpcResponseTypes currently assumes src/web exists and can throw
ENOENT; fix it by ensuring the target directory exists before writing the probe
(call a recursive mkdir for the directory containing
'hono-rpc-response-type-probe.ts' inside verifyHonoRpcResponseTypes) or
alternatively change the probe generator getTemplateHonoRpcResponseTypeProbe to
return { source, relativePath } so callers write the probe to the returned
relativePath (which will match the template's tsconfig) and create the
containing directory if needed; update verifyHonoRpcResponseTypes to use the
returned relativePath when present and always ensure the directory exists before
writeFileSync.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/test-templates.ts`:
- Around line 537-624: The probe strings in getTemplateHonoRpcResponseTypeProbe
repeat identical prelude lines (imports of hc/InferResponseType/ApiRouter and
the expectType declaration); refactor by adding a helper function (e.g.,
buildProbeSource(body: string): string) and have
getTemplateHonoRpcResponseTypeProbe return buildProbeSource(`<probe-specific
body>`) for each case; update the 'default' and 'auth' branches to pass only the
probe-specific type assertions and bodies to buildProbeSource and keep the
shared prelude centralized while preserving existing probe bodies and names.
- Around line 626-634: The probe writer verifyHonoRpcResponseTypes currently
assumes src/web exists and can throw ENOENT; fix it by ensuring the target
directory exists before writing the probe (call a recursive mkdir for the
directory containing 'hono-rpc-response-type-probe.ts' inside
verifyHonoRpcResponseTypes) or alternatively change the probe generator
getTemplateHonoRpcResponseTypeProbe to return { source, relativePath } so
callers write the probe to the returned relativePath (which will match the
template's tsconfig) and create the containing directory if needed; update
verifyHonoRpcResponseTypes to use the returned relativePath when present and
always ensure the directory exists before writeFileSync.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0196dba8-1090-4f18-b081-9f7bb5d25209

📥 Commits

Reviewing files that changed from the base of the PR and between 237ad28 and 64ef2b3.

📒 Files selected for processing (4)
  • scripts/test-templates.ts
  • templates/auth/src/web/App.tsx
  • templates/default/src/api/index.ts
  • templates/default/src/web/App.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Windows WSL CLI Smoke Test
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Agentuity Deployment
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • templates/auth/src/web/App.tsx
  • templates/default/src/api/index.ts
  • scripts/test-templates.ts
  • templates/default/src/web/App.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • templates/auth/src/web/App.tsx
  • templates/default/src/api/index.ts
  • scripts/test-templates.ts
  • templates/default/src/web/App.tsx
templates/auth/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (templates/auth/AGENTS.md)

Use Bun instead of NodeJS and TypeScript for all source code

Files:

  • templates/auth/src/web/App.tsx
templates/auth/src/web/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (templates/auth/AGENTS.md)

templates/auth/src/web/**/*.{tsx,jsx}: Use <AuthView pathname={...}> to render the appropriate auth form (sign-in / sign-up / forgot-password / etc.) based on the current pathname
Use useAuthenticate() hook to access { user, isPending } for the signed-in user in React components
Use <AuthSwitch> wrapper to maintain previous auth state during isPending refetches to prevent layout collapse on sign-in or sign-out

Files:

  • templates/auth/src/web/App.tsx
**/index.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use named exports from package index.ts files

Files:

  • templates/default/src/api/index.ts
🧠 Learnings (6)
📚 Learning: 2026-01-06T03:11:55.300Z
Learnt from: mcongrove
Repo: agentuity/sdk PR: 396
File: templates/default/src/web/App.tsx:111-111
Timestamp: 2026-01-06T03:11:55.300Z
Learning: In this repository's default template (Tailwind CSS v4 via tailwindcss/vite), gradient utilities such as bg-linear-to-*, bg-radial, and bg-conic are valid. Do not flag or replace these with bg-gradient-to-* in template files under templates/, including templates/default/src/web/App.tsx. Use bg-* utilities appropriate to Tailwind v4.

Applied to files:

  • templates/auth/src/web/App.tsx
  • templates/default/src/web/App.tsx
📚 Learning: 2026-01-09T16:26:51.893Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 523
File: templates/_base/src/web/frontend.tsx:13-35
Timestamp: 2026-01-09T16:26:51.893Z
Learning: In web frontend code, prefer using the built-in Error class for runtime errors. Do not throw or re-export StructuredError from agentuity/core in web app code. Replace instances of StructuredError with new Error or custom error types that extend Error; ensure error handling logic remains intact and that error messages are descriptive. This guideline applies to all web UI TypeScript/TSX files that run in the browser and import StructuredError from agentuity/core.

Applied to files:

  • templates/auth/src/web/App.tsx
  • templates/default/src/web/App.tsx
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.

Applied to files:

  • templates/default/src/api/index.ts
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.

Applied to files:

  • templates/default/src/api/index.ts
  • scripts/test-templates.ts
📚 Learning: 2026-02-25T22:13:01.823Z
Learnt from: Huijiro
Repo: agentuity/sdk PR: 1063
File: apps/testing/vite-rsc-app/agentuity/src/api/index.ts:26-26
Timestamp: 2026-02-25T22:13:01.823Z
Learning: Agentuity SDK requires default exports for API route files (e.g., src/api/**/index.ts and src/api/**/route.ts) because the CLI's generateRouteRegistry relies on default exports to discover routes. Using named exports will skip route generation and lead to runtime 500 errors. This overrides typical guidance about named exports in index.ts files; ensure a default export is present in all relevant API route files under src/api/**/.

Applied to files:

  • templates/default/src/api/index.ts
📚 Learning: 2026-01-06T03:11:55.300Z
Learnt from: mcongrove
Repo: agentuity/sdk PR: 396
File: templates/default/src/web/App.tsx:111-111
Timestamp: 2026-01-06T03:11:55.300Z
Learning: In templates/default/src/web/App.tsx, keep using the Tailwind v4 class bg-linear-to-r for the background gradient. Do not suggest changing it to bg-gradient-to-r. This is a file-specific convention based on the project’s Tailwind version; for other files, verify the Tailwind version before proposing class changes.

Applied to files:

  • templates/default/src/web/App.tsx
🔇 Additional comments (5)
templates/auth/src/web/App.tsx (1)

10-19: LGTM — derived response type replaces hand-rolled interface.

ProtectedRouteResult = InferResponseType<typeof client.me.$get> keeps the UI shape in sync with the API schema, and the consumer (line 265) is already gated behind res.ok, so the union of error response types isn't an issue here.

templates/default/src/api/index.ts (1)

63-67: LGTM — typed result objects anchor schema-derived inference.

Materializing result: TranslateResult / result: HistoryData before c.json(result) is exactly what's needed to prevent the JSONValue[] widening reported in #1441. The schema-derived aliases now flow cleanly through InferResponseType on the client. Nice fix.

Also applies to: 139-176

templates/default/src/web/App.tsx (1)

16-18: LGTM — frontend types now derive from API responses.

The HistoryEntry = HistoryData['history'][number] derivation chains nicely off InferResponseType, and dropping the prior cast on setTranslateResult confirms the API side is now correctly typed. The handleClearHistory change to consume the DELETE response avoids an extra round-trip vs. the previous fetchHistory() call.

Also applies to: 34-60

scripts/test-templates.ts (2)

896-919: LGTM — Step 4.5 wiring is clean and skips correctly when no probe is defined.

The conditional execution, step recording, and early-return on failure mirror the surrounding steps. Running the probe typecheck after Step 4 means a probe-only failure surfaces with a distinct step name in the summary, which is useful for triage.


583-619: ⚡ Quick win

The auth template properly exposes both /health and /me routes with the expected response types. The test probe will typecheck correctly without changes.

parteeksingh24 and others added 2 commits May 6, 2026 13:00
- Share the Hono RPC probe prelude across templates
- Carry probe source with its relative output path
- Create probe directories before writing temp files
@parteeksingh24 parteeksingh24 requested a review from jhaynie May 6, 2026 20:13
@parteeksingh24 parteeksingh24 merged commit 0d02117 into main May 6, 2026
16 checks passed
@parteeksingh24 parteeksingh24 deleted the fix/template-hono-rpc-types branch May 6, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Still see a history error on default template

2 participants