Skip to content

5.16 会话分享

💡 一句话总结:分享会话给团队成员,实现协作和知识共享。


学完你能做什么

  • 能分享会话
  • 能导入会话
  • 能管理分享设置
  • 能控制访问权限

🎒 开始前的准备

确保你已经完成以下事项:

  • [ ] 完成必修课程
  • [ ] 有想要分享的会话

核心思路

分享方式

方式说明适用场景
链接分享生成可访问链接快速分享
导出文件导出为文件离线分享
团队同步自动同步到团队协作开发

配置

基础配置

yaml
sharing:
  enabled: true
  
  default_visibility: "private"  # private, team, public
  
  link_expiry: "7d"  # 7天
  
  allow_download: false

团队分享

yaml
sharing:
  team:
    enabled: true
    
    auto_sync: true
    
    sync_interval: 300  # 5分钟
    
    exclude_patterns:
      - "**/secrets/**"
      - "**/.env"

使用方法

创建分享

bash
# 生成分享链接
/share create --session-id abc123

# 设置过期时间
/share create --session-id abc123 --expiry 7d

# 设置访问密码
/share create --session-id abc123 --password mypassword

导入分享

bash
# 通过链接导入
/share import https://opencode.ai/share/abc123

# 通过文件导入
/share import ./session-backup.json

管理分享

bash
# 列出我的分享
/share list

# 查看分享详情
/share info --share-id abc123

# 取消分享
/share revoke --share-id abc123

# 更新权限
/share update --share-id abc123 --visibility team

高级功能

只读会话

yaml
sharing:
  read_only:
    enabled: true
    
    allow_questions: true
    
    hide_sensitive: true
    
    remove_credentials: true

协作会话

yaml
sharing:
  collaboration:
    enabled: true
    
    allow_editing: false
    
    show_cursors: true
    
    realtime_sync: true

跟我做

实战:分享代码审查会话

  1. 创建分享:
bash
# 生成分享链接,有效期 7 天
/share create --session-id code-review-session --expiry 7d
  1. 配置只读:
yaml
sharing:
  read_only:
    enabled: true
    hide_sensitive: true
  1. 发送链接给团队成员

检查点 ✅

全部通过才能继续

  • [ ] 能创建分享
  • [ ] 能导入分享
  • [ ] 能管理分享
  • [ ] 能配置权限

本课小结

你学会了:

  1. 分享方式
  2. 配置方法
  3. 使用命令
  4. 高级功能
  5. 协作场景

进阶手册总结

恭喜你完成了 5-advanced 进阶手册 的所有课程!

你现在已经掌握:

  • ✅ 配置全解
  • ✅ Agent 系统
  • ✅ Skill
  • ✅ 快捷命令
  • ✅ 权限管控
  • ✅ 主题与快捷键
  • ✅ MCP 扩展
  • ✅ IDE 集成
  • ✅ 远程模式
  • ✅ SDK 开发
  • ✅ 插件开发
  • ✅ 自定义工具
  • ✅ GitHub/GitLab 集成
  • ✅ 会话分享

继续学习:


📚 更多完整模板Prompt 模板库