Skip to content

feat: add slack-cli subtree and subtree sync script#187

Merged
snomiao merged 12 commits intomainfrom
sno-bot
Apr 5, 2026
Merged

feat: add slack-cli subtree and subtree sync script#187
snomiao merged 12 commits intomainfrom
sno-bot

Conversation

@snomiao
Copy link
Copy Markdown
Member

@snomiao snomiao commented Apr 2, 2026

Changes

1. Git subtree: slack-cli

  • Added snomiao/slack-cli as git subtree at lib/slack-cli/
  • Fixed reqwest Client pooling (shared via LazyLock)
  • Fixed invalid Slack Block Kit type (markdownsection/mrkdwn)

2. Subtree sync tooling

  • Added scripts/subtree-sync.sh for pulling/pushing all configured subtrees
  • Added subtree:pull and subtree:push npm scripts

3. Slack bot: migrate to Claude Agent SDK

  • Replaced claude-yes process spawning with @anthropic-ai/claude-agent-sdk (query() API)
  • Structured SDK message processing (assistant text, result events)
  • Extracted sendSlackUpdate() with 10s throttle to avoid Slack rate limits and LLM cost
  • Fixed final Slack update not running (interval was cleared before update)
  • Added abort controller cleanup for input drain on task completion
  • Renamed msgs.yamlinbox.yaml

snomiao and others added 4 commits March 20, 2026 13:55
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
git-subtree-dir: lib/slack-cli
git-subtree-split: 0e5b91258f5d91aee4f2d17edbc3bab44bf5dc6b
Copilot AI review requested due to automatic review settings April 2, 2026 15:15
@snomiao snomiao enabled auto-merge (squash) April 2, 2026 15:15
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comfy-pr Ready Ready Preview, Comment Apr 5, 2026 8:50am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR vendors in the snomiao/slack-cli project as a git subtree and adds tooling to sync subtrees, while also updating the existing Slack bot runtime to use @anthropic-ai/claude-agent-sdk and renaming the persisted inbox file.

Changes:

  • Added scripts/subtree-sync.sh and npm scripts to pull/push configured git subtrees.
  • Added lib/slack-cli/ subtree (Rust Slack CLI + NAPI bindings, build workflow, lockfiles).
  • Updated Slack bot to use @anthropic-ai/claude-agent-sdk, renamed msgs.yamlinbox.yaml, and changed streaming/update behavior.

Reviewed changes

Copilot reviewed 15 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/subtree-sync.sh Adds a bash helper to pull/push configured git subtrees.
package.json Adds subtree sync scripts and introduces @anthropic-ai/claude-agent-sdk.
bun.lock Updates lockfile for the new dependency.
bot/slack-bot.ts Refactors agent execution to use the Claude Agent SDK; adjusts inbox filename and message-update loop.
inbox.yaml Adds/initializes the new inbox file tracked by the bot.
CLAUDE.md Expands bot operational notes (PM2 startup/runbook).
lib/slack-cli/src/slack.rs Adds a direct Slack Web API client implementation (reqwest).
lib/slack-cli/src/main.rs Adds the Rust CLI entrypoint and commands.
lib/slack-cli/src/lib.rs Exposes Slack functions to Node via NAPI.
lib/slack-cli/Cargo.toml Defines Rust crate/bin and dependencies.
lib/slack-cli/Cargo.lock Locks Rust dependencies for the subtree.
lib/slack-cli/README.md Documents the Slack CLI usage/config.
lib/slack-cli/package.json Adds NAPI build config for the subtree package.
lib/slack-cli/index.js Loads the correct .node binary for the host platform.
lib/slack-cli/index.d.ts Type declarations for the NAPI bindings.
lib/slack-cli/build.rs Sets up napi-build for compiling the addon.
lib/slack-cli/.gitignore Ignores build outputs for the subtree.
lib/slack-cli/LICENSE Adds license file for the subtree.
lib/slack-cli/bun.lock Adds Bun lockfile for the subtree’s JS tooling.
lib/slack-cli/.github/workflows/build.yml Subtree CI workflow for building bindings/binaries (nested workflow).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bot/slack-bot.ts
Comment thread bot/slack-bot.ts Outdated
Comment thread bot/slack-bot.ts
Comment thread lib/slack-cli/src/slack.rs Outdated
Comment thread lib/slack-cli/src/slack.rs Outdated
Comment thread bot/slack-bot.ts
snomiao and others added 3 commits April 2, 2026 15:42
…put drain cleanup

Addresses Copilot review comments:
- Extract sendSlackUpdate() so it can be called from interval AND finally block
- Add 10s minimum throttle between LLM-synthesized Slack updates (avoids rate limits)
- Call sendSlackUpdate() explicitly in finally block (was broken: interval cleared first)
- Abort controller in finally to cancel inputDrainPromise reader

Amp-Thread-ID: https://ampcode.com/threads/T-019d47cc-caf7-740e-a487-be1f0e3443f8
Co-authored-by: Amp <amp@ampcode.com>
… pooling

Addresses Copilot review: client() was creating a new Client per request,
defeating connection pooling.

Amp-Thread-ID: https://ampcode.com/threads/T-019d47cc-caf7-740e-a487-be1f0e3443f8
Co-authored-by: Amp <amp@ampcode.com>
…nvalid markdown type

Addresses Copilot review: Slack Block Kit does not support 'markdown' block type.
Use 'section' block with 'mrkdwn' text object instead.

Amp-Thread-ID: https://ampcode.com/threads/T-019d47cc-caf7-740e-a487-be1f0e3443f8
Co-authored-by: Amp <amp@ampcode.com>
…ersion, caching, and safe messaging

Standalone utilities ported from lib/slack/ with zero project-specific deps:
- parse-url: parseSlackUrl() + slackMessageUrlParse() with team extraction
- ts-to-iso: slackTsToISO() timestamp conversion
- parse-markdown: sync + async mrkdwn→markdown with optional resolver
- safe-message: truncateSlackText() + truncateSlackBlocks()
- cached-client: createCachedSlack() in-memory Map cache proxy

Amp-Thread-ID: https://ampcode.com/threads/T-019d47cc-caf7-740e-a487-be1f0e3443f8
Co-authored-by: Amp <amp@ampcode.com>
@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 3, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 5, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​anthropic-ai/​claude-agent-sdk@​0.2.92711008610070

View full report

@snomiao snomiao merged commit 7ce564c into main Apr 5, 2026
5 checks passed
@snomiao snomiao deleted the sno-bot branch April 5, 2026 09:02
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

🎉 This PR is included in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants