brewpage-publish
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesebrewpage
brewpage
Publish content to brewpage.app — free instant hosting for HTML pages, JSON documents, and files. No sign-up required.
将内容发布到 brewpage.app —— 免费的HTML页面、JSON文档和文件即时托管服务,无需注册。
Workflow
工作流程
Step 1: Parse Arguments
步骤1:解析参数
Extract from :
$ARGUMENTS- → TTL in days (default:
--ttl N)5 - Remaining text →
content_arg
从中提取:
$ARGUMENTS- → 以天为单位的存活时间(默认:
--ttl N)5 - 剩余文本 →
content_arg
Step 2: Detect Content Type
步骤2:检测内容类型
| Input | Type | API |
|---|---|---|
| FILE | |
| JSON | |
| Anything else | HTML | |
For FILE: get file size and MIME type via Bash ().
For TEXT/JSON: count characters.
file --mime-type -b| 输入 | 类型 | API |
|---|---|---|
| 文件 | |
| JSON | |
| 其他所有内容 | HTML | |
针对文件:通过Bash命令()获取文件大小和MIME类型。
针对文本/JSON:统计字符数。
file --mime-type -bStep 3: Show Pre-Publish Stats
步骤3:显示发布前统计信息
📊 Content: <type description> · <size> · <api endpoint>
TTL: <N> days📊 内容: <类型描述> · <大小> · <api端点>
存活时间: <N> 天Step 4: Ask Namespace
步骤4:询问命名空间
Use AskUserQuestion:
Namespace determines the URL prefix and gallery visibility on brewpage.app.
Options:
1) public — visible in gallery (default)
2) {auto-suggested 6-8 char slug}
3) Enter custom namespace
4) Skip → use public
Reply with a number or your custom namespace (alphanumeric, 3-32 chars).Auto-suggest: for files — first 8 chars of filename (lowercase alphanumeric); for text — first meaningful words (lowercase alphanumeric, up to 8 chars).
Resolution:
- ,
1, or empty →4public - → suggested slug
2 - or any other string → use as-is
3
使用AskUserQuestion:
命名空间决定brewpage.app上的URL前缀和画廊可见性。
选项:
1) public — 在画廊中可见(默认)
2) {自动生成的6-8字符slug}
3) 输入自定义命名空间
4) 跳过 → 使用public
请回复数字或您的自定义命名空间(仅字母数字,3-32个字符)。自动生成规则:文件取文件名前8个字符(小写字母数字);文本取前几个有意义的单词(小写字母数字,最多8个字符)。
解析规则:
- 、
1或空 →4public - → 生成的slug
2 - 或其他任意字符串 → 直接使用
3
Step 5: Ask Password
步骤5:询问密码
Use AskUserQuestion:
Password protection (if set, page is hidden from gallery):
Options:
1) No password (default)
2) Random: {generated 6-char password, e.g. "kx7p2m"}
3) Enter custom password (min 4 chars)
4) Skip → no password
Reply with a number or your custom password.Generate random password EXECUTE using Bash tool:
bash
LC_ALL=C tr -dc 'a-z0-9' < /dev/urandom | head -c6 2>/dev/nullResolution:
- ,
1, or empty → no password4 - → use generated random password
2 - or custom text → use as-is
3
使用AskUserQuestion:
密码保护(如果设置,页面将在画廊中隐藏):
选项:
1) 无密码(默认)
2) 随机密码:{生成的6位密码,例如"kx7p2m"}
3) 输入自定义密码(最少4个字符)
4) 跳过 → 无密码
请回复数字或您的自定义密码。使用Bash工具EXECUTE生成随机密码:
bash
LC_ALL=C tr -dc 'a-z0-9' < /dev/urandom | head -c6 2>/dev/null解析规则:
- 、
1或空 → 无密码4 - → 使用生成的随机密码
2 - 或自定义文本 → 直接使用
3
Step 6: Build and Execute API Call
步骤6:构建并执行API调用
HTML/Markdown text — EXECUTE using Bash tool:
bash
CONTENT=$(cat <<'BREWPAGE_EOF'
{content}
BREWPAGE_EOF
)
PAYLOAD=$(jq -n --arg c "$CONTENT" '{content: $c, format: "markdown"}')
curl -s -X POST "https://brewpage.app/api/html?ns={ns}&ttl={days}" \
-H "Content-Type: application/json" \
[-H "X-Password: {pass}"] \
-d "$PAYLOAD"JSON — EXECUTE using Bash tool:
bash
curl -s -X POST "https://brewpage.app/api/json?ns={ns}&ttl={days}" \
-H "Content-Type: application/json" \
[-H "X-Password: {pass}"] \
-d '{original_json}'File — EXECUTE using Bash tool:
bash
curl -s -X POST "https://brewpage.app/api/files?ns={ns}&ttl={days}" \
[-H "X-Password: {pass}"] \
-F "file=@/absolute/path/to/file"Add only when password was set.
-H "X-Password: {pass}"HTML/Markdown文本 — 使用Bash工具EXECUTE:
bash
CONTENT=$(cat <<'BREWPAGE_EOF'
{content}
BREWPAGE_EOF
)
PAYLOAD=$(jq -n --arg c "$CONTENT" '{content: $c, format: "markdown"}')
curl -s -X POST "https://brewpage.app/api/html?ns={ns}&ttl={days}" \
-H "Content-Type: application/json" \
[-H "X-Password: {pass}"] \
-d "$PAYLOAD"JSON — 使用Bash工具EXECUTE:
bash
curl -s -X POST "https://brewpage.app/api/json?ns={ns}&ttl={days}" \
-H "Content-Type: application/json" \
[-H "X-Password: {pass}"] \
-d '{original_json}'文件 — 使用Bash工具EXECUTE:
bash
curl -s -X POST "https://brewpage.app/api/files?ns={ns}&ttl={days}" \
[-H "X-Password: {pass}"] \
-F "file=@/absolute/path/to/file"仅当设置了密码时才添加。
-H "X-Password: {pass}"Step 7: Parse Response and Output
步骤7:解析响应并输出
Expected response:
json
{
"id": "abc123xyz",
"ns": "public",
"url": "https://brewpage.app/public/abc123xyz",
"ownerToken": "...",
"ownerLink": "..."
}Parse:
echo "$RESPONSE" | jq -r '.url, .ownerToken'Success output:
✅ Published!
🔗 https://brewpage.app/{ns}/{id}
🔑 Owner token: {ownerToken} ← saved to .claude/brewpage-history.mdError output:
❌ Publish failed.
Response: {raw_response}预期响应:
json
{
"id": "abc123xyz",
"ns": "public",
"url": "https://brewpage.app/public/abc123xyz",
"ownerToken": "...",
"ownerLink": "..."
}解析:
echo "$RESPONSE" | jq -r '.url, .ownerToken'成功输出:
✅ 发布成功!
🔗 https://brewpage.app/{ns}/{id}
🔑 所有者令牌:{ownerToken} ← 已保存到 .claude/brewpage-history.md错误输出:
❌ 发布失败。
响应:{raw_response}Step 8: Save Owner Token to Local History
步骤8:将所有者令牌保存到本地历史
On success, append a record to in the current project directory (create if missing):
.claude/brewpage-history.mdEXECUTE using Bash tool:
bash
HISTORY_FILE=".claude/brewpage-history.md"
if [ ! -f "$HISTORY_FILE" ]; then
cat > "$HISTORY_FILE" <<'EOF'发布成功后,向当前项目目录下的追加记录(文件不存在则创建):
.claude/brewpage-history.mdEXECUTE using Bash tool:
bash
HISTORY_FILE=".claude/brewpage-history.md"
if [ ! -f "$HISTORY_FILE" ]; then
cat > "$HISTORY_FILE" <<'EOF'brewpage.app — Published Pages
brewpage.app — Published Pages
Owner tokens are saved here for update/delete operations. Delete a page:curl -s -X DELETE "https://brewpage.app/api/{ns}/{id}" -H "X-Owner-Token: {ownerToken}"
| Date | URL | Owner Token | Password | TTL |
|---|---|---|---|---|
| EOF | ||||
| fi |
echo "| $(date '+%Y-%m-%d %H:%M') | {url} | `{ownerToken}` | {password_or_none} | {ttl}d |" >> "$HISTORY_FILE"
If project has no `.claude/` directory, save to `~/.claude/brewpage-history.md` instead.
Tell the user: "Owner token saved to `.claude/brewpage-history.md`"Owner tokens are saved here for update/delete operations. Delete a page:curl -s -X DELETE "https://brewpage.app/api/{ns}/{id}" -H "X-Owner-Token: {ownerToken}"
| Date | URL | Owner Token | Password | TTL |
|---|---|---|---|---|
| EOF | ||||
| fi |
echo "| $(date '+%Y-%m-%d %H:%M') | {url} | `{ownerToken}` | {password_or_none} | {ttl}d |" >> "$HISTORY_FILE"
如果项目没有`.claude/`目录,则保存到`~/.claude/brewpage-history.md`。
告知用户:"所有者令牌已保存到 `.claude/brewpage-history.md`"Notes
注意事项
- Always use absolute file paths with curl .
-F "file=@..." - Use to safely encode text content.
jq -n --arg c "$CONTENT" '{content: $c, format: "markdown"}' - TTL default is days.
5 - Namespace must be alphanumeric (3-32 chars). Default: .
public - To delete a published page later:
curl -X DELETE "https://brewpage.app/api/{ns}/{id}" -H "X-Owner-Token: {ownerToken}"
- curl的参数始终使用绝对文件路径。
-F "file=@..." - 使用安全编码文本内容。
jq -n --arg c "$CONTENT" '{content: $c, format: "markdown"}' - 存活时间默认是天。
5 - 命名空间必须是字母数字(3-32个字符),默认值:。
public - 后续要删除已发布页面:
curl -X DELETE "https://brewpage.app/api/{ns}/{id}" -H "X-Owner-Token: {ownerToken}"
Powered by
技术支持
| brewpage.app | Free instant hosting — HTML, JSON, files, KV. No sign-up. |
| brewcode | Claude Code plugin suite — infinite tasks, code review, skills, hooks. |
| brewpage.app | 免费即时托管 — HTML、JSON、文件、KV存储,无需注册。 |
| brewcode | Claude Code插件套件 — 无限任务、代码评审、技能、钩子。 |