Skip to content

fix(typecheck): add wizard agent creation types - #1566

Merged
kevincodex1 merged 2 commits into
Twigpine:mainfrom
chioarub:codex/typecheck-wizard-agent-types
Jun 10, 2026
Merged

kevincodex1 merged 2 commits into
Twigpine:mainfrom
chioarub:codex/typecheck-wizard-agent-types

Conversation

@chioarub

@chioarub chioarub commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1486

Summary

  • add the shared wizard provider/context type definitions used by the wizard package
  • add the new-agent creation wizard data contract
  • annotate wizard provider and agent wizard steps so useWizard carries the correct data shape
  • type local validation-message state in text-entry steps

Validation

  • bun run typecheck still fails on unrelated baseline errors from fix: (All-call) TypeScript cleanup PRs needed #1486
  • wizard/new-agent creation diagnostics reduced from 21 to 0 on this branch
  • total src/* diagnostics reduced from 1043 to 1022 versus the captured baseline

Duplicate check

  • Checked all open PRs for overlap on the wizard and new-agent creation files before opening this PR; none were touching these files.

Summary by CodeRabbit

  • Refactor

    • Improved TypeScript typing and generics across the agent creation wizard and its steps; added explicit structured types for wizard data, props, and context.
  • Bug Fixes / UX

    • Confirmation now shows a clear "agent draft is incomplete" fallback when required information is missing.
  • Tests

    • Added unit tests covering color, memory, and confirmation step behaviors.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1342a259-4fac-4f8e-8131-7e84b12d1f85

📥 Commits

Reviewing files that changed from the base of the PR and between 3257b82 and fe33e71.

📒 Files selected for processing (4)
  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: smoke-and-tests
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{ts,tsx,js,jsx,py}: Follow the existing code style in the touched files
Keep comments useful and concise

Files:

  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
**

⚙️ CodeRabbit configuration file

**: # Contributing to OpenClaude

Thanks for contributing.

OpenClaude is a fast-moving open-source coding-agent CLI with support for multiple providers, local backends, MCP, and a terminal-first workflow. The best contributions here are focused, well-tested, and easy to review.

Before You Start

  • Search existing issues and discussions before opening a new thread.
  • Check open pull requests for work that overlaps with your contribution. If a PR already exists that addresses the same change, open an issue or discussion first to align on direction — duplicate PRs may be closed without review.
  • Use issues for confirmed bugs and actionable feature work.
  • Use discussions for setup help, ideas, and general community conversation.
  • For larger changes, open an issue first so the scope is clear before implementation.
  • For security reports, follow SECURITY.md.

Pull Requests

Every PR needs a reason. Your PR description must include:

  • what changed and why
  • the user or developer impact
  • the exact checks you ran
  • a linked issue when one exists, using Fixes fix: skip assertMinVersion for third-party providers #123, `Closes `#123, or another clear link
  • screenshots when the PR touches UI, terminal presentation, or the VS Code extension
  • which provider path was tested when the PR changes provider behavior

The PR author is responsible for ensuring their PR is merge-ready. PRs with merge conflicts will not be reviewed or approved until the conflicts are resolved.

Issues are the recommended starting point for anything non-trivial — opening one first helps avoid wasted effort if the change is out of scope or already being worked on. Small fixes, doc corrections, and obvious improvements can stand on their own without a linked issue, as long as the PR description explains the intent.

What Gets Closed Without Review

PRs may be closed without review...

Files:

  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add or update tests when the change affects behavior

Files:

  • src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
🔇 Additional comments (4)
src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx (1)

34-52: LGTM!

src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx (1)

72-74: LGTM!

src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx (1)

75-82: LGTM!

src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx (1)

163-244: LGTM!


📝 Walkthrough

Walkthrough

The wizard system is made generic and strongly typed. New wizard types and agent-specific wizard state are added. WizardProvider becomes generic; CreateAgentWizard and all agent wizard steps adopt typed hooks, explicit return types, and guards. Tests exercise step behavior under the typed provider.

Changes

Wizard System Type Safety

Layer / File(s) Summary
Wizard type system foundation
src/components/wizard/types.ts
Exports generic wizard types: WizardStepComponent, WizardProviderProps<T>, and WizardContextValue<T> describing the typed wizard contract.
Agent wizard state shape
src/components/agents/new-agent-creation/types.ts
Adds GeneratedAgentDraft and AgentWizardData types modeling the agent-creation wizard state and generated draft fields.
Generic WizardProvider implementation
src/components/wizard/WizardProvider.tsx
Converts WizardProvider to a generic WizardProvider<T> and adds explicit types for handlers: goToStep(index: number) and updateWizardData(updates: Partial<T>).
CreateAgentWizard integration
src/components/agents/new-agent-creation/CreateAgentWizard.tsx
Types CreateAgentWizard signature and instantiates WizardProvider<AgentWizardData> with initialData cast to {} as AgentWizardData.
Wizard steps type adoption and refinement
src/components/agents/new-agent-creation/wizard-steps/*
All agent wizard steps call useWizard<AgentWizardData>(), add explicit React.ReactNode return types where changed, type error as `string
Wizard steps tests
src/components/agents/new-agent-creation/wizard-steps/wizardSteps.test.tsx
Adds a test harness and tests for ColorStep, MemoryStep, and ConfirmStep using WizardProvider, state probes, and mocked child components.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • jatmn
  • kevincodex1
🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding TypeScript type definitions for the wizard provider and agent creation flow to improve type safety.
Description check ✅ Passed The description covers what changed and why, includes validation details showing reduced diagnostics, and notes a duplicate check. However, it is missing explicit testing confirmations and does not follow the provided template structure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed PR does not touch auth, provider routing, permissions, network, background execution, startup/config, MCP/skills, CI, or release scripts—only TypeScript type safety for UI wizard components.
No Hidden Policy Change ✅ Passed PR contains only TypeScript type annotations, generic typing, and safe data-validation guards. No hidden product, trust-model, routing, telemetry, or permission-policy changes detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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

Inline comments:
In `@src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx`:
- Around line 37-47: Add a guard at the start of the handleConfirm function in
ColorStep to validate required wizardData fields (wizardData.agentType,
wizardData.whenToUse, wizardData.systemPrompt, wizardData.location) and handle
the error or navigate back (early return) if any are missing; then remove the
non-null assertions when building the finalAgent/CustomAgentDefinition so
getSystemPrompt can safely return a valid string and the object conforms to the
CustomAgentDefinition contract.

In `@src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx`:
- Around line 72-74: The silent return in ConfirmStep when `agent` or
`wizardData.location` is missing can leave the wizard blank; update ConfirmStep
to handle this case explicitly by either navigating the wizard back to a safe
step or rendering a clear fallback error UI. Modify the block that currently
does `if (!agent || !wizardData.location) { return null; }` to call your wizard
navigation callback (e.g., a provided `onBack`/`goToStep` function) or render a
small error message/button that lets the user resume the flow, ensuring the
fallback integrates with the existing ConfirmStepWrapper guard.

In `@src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx`:
- Line 80: The getSystemPrompt arrow uses a non-null assertion on
wizardData.systemPrompt!, which defers validation; change getSystemPrompt in
MemoryStep.tsx to defensively handle a possibly undefined systemPrompt (e.g.,
use optional chaining or a safe default like "" instead of "!") so both branches
read something like (wizardData.systemPrompt ?? "") and then append
loadAgentMemoryPrompt(agentType, memory) only when needed; reference the
getSystemPrompt binding, wizardData.systemPrompt, loadAgentMemoryPrompt, and
PromptStep to ensure PromptStep still validates the field while preventing
runtime crashes during save.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 725298c2-0d46-4ea0-b705-bc0df9568f79

📥 Commits

Reviewing files that changed from the base of the PR and between 9e942da and 3257b82.

📒 Files selected for processing (14)
  • src/components/agents/new-agent-creation/CreateAgentWizard.tsx
  • src/components/agents/new-agent-creation/types.ts
  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx
  • src/components/wizard/WizardProvider.tsx
  • src/components/wizard/types.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: smoke-and-tests
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx,py}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{ts,tsx,js,jsx,py}: Follow the existing code style in the touched files
Keep comments useful and concise

Files:

  • src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx
  • src/components/wizard/types.ts
  • src/components/agents/new-agent-creation/CreateAgentWizard.tsx
  • src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx
  • src/components/agents/new-agent-creation/types.ts
  • src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/wizard/WizardProvider.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
**/*

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx
  • src/components/wizard/types.ts
  • src/components/agents/new-agent-creation/CreateAgentWizard.tsx
  • src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx
  • src/components/agents/new-agent-creation/types.ts
  • src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/wizard/WizardProvider.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
**

⚙️ CodeRabbit configuration file

**: # Contributing to OpenClaude

Thanks for contributing.

OpenClaude is a fast-moving open-source coding-agent CLI with support for multiple providers, local backends, MCP, and a terminal-first workflow. The best contributions here are focused, well-tested, and easy to review.

Before You Start

  • Search existing issues and discussions before opening a new thread.
  • Check open pull requests for work that overlaps with your contribution. If a PR already exists that addresses the same change, open an issue or discussion first to align on direction — duplicate PRs may be closed without review.
  • Use issues for confirmed bugs and actionable feature work.
  • Use discussions for setup help, ideas, and general community conversation.
  • For larger changes, open an issue first so the scope is clear before implementation.
  • For security reports, follow SECURITY.md.

Pull Requests

Every PR needs a reason. Your PR description must include:

  • what changed and why
  • the user or developer impact
  • the exact checks you ran
  • a linked issue when one exists, using Fixes #123, `Closes `#123, or another clear link
  • screenshots when the PR touches UI, terminal presentation, or the VS Code extension
  • which provider path was tested when the PR changes provider behavior

The PR author is responsible for ensuring their PR is merge-ready. PRs with merge conflicts will not be reviewed or approved until the conflicts are resolved.

Issues are the recommended starting point for anything non-trivial — opening one first helps avoid wasted effort if the change is out of scope or already being worked on. Small fixes, doc corrections, and obvious improvements can stand on their own without a linked issue, as long as the PR description explains the intent.

What Gets Closed Without Review

PRs may be closed without review...

Files:

  • src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx
  • src/components/wizard/types.ts
  • src/components/agents/new-agent-creation/CreateAgentWizard.tsx
  • src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx
  • src/components/agents/new-agent-creation/types.ts
  • src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx
  • src/components/wizard/WizardProvider.tsx
  • src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx
🔇 Additional comments (24)
src/components/wizard/types.ts (1)

1-32: LGTM!

src/components/wizard/WizardProvider.tsx (4)

9-9: LGTM!


40-40: LGTM!


111-111: LGTM!


140-140: LGTM!

src/components/agents/new-agent-creation/CreateAgentWizard.tsx (3)

26-26: LGTM!


80-80: LGTM!


87-87: LGTM!

src/components/agents/new-agent-creation/wizard-steps/MethodStep.tsx (1)

19-19: LGTM!

src/components/agents/new-agent-creation/wizard-steps/ModelStep.tsx (1)

17-17: LGTM!

src/components/agents/new-agent-creation/wizard-steps/ToolsStep.tsx (2)

14-14: LGTM!


24-24: LGTM!

src/components/agents/new-agent-creation/wizard-steps/TypeStep.tsx (3)

17-17: LGTM!


24-24: LGTM!


26-26: LGTM!

src/components/agents/new-agent-creation/types.ts (1)

12-27: LGTM!

src/components/agents/new-agent-creation/wizard-steps/ConfirmStep.tsx (2)

28-28: LGTM!


40-40: LGTM!

src/components/agents/new-agent-creation/wizard-steps/DescriptionStep.tsx (2)

21-21: LGTM!


24-24: LGTM!

src/components/agents/new-agent-creation/wizard-steps/LocationStep.tsx (1)

20-20: LGTM!

src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx (1)

25-25: LGTM!

src/components/agents/new-agent-creation/wizard-steps/PromptStep.tsx (2)

20-20: LGTM!


23-23: LGTM!

Comment thread src/components/agents/new-agent-creation/wizard-steps/ColorStep.tsx Outdated
Comment thread src/components/agents/new-agent-creation/wizard-steps/MemoryStep.tsx Outdated

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution. I do not see any actionable issues from my review.

@kevincodex1 LGTM

@kevincodex1
kevincodex1 merged commit 65034db into Twigpine:main Jun 10, 2026
3 checks passed
@chioarub
chioarub deleted the codex/typecheck-wizard-agent-types branch June 10, 2026 05:56
deagwon97 pushed a commit to deagwon97/openclaude that referenced this pull request Jun 11, 2026
* fix(typecheck): add wizard agent creation types

* fix(typecheck): guard agent wizard state
hotmanxp pushed a commit to hotmanxp/openclaude that referenced this pull request Jun 12, 2026
* fix(typecheck): add wizard agent creation types

* fix(typecheck): guard agent wizard state
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.

3 participants