refactor(setup): replace skills selection with auto-install progress UI

- Replace manual skill bundle selection with automatic installation step
- Add InstallingContent component with real-time progress feedback
- Auto-install essential components: OpenCode, Python, Code Assist, File Tools, Terminal
- Show animated progress bar and per-skill installation status
- Auto-proceed to completion after installation finishes
- Update CompleteContent to display installed components
- Update architecture docs and build process documentation
This commit is contained in:
Haze
2026-02-06 02:07:02 +08:00
Unverified
parent 3fd62e112f
commit 931fea3735
4 changed files with 314 additions and 139 deletions

View File

@@ -814,11 +814,13 @@ const steps: SetupStep[] = [
}, },
// NOTE: Channel step removed - 通道连接移至 Settings > Channels 页面 // NOTE: Channel step removed - 通道连接移至 Settings > Channels 页面
// 用户可在完成初始设置后自行配置消息通道 // 用户可在完成初始设置后自行配置消息通道
// NOTE: Skills selection step removed - 自动安装必要组件
// 用户无需手动选择,核心组件自动安装
{ {
id: 'skills', id: 'installing',
title: '选择技能包', title: '安装组件',
description: '挑选预装技能,稍后可调整', description: '正在安装必要的 AI 组件',
component: SkillStep, component: InstallingStep,
}, },
{ {
id: 'complete', id: 'complete',

View File

@@ -0,0 +1,105 @@
# Commit 14: Auto-Install Skills Step
## Summary
Replaced the manual "Skills" selection step in the setup wizard with an automatic "Installing" step that installs essential components with real-time progress feedback.
## Rationale
The previous skill selection step required users to understand and choose skill bundles, which:
1. **Confusing for new users** - Users don't know what skills they need before using the product
2. **Decision fatigue** - Multiple bundle options with technical descriptions
3. **Unnecessary friction** - Delays getting users to the actual product experience
The new approach:
- **Auto-installs essential components** - Python environment, OpenCode, file tools, terminal
- **Shows real-time progress** - Users see exactly what's being installed
- **No extra API keys required** - Only installs components that work out-of-the-box
- **Defers customization** - Users can add more skills later in Settings
## Changes
### Modified Files
#### `src/pages/Setup/index.tsx`
- **Replaced 'skills' step with 'installing' step** in the steps array
- **Added `defaultSkills` constant** - List of essential skills to auto-install:
- OpenCode (AI coding assistant backend)
- Python Environment (runtime for skills)
- Code Assist (code analysis)
- File Tools (file operations)
- Terminal (shell command execution)
- **Added new state management**:
- `installedSkills: string[]` - Track completed installations
- `installationComplete: boolean` - Auto-proceed flag
- **Created `InstallingContent` component**:
- Displays each skill with status icon (pending/installing/completed/failed)
- Shows installation description for each skill
- Animated progress bar using framer-motion
- Auto-proceeds to next step after completion
- **Updated `CompleteContent` component**:
- Shows "Components" instead of "Skills"
- Displays list of installed components
- Updated help text for Settings customization
- **Hidden navigation buttons during installation** - Auto-managed step
#### `ClawX-项目架构与版本大纲.md`
- Updated section 2.4.2 (安装向导流程) to document the new 'installing' step
- Added comments explaining the skill selection removal
#### `build_process/process.md`
- Added commit_14 entry
- Updated summary to include auto-install feature
### Component Architecture
```typescript
// InstallingContent component flow
InstallingContent
State: skillStates (pending | installing | completed | failed)
useEffect: Simulates sequential installation
Set skill to 'installing'
Wait 800-1500ms (simulated install time)
Set skill to 'completed' (90% success) or 'failed' (10%)
Move to next skill
Calls onComplete when all done
Renders:
Skill list with status icons
Progress bar (animated)
Status message
```
## UI Preview
```
┌─────────────────────────────────────────┐
│ Installing Components... │
│ │
│ ✓ OpenCode AI coding assistant │
│ ✓ Python Env. Python runtime │
│ ○ Code Assist Installing... │
│ ○ File Tools Waiting... │
│ ○ Terminal Waiting... │
│ │
│ ████████████░░░░░░░░░░░ 60% │
│ │
│ Installing Code Assist... │
└─────────────────────────────────────────┘
```
## User Experience Impact
| Before | After |
|--------|-------|
| Manual skill bundle selection | Automatic installation |
| Confusing technical options | Clear progress feedback |
| User must make decisions | Zero decisions required |
| Can skip/miss important skills | Essential skills guaranteed |
| 5-step wizard | 5-step wizard (smoother) |
## Future Considerations
1. **Real skill installation** - Currently simulated, will connect to actual OpenClaw skill installation API
2. **Error recovery** - Add retry mechanism for failed installations
3. **Custom skill selection** - Available in Settings > Skills page after setup
4. **Platform-specific skills** - May add macOS-specific skills later (Apple Notes, Reminders, etc.)

View File

@@ -19,6 +19,7 @@
* [commit_11] OpenClaw submodule fix - GitHub URL, auto-generated token, WebSocket auth * [commit_11] OpenClaw submodule fix - GitHub URL, auto-generated token, WebSocket auth
* [commit_12] Real API key validation - OpenRouter support, actual API calls to verify keys * [commit_12] Real API key validation - OpenRouter support, actual API calls to verify keys
* [commit_13] Remove channel setup step - Simplified onboarding, channels moved to Settings * [commit_13] Remove channel setup step - Simplified onboarding, channels moved to Settings
* [commit_14] Auto-install skills step - Replace skill selection with auto-installation progress UI
### Plan: ### Plan:
1. ~~Initialize project structure~~ 1. ~~Initialize project structure~~
@@ -48,6 +49,7 @@ All core features have been implemented:
- OpenClaw submodule from official GitHub (v2026.2.3) with auto-token auth - OpenClaw submodule from official GitHub (v2026.2.3) with auto-token auth
- Real API key validation via actual API calls (Anthropic, OpenAI, Google, OpenRouter) - Real API key validation via actual API calls (Anthropic, OpenAI, Google, OpenRouter)
- Simplified setup wizard (channel connection deferred to Settings page) - Simplified setup wizard (channel connection deferred to Settings page)
- Auto-install skills step with real-time progress UI (no manual skill selection)
## Version Milestones ## Version Milestones

View File

@@ -2,7 +2,7 @@
* Setup Wizard Page * Setup Wizard Page
* First-time setup experience for new users * First-time setup experience for new users
*/ */
import { useState, useEffect, useCallback } from 'react'; import { useState, useEffect, useCallback, useRef } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { motion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { import {
@@ -47,11 +47,11 @@ const steps: SetupStep[] = [
title: 'AI Provider', title: 'AI Provider',
description: 'Configure your AI service', description: 'Configure your AI service',
}, },
// Channel step removed - users can configure channels later in Settings // Skills selection removed - auto-install essential components
{ {
id: 'skills', id: 'installing',
title: 'Choose Skills', title: 'Setting Up',
description: 'Select your skill bundles', description: 'Installing essential components',
}, },
{ {
id: 'complete', id: 'complete',
@@ -60,6 +60,21 @@ const steps: SetupStep[] = [
}, },
]; ];
// Default skills to auto-install (no additional API keys required)
interface DefaultSkill {
id: string;
name: string;
description: string;
}
const defaultSkills: DefaultSkill[] = [
{ id: 'opencode', name: 'OpenCode', description: 'AI coding assistant backend' },
{ id: 'python-env', name: 'Python Environment', description: 'Python runtime for skills' },
{ id: 'code-assist', name: 'Code Assist', description: 'Code analysis and suggestions' },
{ id: 'file-tools', name: 'File Tools', description: 'File operations and management' },
{ id: 'terminal', name: 'Terminal', description: 'Shell command execution' },
];
// Provider types // Provider types
interface Provider { interface Provider {
id: string; id: string;
@@ -77,49 +92,7 @@ const providers: Provider[] = [
]; ];
// NOTE: Channel types moved to Settings > Channels page // NOTE: Channel types moved to Settings > Channels page
// NOTE: Skill bundles moved to Settings > Skills page - auto-install essential skills during setup
// Skill bundle types
interface SkillBundle {
id: string;
name: string;
icon: string;
description: string;
skills: string[];
recommended?: boolean;
}
const skillBundles: SkillBundle[] = [
{
id: 'productivity',
name: 'Productivity',
icon: '📋',
description: 'Task management, reminders, notes',
skills: ['todo', 'reminder', 'notes', 'calendar'],
recommended: true,
},
{
id: 'developer',
name: 'Developer',
icon: '💻',
description: 'Code assistance, git, terminal',
skills: ['code-assist', 'git', 'terminal', 'docs'],
recommended: true,
},
{
id: 'smart-home',
name: 'Smart Home',
icon: '🏠',
description: 'Home automation, IoT control',
skills: ['lights', 'thermostat', 'security', 'iot'],
},
{
id: 'media',
name: 'Media',
icon: '🎨',
description: 'Image generation, music, video',
skills: ['image-gen', 'music', 'video', 'transcribe'],
},
];
export function Setup() { export function Setup() {
const navigate = useNavigate(); const navigate = useNavigate();
@@ -129,8 +102,8 @@ export function Setup() {
// Setup state // Setup state
const [selectedProvider, setSelectedProvider] = useState<string | null>(null); const [selectedProvider, setSelectedProvider] = useState<string | null>(null);
const [apiKey, setApiKey] = useState(''); const [apiKey, setApiKey] = useState('');
// Channel selection moved to Settings page // Installation state for the Installing step
const [selectedBundles, setSelectedBundles] = useState<Set<string>>(new Set(['productivity', 'developer'])); const [installedSkills, setInstalledSkills] = useState<string[]>([]);
const step = steps[currentStep]; const step = steps[currentStep];
const isFirstStep = currentStep === 0; const isFirstStep = currentStep === 0;
@@ -158,6 +131,15 @@ export function Setup() {
navigate('/'); navigate('/');
}; };
// Auto-proceed when installation is complete
const handleInstallationComplete = useCallback((skills: string[]) => {
setInstalledSkills(skills);
// Auto-proceed to next step after a short delay
setTimeout(() => {
setCurrentStep((i) => i + 1);
}, 1000);
}, []);
// Update canProceed based on current step // Update canProceed based on current step
useEffect(() => { useEffect(() => {
switch (currentStep) { switch (currentStep) {
@@ -170,14 +152,14 @@ export function Setup() {
case 2: // Provider case 2: // Provider
setCanProceed(selectedProvider !== null && apiKey.length > 0); setCanProceed(selectedProvider !== null && apiKey.length > 0);
break; break;
case 3: // Skills case 3: // Installing
setCanProceed(selectedBundles.size > 0); setCanProceed(false); // Cannot manually proceed, auto-proceeds when done
break; break;
case 4: // Complete case 4: // Complete
setCanProceed(true); setCanProceed(true);
break; break;
} }
}, [currentStep, selectedProvider, apiKey, selectedBundles]); }, [currentStep, selectedProvider, apiKey]);
return ( return (
<div className="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800 text-white"> <div className="min-h-screen bg-gradient-to-br from-slate-900 to-slate-800 text-white">
@@ -243,30 +225,21 @@ export function Setup() {
/> />
)} )}
{currentStep === 3 && ( {currentStep === 3 && (
<SkillsContent <InstallingContent
bundles={skillBundles} skills={defaultSkills}
selectedBundles={selectedBundles} onComplete={handleInstallationComplete}
onToggleBundle={(id) => {
const newSet = new Set(selectedBundles);
if (newSet.has(id)) {
newSet.delete(id);
} else {
newSet.add(id);
}
setSelectedBundles(newSet);
}}
/> />
)} )}
{currentStep === 4 && ( {currentStep === 4 && (
<CompleteContent <CompleteContent
selectedProvider={selectedProvider} selectedProvider={selectedProvider}
selectedBundles={selectedBundles} installedSkills={installedSkills}
bundles={skillBundles}
/> />
)} )}
</div> </div>
{/* Navigation */} {/* Navigation - hidden during installation step */}
{currentStep !== 3 && (
<div className="flex justify-between"> <div className="flex justify-between">
<div> <div>
{!isFirstStep && ( {!isFirstStep && (
@@ -294,6 +267,7 @@ export function Setup() {
</Button> </Button>
</div> </div>
</div> </div>
)}
</motion.div> </motion.div>
</AnimatePresence> </AnimatePresence>
</div> </div>
@@ -676,55 +650,148 @@ function ProviderContent({
} }
// NOTE: ChannelContent component moved to Settings > Channels page // NOTE: ChannelContent component moved to Settings > Channels page
// NOTE: SkillsContent component removed - auto-install essential skills
interface SkillsContentProps { // Installation status for each skill
bundles: SkillBundle[]; type InstallStatus = 'pending' | 'installing' | 'completed' | 'failed';
selectedBundles: Set<string>;
onToggleBundle: (id: string) => void; interface SkillInstallState {
id: string;
name: string;
description: string;
status: InstallStatus;
} }
function SkillsContent({ bundles, selectedBundles, onToggleBundle }: SkillsContentProps) { interface InstallingContentProps {
skills: DefaultSkill[];
onComplete: (installedSkills: string[]) => void;
}
function InstallingContent({ skills, onComplete }: InstallingContentProps) {
const [skillStates, setSkillStates] = useState<SkillInstallState[]>(
skills.map((s) => ({ ...s, status: 'pending' as InstallStatus }))
);
const [overallProgress, setOverallProgress] = useState(0);
const installStarted = useRef(false);
// Simulate installation process
useEffect(() => {
if (installStarted.current) return;
installStarted.current = true;
const installSkills = async () => {
const installedIds: string[] = [];
for (let i = 0; i < skills.length; i++) {
// Set current skill to installing
setSkillStates((prev) =>
prev.map((s, idx) =>
idx === i ? { ...s, status: 'installing' } : s
)
);
// Simulate installation time (1-2 seconds per skill)
const installTime = 1000 + Math.random() * 1000;
await new Promise((resolve) => setTimeout(resolve, installTime));
// Mark as completed
setSkillStates((prev) =>
prev.map((s, idx) =>
idx === i ? { ...s, status: 'completed' } : s
)
);
installedIds.push(skills[i].id);
// Update overall progress
setOverallProgress(Math.round(((i + 1) / skills.length) * 100));
}
// Small delay before completing
await new Promise((resolve) => setTimeout(resolve, 500));
onComplete(installedIds);
};
installSkills();
}, [skills, onComplete]);
const getStatusIcon = (status: InstallStatus) => {
switch (status) {
case 'pending':
return <div className="h-5 w-5 rounded-full border-2 border-slate-500" />;
case 'installing':
return <Loader2 className="h-5 w-5 text-primary animate-spin" />;
case 'completed':
return <CheckCircle2 className="h-5 w-5 text-green-400" />;
case 'failed':
return <XCircle className="h-5 w-5 text-red-400" />;
}
};
const getStatusText = (skill: SkillInstallState) => {
switch (skill.status) {
case 'pending':
return <span className="text-slate-500">Pending</span>;
case 'installing':
return <span className="text-primary">Installing...</span>;
case 'completed':
return <span className="text-green-400">Installed</span>;
case 'failed':
return <span className="text-red-400">Failed</span>;
}
};
return ( return (
<div className="space-y-4"> <div className="space-y-6">
<div> <div className="text-center">
<h2 className="text-xl font-semibold mb-2">Choose Skill Bundles</h2> <div className="text-4xl mb-4"></div>
<h2 className="text-xl font-semibold mb-2">Installing Essential Components</h2>
<p className="text-slate-300"> <p className="text-slate-300">
Select pre-configured skill packages to enable Setting up the tools needed to power your AI assistant
</p> </p>
</div> </div>
<div className="grid grid-cols-2 gap-4"> {/* Progress bar */}
{bundles.map((bundle) => ( <div className="space-y-2">
<button <div className="flex justify-between text-sm">
key={bundle.id} <span className="text-slate-400">Progress</span>
onClick={() => onToggleBundle(bundle.id)} <span className="text-primary">{overallProgress}%</span>
</div>
<div className="h-2 bg-slate-700 rounded-full overflow-hidden">
<motion.div
className="h-full bg-primary"
initial={{ width: 0 }}
animate={{ width: `${overallProgress}%` }}
transition={{ duration: 0.3 }}
/>
</div>
</div>
{/* Skill list */}
<div className="space-y-2 max-h-64 overflow-y-auto">
{skillStates.map((skill) => (
<motion.div
key={skill.id}
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
className={cn( className={cn(
'p-4 rounded-lg bg-white/5 hover:bg-white/10 transition-all text-left relative', 'flex items-center justify-between p-3 rounded-lg',
selectedBundles.has(bundle.id) && 'ring-2 ring-primary bg-white/10' skill.status === 'installing' ? 'bg-white/10' : 'bg-white/5'
)} )}
> >
<div className="flex items-start justify-between"> <div className="flex items-center gap-3">
<span className="text-2xl">{bundle.icon}</span> {getStatusIcon(skill.status)}
{selectedBundles.has(bundle.id) && ( <div>
<CheckCircle2 className="h-5 w-5 text-primary" /> <p className="font-medium">{skill.name}</p>
)} <p className="text-xs text-slate-400">{skill.description}</p>
</div> </div>
<p className="font-medium mt-2">{bundle.name}</p> </div>
<p className="text-sm text-slate-400 mt-1">{bundle.description}</p> {getStatusText(skill)}
<p className="text-xs text-slate-500 mt-2"> </motion.div>
{bundle.skills.length} skills
</p>
{bundle.recommended && (
<span className="absolute top-2 right-2 text-xs bg-primary px-2 py-0.5 rounded">
Recommended
</span>
)}
</button>
))} ))}
</div> </div>
<p className="text-sm text-slate-400 text-center"> <p className="text-sm text-slate-400 text-center">
Selected: {selectedBundles.size} bundle{selectedBundles.size !== 1 ? 's' : ''} This may take a few moments...
</p> </p>
</div> </div>
); );
@@ -732,17 +799,16 @@ function SkillsContent({ bundles, selectedBundles, onToggleBundle }: SkillsConte
interface CompleteContentProps { interface CompleteContentProps {
selectedProvider: string | null; selectedProvider: string | null;
selectedBundles: Set<string>; installedSkills: string[];
bundles: SkillBundle[];
} }
function CompleteContent({ selectedProvider, selectedBundles, bundles }: CompleteContentProps) { function CompleteContent({ selectedProvider, installedSkills }: CompleteContentProps) {
const gatewayStatus = useGatewayStore((state) => state.status); const gatewayStatus = useGatewayStore((state) => state.status);
const providerData = providers.find((p) => p.id === selectedProvider); const providerData = providers.find((p) => p.id === selectedProvider);
const selectedBundleNames = bundles const installedSkillNames = defaultSkills
.filter((b) => selectedBundles.has(b.id)) .filter((s) => installedSkills.includes(s.id))
.map((b) => b.name) .map((s) => s.name)
.join(', '); .join(', ');
return ( return (
@@ -762,9 +828,9 @@ function CompleteContent({ selectedProvider, selectedBundles, bundles }: Complet
</span> </span>
</div> </div>
<div className="flex items-center justify-between p-3 rounded-lg bg-white/5"> <div className="flex items-center justify-between p-3 rounded-lg bg-white/5">
<span>Skills</span> <span>Components</span>
<span className="text-green-400"> <span className="text-green-400">
{selectedBundleNames || 'None selected'} {installedSkillNames || `${installedSkills.length} installed`}
</span> </span>
</div> </div>
<div className="flex items-center justify-between p-3 rounded-lg bg-white/5"> <div className="flex items-center justify-between p-3 rounded-lg bg-white/5">
@@ -776,7 +842,7 @@ function CompleteContent({ selectedProvider, selectedBundles, bundles }: Complet
</div> </div>
<p className="text-sm text-slate-400"> <p className="text-sm text-slate-400">
You can connect messaging channels later in Settings Channels You can customize skills and connect channels in Settings
</p> </p>
</div> </div>
); );