Skip to content

Commit b7e6dea

Browse files
cwclaude
andcommitted
feat: 实现瘦客户端 + 云端大脑架构
## Phase 1: 基础设施层 - 一键安装脚本 (scripts/install.sh) - 支持 macOS/Linux,自动检测系统架构 - 依赖检查、服务注册、QR码配对 - 自动错误上报 (daemon/lib/telemetry/) - error_collector: 错误收集与脱敏 - issue_reporter: GitHub Issue 自动创建 - telemetry_config: 用户隐私同意管理 ## Phase 2: 能力包热更新 - 能力包格式 (daemon/lib/capabilities/) - YAML 工作流定义,支持版本控制 - capability_loader: 本地缓存 + 云端拉取 - capability_registry: 9个内置能力 - capability_updater: 自动更新检查 - capability_executor: 工作流执行引擎 ## Phase 3: 安全远程控制 - 设备配对 (daemon/lib/security/) - QR码扫码配对 + 端到端加密 - HMAC 认证 + 时间戳验证 - 分级权限系统 - auto/notify/confirm/deny 四级权限 - 危险操作二次确认机制 ## Phase 4: AI 自动修复 - 问题分析 (daemon/lib/autofix/) - 已知模式匹配 + AI 根因分析 - 分类: known/user_error/environmental/performance - 自动修复流水线 - AI 生成修复 → 测试 → 灰度发布 (1%→10%→100%) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7270027 commit b7e6dea

24 files changed

+6328
-147
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Example Capability Package: Open Application
2+
# This demonstrates the capability package format for OpenCLI
3+
4+
id: desktop.open_app
5+
version: 1.0.0
6+
name: Open Application
7+
description: Opens an application by name on the desktop
8+
author: opencli
9+
min_executor_version: 0.1.0
10+
platforms: [macos, windows, linux]
11+
12+
# Input parameters
13+
parameters:
14+
- name: app_name
15+
type: string
16+
required: true
17+
description: Name of the application to open
18+
19+
# Execution workflow
20+
workflow:
21+
- action: open_app
22+
params:
23+
app_name: "${app_name}"
24+
25+
# Required base executors
26+
requires_executors:
27+
- open_app
28+
29+
# Tags for discovery
30+
tags:
31+
- desktop
32+
- app
33+
- launch
34+
- open
35+
36+
is_system: true
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Example: Multi-Step Workflow Capability
2+
# Demonstrates complex workflow with conditions and error handling
3+
4+
id: workflow.backup_and_notify
5+
version: 1.0.0
6+
name: Backup and Notify
7+
description: Creates a backup of files and sends a notification
8+
author: opencli
9+
min_executor_version: 0.2.0
10+
platforms: [macos, linux]
11+
12+
parameters:
13+
- name: source_dir
14+
type: directory
15+
required: true
16+
description: Directory to backup
17+
18+
- name: backup_name
19+
type: string
20+
required: false
21+
description: Name for the backup file
22+
default: backup
23+
24+
- name: notify
25+
type: bool
26+
required: false
27+
description: Whether to send notification on completion
28+
default: true
29+
30+
workflow:
31+
# Step 1: Check if source directory exists
32+
- action: file_operation
33+
params:
34+
operation: list
35+
directory: "${source_dir}"
36+
store_result: source_files
37+
on_error: fail
38+
39+
# Step 2: Create backup archive
40+
- action: run_command
41+
params:
42+
command: tar
43+
args:
44+
- -czf
45+
- "/tmp/${backup_name}_$(date +%Y%m%d).tar.gz"
46+
- "${source_dir}"
47+
timeout: 5m
48+
store_result: backup_result
49+
50+
# Step 3: Send notification if enabled
51+
- action: system_notify
52+
condition: "${notify} == true"
53+
params:
54+
title: Backup Complete
55+
message: "Backup created: ${backup_name}"
56+
57+
requires_executors:
58+
- file_operation
59+
- run_command
60+
- system_notify
61+
62+
tags:
63+
- backup
64+
- workflow
65+
- automation

daemon/lib/autofix/autofix.dart

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/// OpenCLI AutoFix Module
2+
///
3+
/// Provides AI-powered issue analysis and automatic fix generation
4+
/// with gradual rollout capabilities.
5+
///
6+
/// Usage:
7+
/// ```dart
8+
/// final analyzer = IssueAnalyzer();
9+
/// final pipeline = AutofixPipeline(
10+
/// analyzer: analyzer,
11+
/// errorCollector: errorCollector,
12+
/// config: AutofixConfig(
13+
/// enabled: true,
14+
/// githubRepo: 'user/opencli',
15+
/// githubToken: 'ghp_...',
16+
/// ),
17+
/// );
18+
///
19+
/// pipeline.start();
20+
///
21+
/// // Manually create a fix
22+
/// final analysis = await analyzer.analyze(errorReport);
23+
/// final fix = await pipeline.createFix(errorReport, analysis);
24+
/// ```
25+
26+
library autofix;
27+
28+
export 'issue_analyzer.dart';
29+
export 'autofix_pipeline.dart';

0 commit comments

Comments
 (0)