Skip to content

feat(cli): bundle the Slack connector into the CLI for zero-setup peek connect add slack#161

Open
harry-harish wants to merge 1 commit into
mainfrom
feat/bundle-slack-connector-into-cli
Open

feat(cli): bundle the Slack connector into the CLI for zero-setup peek connect add slack#161
harry-harish wants to merge 1 commit into
mainfrom
feat/bundle-slack-connector-into-cli

Conversation

@harry-harish

@harry-harish harry-harish commented Jul 10, 2026

Copy link
Copy Markdown
Member

What

peek connect add slack now spawns a pre-bundled connector shipped inside @peekdev/cli (dist/connectors/slack.js), so setup drops from clone → pnpm build → --local to:

npm i -g @peekdev/cli
peek connect add slack     # no clone, no build, no --local
peek connect start

How

  • scripts/bundle-connectors.mjs (new): esbuilds @peekdev/connector-slack from source into dist/connectors/slack.js, aliasing @peekdev/connector-core to source too — so the private connector packages never need to be published or pre-built. @slack/bolt + @anthropic-ai/sdk are inlined.
  • @napi-rs/keyring is the only external (native module, can't be inlined). It's now a runtime dependency of @peekdev/cli, so npm installs its platform binary and the bundle resolves it at spawn time — tokens still go to the OS keychain.
  • descriptors.ts: the slack surface now spawns node <cli>/dist/connectors/slack.js (resolved relative to the install) instead of an external peek-connector-slack bin. The CLI still only spawns connectors (no connector code imported at runtime).
  • connector-slack/README.md: documents the bundled path and corrects the scope table to the 8 scopes the connector actually uses.

Verification

  • pnpm --filter @peekdev/cli... builddist/connectors/slack.js (3.3 MB).
  • Bundle load-tested: resolves @napi-rs/keyring, @slack/bolt, @anthropic-ai/sdk, connector-core; runs into main() (stops at the Node-22 guard on a Node-20 box, as expected).
  • Descriptor tests pass; typecheck and lint clean.
  • Note: the DB-touching CLI tests fail locally only due to a better-sqlite3 native-ABI mismatch (Node-20 box vs a Node-22 build) — reproduced identically on main; unrelated to this change and green on CI (Node 22).

Changeset included (minor bump for @peekdev/cli).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Slack connector is now included directly in the Peek CLI.
    • Run peek connect add slack without cloning the repository or using a local build.
    • Slack connections now launch from the bundled connector automatically.
  • Documentation

    • Expanded Slack setup guidance with required permissions and supported event subscriptions.
    • Added recommended bundled-connector instructions and updated local development steps.

`peek connect add slack` now spawns a pre-bundled connector shipped inside
@peekdev/cli (dist/connectors/slack.js), so setup drops to
`npm i -g @peekdev/cli && peek connect add slack && peek connect start` — no
monorepo clone, no `--local` build.

- scripts/bundle-connectors.mjs: esbuild @peekdev/connector-slack from source
  (connector-core aliased to source too); only @napi-rs/keyring stays external.
- descriptors.ts: slack spawns the bundle with the CLI's own Node binary.
- package.json: bundle step in build; @napi-rs/keyring runtime dep; esbuild dev.
- connector-slack README: document the bundled path + correct the scope table
  to the 8 scopes the connector actually uses.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: harry-harish <harry652k15@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a7c1a96-bff6-4402-b97e-d8d9846dfad3

📥 Commits

Reviewing files that changed from the base of the PR and between 99d7e1e and df2e525.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (6)
  • .changeset/bundled-slack-connector.md
  • packages/connector-slack/README.md
  • packages/peek-cli/package.json
  • packages/peek-cli/scripts/bundle-connectors.mjs
  • packages/peek-cli/src/lib/connect/descriptors.test.ts
  • packages/peek-cli/src/lib/connect/descriptors.ts

📝 Walkthrough

Walkthrough

The CLI now bundles the Slack connector with esbuild, externalizes its native keyring dependency, and spawns the generated module through Node.js. Slack documentation and release metadata describe the bundled and local-development workflows.

Changes

Slack connector bundling and execution

Layer / File(s) Summary
Bundle Slack during CLI builds
packages/peek-cli/package.json, packages/peek-cli/scripts/bundle-connectors.mjs
The CLI build invokes the connector bundler, adds esbuild and @napi-rs/keyring, and produces dist/connectors/slack.js with the configured external and workspace aliases.
Spawn the bundled Slack module
packages/peek-cli/src/lib/connect/descriptors.ts, packages/peek-cli/src/lib/connect/descriptors.test.ts
Slack defaults now use process.execPath with the module-relative bundled connector path, with descriptor and spawn tests updated accordingly.
Document setup and release behavior
packages/connector-slack/README.md, .changeset/bundled-slack-connector.md
Slack scopes, events, CLI setup, local development, and the minor CLI release are documented.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Bundler
  participant ConnectDaemon
  participant Node
  CLI->>Bundler: run bundle-connectors.mjs
  Bundler-->>CLI: write dist/connectors/slack.js
  ConnectDaemon->>CLI: resolve Slack descriptor
  CLI->>Node: spawn process.execPath with slack.js
  Node-->>ConnectDaemon: run bundled Slack connector
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: bundling the Slack connector into the CLI for zero-setup use.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/bundle-slack-connector-into-cli

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant