← 返回
沟通协作 中文

Code Share

Share code via GitHub Gist instead of inline chat blocks. Use when code output exceeds 10 lines, when the user asks for copy-friendly code sharing in Discord...
通过 GitHub Gist 分享代码,而非使用内联聊天块。适用于代码输出超过 10 行,或用户需要在 Discord 中方便复制分享代码的情况。
jeromestein
沟通协作 clawhub v0.2.0 1 版本 99917.1 Key: 无需
★ 2
Stars
📥 1,165
下载
💾 18
安装
1
版本
#discord#latest#productivity#sharing

概述

Gist Code Share

When returning code:

  1. If code is 10 lines or fewer, inline code block is allowed.
  2. If code is over 10 lines, prefer GitHub Gist.
  3. Default to secret gist unless user asks for public.
  4. Return a short summary + gist URL; avoid pasting long duplicate code in chat.
  5. Never publish secrets in shared code. If sensitive values are needed, use placeholders and tell user to fill them locally.

Required checks

  • Verify GitHub CLI auth: gh auth status
  • If not authenticated (or missing gist scope), ask user to run: gh auth login
  • Keep behavior simple: do not auto-fallback to alternate sharing backends by default; prefer guiding user to configure GitHub properly.

Sensitive data policy (mandatory)

Before sharing code, scan for sensitive data and remove it.

  • Never include API keys, tokens, passwords, private keys, cookies, session IDs, webhook secrets, phone/email PII, or absolute local secret paths.
  • If code requires secrets, replace with placeholders, for example:
  • API_KEY=""
  • TOKEN=""
  • .env entry with empty value
  • Add a short note telling the user to fill placeholders locally after copying.

Update mode (same URL)

When user asks to modify previously shared code, prefer updating the same gist link (new revision) instead of creating a new gist.

Use:

./scripts/update_gist.sh <gist_url_or_id> <file> "<short description>" [public|secret] [lang]

Behavior:

  • Keep the same gist URL.
  • Save changes as a new revision.
  • Return the same fixed 3-line response format.

Create a new gist only when:

  • user explicitly asks for a new link, or
  • existing gist is not editable by current GitHub account.

Create gist

Use:

gh gist create <file> --desc "<short description>"

If code is generated in-session, write it to a temp file in workspace first. Use language-appropriate extension (.py, .js, .ts, etc.) so Gist syntax highlighting works well.

With bundled script:

./scripts/create_gist.sh <file> "<short description>" [public|secret] [lang]

If has no extension, pass [lang] (for example python, typescript) so the script can upload with a proper extension.

Default behavior: do not use --web (automation-friendly).

Optional: use --web only when the user explicitly asks to open the gist in browser immediately.

Response format (fixed)

Always use exactly this 3-line format:

  1. One sentence on what was shared.
  2. Gist URL (separate line).
  3. File: · Lines:

Example:

Shared the full script as a secret Gist for clean copy/paste.

https://gist.github.com/...

File: lc761_solution.py · Lines: 42

版本历史

共 1 个版本

  • v0.2.0 当前
    2026-03-29 04:32 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Gmail

byungkyu
Gmail API 集成,托管 OAuth,支持读取、发送和管理邮件、线程、标签及草稿,适用于需要与 Gmail 交互的场景。
★ 72 📥 37,750
communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,629
communication-collaboration

imap-smtp-email

gzlicanyi
使用IMAP/SMTP读取和发送邮件;检查新/未读邮件、获取内容、搜索邮箱、标记已读/未读、发送带附件的邮件。支持...
★ 114 📥 52,470