diff --git a/claude-agent-sdk/.agents/skills/deploy-slack-app/SKILL.md b/claude-agent-sdk/.agents/skills/deploy-slack-app/SKILL.md index 9e6148d..f9ccd36 100644 --- a/claude-agent-sdk/.agents/skills/deploy-slack-app/SKILL.md +++ b/claude-agent-sdk/.agents/skills/deploy-slack-app/SKILL.md @@ -1,13 +1,15 @@ --- name: deploy-slack-app -description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. +description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying a Deno Slack SDK app (workflows, functions, and triggers) to Slack's managed hosting, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. --- # Deploy Slack App Take a Slack app that already works locally and deploy it to a hosting provider as a separate Slack app, with its own app ID, that keeps running without the developer's machine. The local development app is unchanged, and **Step 5: Deploy** explains how the two coexist. This is the step after the `test-slack-app` skill confirms the app responds. -The mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. +A Deno Slack SDK app is the exception: it deploys to Slack's own managed hosting with plain `slack deploy`, and **Step 1b: Check for a Deno Slack SDK App** sends it to **Deploy a Deno Slack SDK App** instead of the provider flow. + +For the provider flow, the mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. Two supported providers, both running the app as a long-lived worker process: @@ -28,7 +30,19 @@ Load the `slack-cli` skill (with your skill tool, if you have one) before runnin This matters more than it looks. Some machines have an unrelated internal tool named `slack` on the path, and running that instead produces confusing failures well into the deploy. -### 1b. Confirm the App Uses Socket Mode +### 1b. Check for a Deno Slack SDK App + +Before reading the manifest for Socket Mode, check whether this is a Deno Slack SDK app. Any one of these is a match: + +- `.slack/hooks.json` has a `get-hooks` command that runs `deno_slack_hooks`. +- `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. +- The project has a `manifest.ts` that imports `Manifest` from `deno-slack-sdk`, usually beside `functions/`, `workflows/`, and `triggers/` folders. + +**A Deno Slack SDK app does not use this skill's provider flow.** Its functions run on Slack's managed hosting, and its manifest sets `socket_mode_enabled` to `false`, so **Step 1c: Confirm the App Uses Socket Mode** would wrongly stop it as a Request URL app. Skip the rest of Steps 1 to 8 and follow **Deploy a Deno Slack SDK App** below. Do not add a `deploy` hook or a Railway or Heroku script to it. + +If none of these match, continue with the next step. + +### 1c. Confirm the App Uses Socket Mode **Read the app's manifest rather than asking.** The project already declares which mode it uses, so a question here is redundant. Check `manifest.json` for `settings.socket_mode_enabled`. If `.slack/config.json` sets the manifest source to `remote`, there is no local file, so read it with `SLACK_CMD manifest info` instead. @@ -37,7 +51,7 @@ This matters more than it looks. Some machines have an unrelated internal tool n If the manifest is ambiguous, read the app's entrypoint. A Bolt for JavaScript app constructed with `socketMode: true` and an `appToken`, or a Bolt for Python app started through `SocketModeHandler`, is a Socket Mode app. -### 1c. Confirm the Runtime Is Supported +### 1d. Confirm the Runtime Is Supported This flow is verified on macOS and Linux. The deploy hook is a shell script, so a Windows developer needs a PowerShell equivalent that does not exist yet. On Windows, say so rather than letting the deploy fail partway through. WSL is a workable path in the meantime. Support may have shipped in a newer version of the Slack Skills Plugin, so ask the developer to update the plugin and try again. If they are already on the latest version, point them to to add a reaction or comment. @@ -197,6 +211,21 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD --- +## Deploy a Deno Slack SDK App + +Use this section instead of Steps 2 to 8 when **Step 1b: Check for a Deno Slack SDK App** found a Deno Slack SDK app. The `slack-cli` skill covers the CLI's commands generally. + +1. **Check the plan.** Deploying a Deno Slack SDK app needs a paid Slack plan or an upgraded developer sandbox. A basic sandbox does not support deploying to Slack's hosting, and the `create-slack-app` skill's **Basic sandboxes** note explains the upgrade. Point the developer to for the current terms. +2. **Choose a team.** Follow **Step 2b: Choose a Team** to pick the team from `SLACK_CMD auth list`. Never pick it yourself. For an Enterprise organization, the CLI asks which of the organization's workspaces the app can access the first time it installs the app, and a background shell cannot answer. Ask the developer which workspaces to grant, as **Step 5: Deploy** describes under "On an Enterprise organization", and add the same `--org-workspace-grant` value to each `run`, `deploy`, and `trigger create` command below. +3. **Confirm it works locally first.** Use the `test-slack-app` skill to run the app and start at least one workflow, as **Step 3: Confirm It Works Locally First** describes. A local run offers to create triggers, which a background shell cannot answer, so run `SLACK_CMD run --hide-triggers --team `, then create a local trigger with `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team ` unless `SLACK_CMD trigger list --app local --team --limit 50` already shows it. +4. **Deploy.** Run `SLACK_CMD deploy --skip-update --hide-triggers --team --app deployed` from the project root, with no `deploy` key in `.slack/hooks.json`. The CLI packages the app and deploys it to Slack, as a separate app with its own app ID in `.slack/apps.json`. `--hide-triggers` skips the CLI's offer to create triggers, which a background shell cannot answer, and the next step creates them. Add the workspace grant from step 2 for an Enterprise organization. Commit `.slack/apps.json` after the first deploy, so later deploys from any checkout reach the same app. +5. **Create the triggers.** Triggers created for the local app do not carry over to the deployed app. For each file in `triggers/`, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app deployed --team `. The output for a link trigger includes its shortcut URL. +6. **Verify.** Run `SLACK_CMD trigger list --app deployed --team --limit 50` to confirm the triggers exist. The list shows 4 triggers unless `--limit` is set. Stop the local `SLACK_CMD run`, start a workflow from one of the triggers, and read the deployed app's logs with `SLACK_CMD activity --app deployed --team `. +7. **Re-deploy.** Shipping a change is the same `SLACK_CMD deploy` command. The triggers stay in place. When a trigger file changes, update the existing trigger rather than creating a second one: find its ID with `SLACK_CMD trigger list --app deployed --team --limit 50`, then run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app deployed --team `. A new file gets `trigger create`, as in step 5. +8. **Tear down.** Name the deployed app ID from `.slack/apps.json` and ask once, then run `SLACK_CMD app delete --team --app deployed --force`. Leave the local app unless the developer asks for it too. + +--- + ## Notes **Serverless providers cannot host a Socket Mode app.** A Socket Mode app is a process that stays resident and holds an outbound websocket open. Vercel, AWS Lambda, and similar platforms run per-request functions with a maximum duration and no always-on process type, so there is nothing for the websocket to live in. When a developer asks for one of these, explain the constraint rather than attempting it. Hosting a Slack app on a serverless platform means a Request URL app, which this skill does not cover yet. @@ -205,6 +234,6 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD **The token handoff is not a documented contract.** The Slack CLI does not pass the tokens to the deploy hook explicitly. It sets them on its own process during app installation, and the hook script inherits them because it runs later in that same process. It works, and it only works for apps with no Slack-hosted function runtime, which covers every Bolt app. That is why each deploy script checks for both tokens and stops with a readable message instead of assuming they are present. -**Not `slack deploy` without a hook.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which is a different product for a different kind of app. The `slack-cli` skill covers the CLI's commands generally. +**Not `slack deploy` without a hook, for a Bolt app.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which hosts Deno Slack SDK apps, not Bolt apps. **Deploy a Deno Slack SDK App** covers that path. The `slack-cli` skill covers the CLI's commands generally. **Building the app comes first.** If there is no app yet, start with the `create-slack-app` skill and come back here once it runs locally. diff --git a/claude-agent-sdk/.agents/skills/slack-cli/SKILL.md b/claude-agent-sdk/.agents/skills/slack-cli/SKILL.md index 9034b02..9004c9e 100644 --- a/claude-agent-sdk/.agents/skills/slack-cli/SKILL.md +++ b/claude-agent-sdk/.agents/skills/slack-cli/SKILL.md @@ -35,7 +35,7 @@ $p = "$env:USERPROFILE\AppData\Local\slack-cli\bin\slack.exe" if (Test-Path $p) { $p } elseif (Test-Path "$env:USERPROFILE\.slack-cli\bin\slack.exe") { "$env:USERPROFILE\.slack-cli\bin\slack.exe" } ``` -If a path is returned, set `SLACK_CMD` to that **absolute path** and proceed to Step 2. Do not also run `_fingerprint`. +If a path is returned, set `SLACK_CMD` to that **absolute path** and go to **1d**. Do not also run `_fingerprint`. ### 1b. `slack` on PATH (verify with fingerprint) @@ -45,22 +45,31 @@ If 1a found nothing, try `slack` on PATH: slack _fingerprint 2>/dev/null ``` -If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and proceed. +If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and go to **1d**. ### 1c. Ask about an alias, or install -If 1b fails or returns a different value, ask the developer using AskUserQuestion: +If 1b fails or returns a different value, ask the developer one question using AskUserQuestion. The options cover both the alias and the install, so the developer chooses whether a remote script runs on their machine: -- "The `slack` command on your system doesn't appear to be the public Slack CLI. Do you have it installed under a different name or alias?" -- Options: "Yes, it's aliased as..." (let them provide the alias), "No, I need to install it" -- If they provide an alias, verify it with ` _fingerprint 2>/dev/null` and set `SLACK_CMD=`. -- If they need to install it, run: +- "I couldn't find the public Slack CLI on your system. Is it installed under a different name or alias, or should it be installed?" +- Options: + - "It's aliased as..." (let them provide the alias) + - "Install it for me" (runs the Slack CLI install script from `downloads.slack-edge.com`) + - "Show me the command, I'll install it" +- **Aliased:** verify it with ` _fingerprint 2>/dev/null`. If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=` and go to **1d**. Otherwise it isn't the public Slack CLI: tell the developer and ask again. +- **Install it for me:** run the install script, then re-run **1a**. The install script writes `~/.slack/bin/slack`. ```text curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash ``` - Then re-run **1a** — the install script will have written `~/.slack/bin/slack`. +- **Show me the command:** print the install command above and don't run it. Wait for the developer to say it's installed, then re-run **1a**. If 1a still finds nothing, tell them and ask this question again. + +Only run the install script when the developer picks "Install it for me". Any other answer, including one typed in by the developer, is not consent to run it. A typed answer like "I'll install it myself" takes the "Show me the command" path. + +### 1d. Continue where you left off + +Once `SLACK_CMD` is set, go back to the skill that sent you to this step, if one did. Continue right after the instruction that sent you here, not at that skill's next numbered step, because the rest of its current step may still apply (the `slack-api` skill checks authentication next, in the same step). For example, the `create-slack-app` skill continues at "Verify the CLI version". This matters most after the developer installs the CLI themselves, because the conversation paused there. If no other skill sent you here, go on to Step 2. **Common mistakes:** Don't use `which slack` to discover the binary — `which` resolves any shell alias and defeats the point of 1a. In Git Bash on Windows, use the POSIX probe form, not PowerShell. diff --git a/claude-agent-sdk/.agents/skills/test-slack-app/SKILL.md b/claude-agent-sdk/.agents/skills/test-slack-app/SKILL.md index 69f08ff..37fcd24 100644 --- a/claude-agent-sdk/.agents/skills/test-slack-app/SKILL.md +++ b/claude-agent-sdk/.agents/skills/test-slack-app/SKILL.md @@ -1,6 +1,6 @@ --- name: test-slack-app -description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces. Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. +description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces, or a Deno Slack SDK app's workflows, functions, and triggers (`slack trigger create`, `deno task test`). Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. --- # Test Slack App @@ -30,6 +30,7 @@ Testing belongs in a workspace nobody is working in: a developer sandbox for pre - **Explain it from the live docs, not from here.** Use the `slack-docs` skill to fetch and summarize , so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps. - **Find the current target.** Run `SLACK_CMD auth list` for the authenticated workspaces and their team IDs, and, from the project directory, `SLACK_CMD app list` for the apps already installed and their IDs. - **Confirm the target is safe.** The CLI cannot tell a sandbox, a Free Team, and a workspace full of real users apart, so ask the developer which one they are pointed at. A sandbox or a Free Team they created for this is fine. A workspace with coworkers in it is not: stop and get them onto one of the other two. +- **A Deno Slack SDK app needs a developer sandbox or a paid plan.** A project is a Deno Slack SDK app when its `.slack/hooks.json` runs `deno_slack_hooks`, or its `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. Slack requires a paid plan for workflow apps, so a Free Team won't work. Steer the developer to a sandbox, per . - **If there is no safe target yet**, set one up with the `create-slack-app` skill (**Step 3: Choose Where to Install the App**), which owns the ranked targets, the `sandbox list` / `sandbox create` flow, and the Developer Program links. Either path finishes in the browser, so have the developer come back here once the workspace exists and they have logged into it. ### 1c. Quick health check @@ -39,6 +40,8 @@ Catch obvious setup problems with the CLI's own validation before the slower han - `SLACK_CMD doctor`: checks the CLI, language runtime, and authentication. - `SLACK_CMD manifest validate`: run from the project directory if the app has a manifest, to confirm the app configuration is well-formed. +For a Deno Slack SDK app (spotted as **1b. Make sure there is a safe workspace to test in** describes), also run the project's own tests. If `deno.json` or `deno.jsonc` defines a `test` task, run `deno task test`. The Deno samples' function tests use `SlackFunctionTester` with a stubbed `fetch`, so they need no workspace. With no `test` task, run `deno test --allow-read` if the project has `*_test.ts` files. + Surface anything these flag before moving on. --- @@ -51,6 +54,8 @@ Whichever path you use below, first turn the app's log level up to debug so you Follow **Step 6: Running an App Locally (`slack run`)** in the `slack-cli` skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox or Free Team where nothing is installed yet. Once it is running, file changes auto-reload. +For a Deno Slack SDK app, there is usually no log-level variable to set. Pass `--activity-level debug` to `SLACK_CMD run` instead, which shows the app's activity logs, including `console.log` output from functions, at debug level. The local run also offers to create triggers, which a background shell cannot answer, so add `--hide-triggers` and create them in **3a. Read the source to find what the app listens for**. + ### Plain Bolt apps without the CLI (best-effort) If the app is a plain Bolt app started with `node` or `python` rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow: @@ -79,6 +84,12 @@ Read the app's listener code and list the interactions it registers. Depending o - **[App Home](https://docs.slack.dev/surfaces/app-home.md):** an `app_home_opened` handler or a published Home tab. - **[Assistant / agent](https://docs.slack.dev/ai.md):** an assistant or `assistant_thread_started` handler, common in the agent templates. +For a Deno Slack SDK app, read these instead: + +- **Workflows:** the `workflows` listed in `manifest.ts`, and the steps each one runs in `workflows/`. +- **Functions:** each `DefineFunction` in `functions/`, its inputs and outputs, and the Slack API calls or datastore writes it makes. +- **Triggers:** each file in `triggers/` and its `type`: shortcut (a link trigger), event, scheduled, or webhook. Triggers are not created when the app is installed. First run `SLACK_CMD trigger list --app local --team --limit 50` to see the triggers that already exist (the list shows 4 unless `--limit` is set). Check each file for placeholder values, such as a sample channel ID or a `start_time` already in the past. For a file with no trigger yet, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team `. For one that already has a trigger, run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app local --team `, so the test uses the file as it is now rather than a second copy. For an Enterprise organization, ask the developer which workspace the trigger is for, or whether all of them, and add `--org-workspace-grant ` or `--org-workspace-grant all`. Never choose `all` yourself. Triggers created for the local app do not carry over to a deployed app. + Name the concrete identifiers you find (the actual command and callback names), not placeholders. ### 3b. Turn each into a "do this, expect that" step @@ -93,11 +104,19 @@ For every registered interaction, give the developer a concrete step and what a - **Modal submit** (`view_submission`) → submit the modal → expect the confirmation or side effect. - **App Home** → click the app in the left sidebar to open its **Home** tab → expect the published view. +For a Deno Slack SDK app, each step starts a workflow from one of its triggers: + +- **Link (shortcut) trigger** → open the shortcut URL that `trigger create` printed, or paste it into a channel and click the button it unfurls into → expect the workflow's first step, such as its form. +- **Event trigger** → cause the event in a channel the trigger watches, such as posting a message or adding a reaction → expect the workflow to run. +- **Scheduled trigger** → read its `schedule` (`start_time` and `frequency`) in the trigger file and wait for that time → expect the workflow to run at that time. +- **Webhook trigger** → send a POST request with a flat JSON body to the URL that `trigger create` printed → expect the workflow to run with those inputs. +- **Each function** → after the workflow runs, confirm the side effect the function's code makes, such as a message posted or a datastore item written. + ### 3c. Confirm and report While the developer interacts, help them confirm it is working: -- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. +- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. For a Deno Slack SDK app, the same output shows each workflow step and function execution. - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the `block-kit` and `slack-api` skills to dig into the payload or method. Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail. diff --git a/claude-agent-sdk/.claude/skills/deploy-slack-app/SKILL.md b/claude-agent-sdk/.claude/skills/deploy-slack-app/SKILL.md index 9e6148d..f9ccd36 100644 --- a/claude-agent-sdk/.claude/skills/deploy-slack-app/SKILL.md +++ b/claude-agent-sdk/.claude/skills/deploy-slack-app/SKILL.md @@ -1,13 +1,15 @@ --- name: deploy-slack-app -description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. +description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying a Deno Slack SDK app (workflows, functions, and triggers) to Slack's managed hosting, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. --- # Deploy Slack App Take a Slack app that already works locally and deploy it to a hosting provider as a separate Slack app, with its own app ID, that keeps running without the developer's machine. The local development app is unchanged, and **Step 5: Deploy** explains how the two coexist. This is the step after the `test-slack-app` skill confirms the app responds. -The mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. +A Deno Slack SDK app is the exception: it deploys to Slack's own managed hosting with plain `slack deploy`, and **Step 1b: Check for a Deno Slack SDK App** sends it to **Deploy a Deno Slack SDK App** instead of the provider flow. + +For the provider flow, the mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. Two supported providers, both running the app as a long-lived worker process: @@ -28,7 +30,19 @@ Load the `slack-cli` skill (with your skill tool, if you have one) before runnin This matters more than it looks. Some machines have an unrelated internal tool named `slack` on the path, and running that instead produces confusing failures well into the deploy. -### 1b. Confirm the App Uses Socket Mode +### 1b. Check for a Deno Slack SDK App + +Before reading the manifest for Socket Mode, check whether this is a Deno Slack SDK app. Any one of these is a match: + +- `.slack/hooks.json` has a `get-hooks` command that runs `deno_slack_hooks`. +- `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. +- The project has a `manifest.ts` that imports `Manifest` from `deno-slack-sdk`, usually beside `functions/`, `workflows/`, and `triggers/` folders. + +**A Deno Slack SDK app does not use this skill's provider flow.** Its functions run on Slack's managed hosting, and its manifest sets `socket_mode_enabled` to `false`, so **Step 1c: Confirm the App Uses Socket Mode** would wrongly stop it as a Request URL app. Skip the rest of Steps 1 to 8 and follow **Deploy a Deno Slack SDK App** below. Do not add a `deploy` hook or a Railway or Heroku script to it. + +If none of these match, continue with the next step. + +### 1c. Confirm the App Uses Socket Mode **Read the app's manifest rather than asking.** The project already declares which mode it uses, so a question here is redundant. Check `manifest.json` for `settings.socket_mode_enabled`. If `.slack/config.json` sets the manifest source to `remote`, there is no local file, so read it with `SLACK_CMD manifest info` instead. @@ -37,7 +51,7 @@ This matters more than it looks. Some machines have an unrelated internal tool n If the manifest is ambiguous, read the app's entrypoint. A Bolt for JavaScript app constructed with `socketMode: true` and an `appToken`, or a Bolt for Python app started through `SocketModeHandler`, is a Socket Mode app. -### 1c. Confirm the Runtime Is Supported +### 1d. Confirm the Runtime Is Supported This flow is verified on macOS and Linux. The deploy hook is a shell script, so a Windows developer needs a PowerShell equivalent that does not exist yet. On Windows, say so rather than letting the deploy fail partway through. WSL is a workable path in the meantime. Support may have shipped in a newer version of the Slack Skills Plugin, so ask the developer to update the plugin and try again. If they are already on the latest version, point them to to add a reaction or comment. @@ -197,6 +211,21 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD --- +## Deploy a Deno Slack SDK App + +Use this section instead of Steps 2 to 8 when **Step 1b: Check for a Deno Slack SDK App** found a Deno Slack SDK app. The `slack-cli` skill covers the CLI's commands generally. + +1. **Check the plan.** Deploying a Deno Slack SDK app needs a paid Slack plan or an upgraded developer sandbox. A basic sandbox does not support deploying to Slack's hosting, and the `create-slack-app` skill's **Basic sandboxes** note explains the upgrade. Point the developer to for the current terms. +2. **Choose a team.** Follow **Step 2b: Choose a Team** to pick the team from `SLACK_CMD auth list`. Never pick it yourself. For an Enterprise organization, the CLI asks which of the organization's workspaces the app can access the first time it installs the app, and a background shell cannot answer. Ask the developer which workspaces to grant, as **Step 5: Deploy** describes under "On an Enterprise organization", and add the same `--org-workspace-grant` value to each `run`, `deploy`, and `trigger create` command below. +3. **Confirm it works locally first.** Use the `test-slack-app` skill to run the app and start at least one workflow, as **Step 3: Confirm It Works Locally First** describes. A local run offers to create triggers, which a background shell cannot answer, so run `SLACK_CMD run --hide-triggers --team `, then create a local trigger with `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team ` unless `SLACK_CMD trigger list --app local --team --limit 50` already shows it. +4. **Deploy.** Run `SLACK_CMD deploy --skip-update --hide-triggers --team --app deployed` from the project root, with no `deploy` key in `.slack/hooks.json`. The CLI packages the app and deploys it to Slack, as a separate app with its own app ID in `.slack/apps.json`. `--hide-triggers` skips the CLI's offer to create triggers, which a background shell cannot answer, and the next step creates them. Add the workspace grant from step 2 for an Enterprise organization. Commit `.slack/apps.json` after the first deploy, so later deploys from any checkout reach the same app. +5. **Create the triggers.** Triggers created for the local app do not carry over to the deployed app. For each file in `triggers/`, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app deployed --team `. The output for a link trigger includes its shortcut URL. +6. **Verify.** Run `SLACK_CMD trigger list --app deployed --team --limit 50` to confirm the triggers exist. The list shows 4 triggers unless `--limit` is set. Stop the local `SLACK_CMD run`, start a workflow from one of the triggers, and read the deployed app's logs with `SLACK_CMD activity --app deployed --team `. +7. **Re-deploy.** Shipping a change is the same `SLACK_CMD deploy` command. The triggers stay in place. When a trigger file changes, update the existing trigger rather than creating a second one: find its ID with `SLACK_CMD trigger list --app deployed --team --limit 50`, then run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app deployed --team `. A new file gets `trigger create`, as in step 5. +8. **Tear down.** Name the deployed app ID from `.slack/apps.json` and ask once, then run `SLACK_CMD app delete --team --app deployed --force`. Leave the local app unless the developer asks for it too. + +--- + ## Notes **Serverless providers cannot host a Socket Mode app.** A Socket Mode app is a process that stays resident and holds an outbound websocket open. Vercel, AWS Lambda, and similar platforms run per-request functions with a maximum duration and no always-on process type, so there is nothing for the websocket to live in. When a developer asks for one of these, explain the constraint rather than attempting it. Hosting a Slack app on a serverless platform means a Request URL app, which this skill does not cover yet. @@ -205,6 +234,6 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD **The token handoff is not a documented contract.** The Slack CLI does not pass the tokens to the deploy hook explicitly. It sets them on its own process during app installation, and the hook script inherits them because it runs later in that same process. It works, and it only works for apps with no Slack-hosted function runtime, which covers every Bolt app. That is why each deploy script checks for both tokens and stops with a readable message instead of assuming they are present. -**Not `slack deploy` without a hook.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which is a different product for a different kind of app. The `slack-cli` skill covers the CLI's commands generally. +**Not `slack deploy` without a hook, for a Bolt app.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which hosts Deno Slack SDK apps, not Bolt apps. **Deploy a Deno Slack SDK App** covers that path. The `slack-cli` skill covers the CLI's commands generally. **Building the app comes first.** If there is no app yet, start with the `create-slack-app` skill and come back here once it runs locally. diff --git a/claude-agent-sdk/.claude/skills/slack-cli/SKILL.md b/claude-agent-sdk/.claude/skills/slack-cli/SKILL.md index 9034b02..9004c9e 100644 --- a/claude-agent-sdk/.claude/skills/slack-cli/SKILL.md +++ b/claude-agent-sdk/.claude/skills/slack-cli/SKILL.md @@ -35,7 +35,7 @@ $p = "$env:USERPROFILE\AppData\Local\slack-cli\bin\slack.exe" if (Test-Path $p) { $p } elseif (Test-Path "$env:USERPROFILE\.slack-cli\bin\slack.exe") { "$env:USERPROFILE\.slack-cli\bin\slack.exe" } ``` -If a path is returned, set `SLACK_CMD` to that **absolute path** and proceed to Step 2. Do not also run `_fingerprint`. +If a path is returned, set `SLACK_CMD` to that **absolute path** and go to **1d**. Do not also run `_fingerprint`. ### 1b. `slack` on PATH (verify with fingerprint) @@ -45,22 +45,31 @@ If 1a found nothing, try `slack` on PATH: slack _fingerprint 2>/dev/null ``` -If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and proceed. +If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and go to **1d**. ### 1c. Ask about an alias, or install -If 1b fails or returns a different value, ask the developer using AskUserQuestion: +If 1b fails or returns a different value, ask the developer one question using AskUserQuestion. The options cover both the alias and the install, so the developer chooses whether a remote script runs on their machine: -- "The `slack` command on your system doesn't appear to be the public Slack CLI. Do you have it installed under a different name or alias?" -- Options: "Yes, it's aliased as..." (let them provide the alias), "No, I need to install it" -- If they provide an alias, verify it with ` _fingerprint 2>/dev/null` and set `SLACK_CMD=`. -- If they need to install it, run: +- "I couldn't find the public Slack CLI on your system. Is it installed under a different name or alias, or should it be installed?" +- Options: + - "It's aliased as..." (let them provide the alias) + - "Install it for me" (runs the Slack CLI install script from `downloads.slack-edge.com`) + - "Show me the command, I'll install it" +- **Aliased:** verify it with ` _fingerprint 2>/dev/null`. If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=` and go to **1d**. Otherwise it isn't the public Slack CLI: tell the developer and ask again. +- **Install it for me:** run the install script, then re-run **1a**. The install script writes `~/.slack/bin/slack`. ```text curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash ``` - Then re-run **1a** — the install script will have written `~/.slack/bin/slack`. +- **Show me the command:** print the install command above and don't run it. Wait for the developer to say it's installed, then re-run **1a**. If 1a still finds nothing, tell them and ask this question again. + +Only run the install script when the developer picks "Install it for me". Any other answer, including one typed in by the developer, is not consent to run it. A typed answer like "I'll install it myself" takes the "Show me the command" path. + +### 1d. Continue where you left off + +Once `SLACK_CMD` is set, go back to the skill that sent you to this step, if one did. Continue right after the instruction that sent you here, not at that skill's next numbered step, because the rest of its current step may still apply (the `slack-api` skill checks authentication next, in the same step). For example, the `create-slack-app` skill continues at "Verify the CLI version". This matters most after the developer installs the CLI themselves, because the conversation paused there. If no other skill sent you here, go on to Step 2. **Common mistakes:** Don't use `which slack` to discover the binary — `which` resolves any shell alias and defeats the point of 1a. In Git Bash on Windows, use the POSIX probe form, not PowerShell. diff --git a/claude-agent-sdk/.claude/skills/test-slack-app/SKILL.md b/claude-agent-sdk/.claude/skills/test-slack-app/SKILL.md index 69f08ff..37fcd24 100644 --- a/claude-agent-sdk/.claude/skills/test-slack-app/SKILL.md +++ b/claude-agent-sdk/.claude/skills/test-slack-app/SKILL.md @@ -1,6 +1,6 @@ --- name: test-slack-app -description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces. Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. +description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces, or a Deno Slack SDK app's workflows, functions, and triggers (`slack trigger create`, `deno task test`). Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. --- # Test Slack App @@ -30,6 +30,7 @@ Testing belongs in a workspace nobody is working in: a developer sandbox for pre - **Explain it from the live docs, not from here.** Use the `slack-docs` skill to fetch and summarize , so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps. - **Find the current target.** Run `SLACK_CMD auth list` for the authenticated workspaces and their team IDs, and, from the project directory, `SLACK_CMD app list` for the apps already installed and their IDs. - **Confirm the target is safe.** The CLI cannot tell a sandbox, a Free Team, and a workspace full of real users apart, so ask the developer which one they are pointed at. A sandbox or a Free Team they created for this is fine. A workspace with coworkers in it is not: stop and get them onto one of the other two. +- **A Deno Slack SDK app needs a developer sandbox or a paid plan.** A project is a Deno Slack SDK app when its `.slack/hooks.json` runs `deno_slack_hooks`, or its `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. Slack requires a paid plan for workflow apps, so a Free Team won't work. Steer the developer to a sandbox, per . - **If there is no safe target yet**, set one up with the `create-slack-app` skill (**Step 3: Choose Where to Install the App**), which owns the ranked targets, the `sandbox list` / `sandbox create` flow, and the Developer Program links. Either path finishes in the browser, so have the developer come back here once the workspace exists and they have logged into it. ### 1c. Quick health check @@ -39,6 +40,8 @@ Catch obvious setup problems with the CLI's own validation before the slower han - `SLACK_CMD doctor`: checks the CLI, language runtime, and authentication. - `SLACK_CMD manifest validate`: run from the project directory if the app has a manifest, to confirm the app configuration is well-formed. +For a Deno Slack SDK app (spotted as **1b. Make sure there is a safe workspace to test in** describes), also run the project's own tests. If `deno.json` or `deno.jsonc` defines a `test` task, run `deno task test`. The Deno samples' function tests use `SlackFunctionTester` with a stubbed `fetch`, so they need no workspace. With no `test` task, run `deno test --allow-read` if the project has `*_test.ts` files. + Surface anything these flag before moving on. --- @@ -51,6 +54,8 @@ Whichever path you use below, first turn the app's log level up to debug so you Follow **Step 6: Running an App Locally (`slack run`)** in the `slack-cli` skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox or Free Team where nothing is installed yet. Once it is running, file changes auto-reload. +For a Deno Slack SDK app, there is usually no log-level variable to set. Pass `--activity-level debug` to `SLACK_CMD run` instead, which shows the app's activity logs, including `console.log` output from functions, at debug level. The local run also offers to create triggers, which a background shell cannot answer, so add `--hide-triggers` and create them in **3a. Read the source to find what the app listens for**. + ### Plain Bolt apps without the CLI (best-effort) If the app is a plain Bolt app started with `node` or `python` rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow: @@ -79,6 +84,12 @@ Read the app's listener code and list the interactions it registers. Depending o - **[App Home](https://docs.slack.dev/surfaces/app-home.md):** an `app_home_opened` handler or a published Home tab. - **[Assistant / agent](https://docs.slack.dev/ai.md):** an assistant or `assistant_thread_started` handler, common in the agent templates. +For a Deno Slack SDK app, read these instead: + +- **Workflows:** the `workflows` listed in `manifest.ts`, and the steps each one runs in `workflows/`. +- **Functions:** each `DefineFunction` in `functions/`, its inputs and outputs, and the Slack API calls or datastore writes it makes. +- **Triggers:** each file in `triggers/` and its `type`: shortcut (a link trigger), event, scheduled, or webhook. Triggers are not created when the app is installed. First run `SLACK_CMD trigger list --app local --team --limit 50` to see the triggers that already exist (the list shows 4 unless `--limit` is set). Check each file for placeholder values, such as a sample channel ID or a `start_time` already in the past. For a file with no trigger yet, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team `. For one that already has a trigger, run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app local --team `, so the test uses the file as it is now rather than a second copy. For an Enterprise organization, ask the developer which workspace the trigger is for, or whether all of them, and add `--org-workspace-grant ` or `--org-workspace-grant all`. Never choose `all` yourself. Triggers created for the local app do not carry over to a deployed app. + Name the concrete identifiers you find (the actual command and callback names), not placeholders. ### 3b. Turn each into a "do this, expect that" step @@ -93,11 +104,19 @@ For every registered interaction, give the developer a concrete step and what a - **Modal submit** (`view_submission`) → submit the modal → expect the confirmation or side effect. - **App Home** → click the app in the left sidebar to open its **Home** tab → expect the published view. +For a Deno Slack SDK app, each step starts a workflow from one of its triggers: + +- **Link (shortcut) trigger** → open the shortcut URL that `trigger create` printed, or paste it into a channel and click the button it unfurls into → expect the workflow's first step, such as its form. +- **Event trigger** → cause the event in a channel the trigger watches, such as posting a message or adding a reaction → expect the workflow to run. +- **Scheduled trigger** → read its `schedule` (`start_time` and `frequency`) in the trigger file and wait for that time → expect the workflow to run at that time. +- **Webhook trigger** → send a POST request with a flat JSON body to the URL that `trigger create` printed → expect the workflow to run with those inputs. +- **Each function** → after the workflow runs, confirm the side effect the function's code makes, such as a message posted or a datastore item written. + ### 3c. Confirm and report While the developer interacts, help them confirm it is working: -- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. +- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. For a Deno Slack SDK app, the same output shows each workflow step and function execution. - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the `block-kit` and `slack-api` skills to dig into the payload or method. Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail. diff --git a/claude-agent-sdk/skills-lock.json b/claude-agent-sdk/skills-lock.json index 6d0ca19..3afcbe9 100644 --- a/claude-agent-sdk/skills-lock.json +++ b/claude-agent-sdk/skills-lock.json @@ -3,75 +3,75 @@ "skills": { "block-kit": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/block-kit/SKILL.md", "computedHash": "04748a453ee9ad97263e82effb17f8ce6788cccc19375b386fc8023ba6708493", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "create-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/create-slack-app/SKILL.md", "computedHash": "34723cf63b151456471eac7bc46d0859dd9e968b4193b15ba3cb42e562d69aca", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "deploy-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/deploy-slack-app/SKILL.md", - "computedHash": "f228a11e02336bd1c5a1e0d04d3bf64e21c9c64ec868424f81aa0e132ecab1ba", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "9d253d439009934c2d48d8d7b852ed9eb7f236c3784a4a2a4e295e8d7b31c022", + "installMode": "copy" }, "slack-api": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-api/SKILL.md", "computedHash": "da79f0eee8d7af9c8247f1530328e794015a7b42e73fce2c82ee7fcd300b1a09", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-cli": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-cli/SKILL.md", - "computedHash": "bfa0d297a23cf0206366e241c69a0fd4240efa8bb34a1ff129b94fadee0d1a24", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "7ec4e33ac63ef195a100d02ed9e40e4347fd65eca4aca028897bd5199fc5e555", + "installMode": "copy" }, "slack-docs": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-docs/SKILL.md", "computedHash": "4c506e7b2fd40b268c8e2fcdf02bc072f33e4b32421cab7a1842b030d9ebacb3", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-messaging": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-messaging/SKILL.md", "computedHash": "4bb55059cf58a4614d896a0e8ad3421d8d5d0ceb76bc1fec6153914cae41934c", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-search": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-search/SKILL.md", "computedHash": "e3fe85c29469e157db02e0898b14c1532f9e35cbe239a814388c7cd2c1a24746", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "test-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/test-slack-app/SKILL.md", - "computedHash": "818e70481f7671d2cbc3e103631d626e4b29bc7520ffbfcfeffc6f920467850d", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "5208d0c2b35db012165885ab759e9ebcecf50f0a5092f888f80f1c2a5a70dd7e", + "installMode": "copy" } } } diff --git a/openai-agents-sdk/.agents/skills/deploy-slack-app/SKILL.md b/openai-agents-sdk/.agents/skills/deploy-slack-app/SKILL.md index 9e6148d..f9ccd36 100644 --- a/openai-agents-sdk/.agents/skills/deploy-slack-app/SKILL.md +++ b/openai-agents-sdk/.agents/skills/deploy-slack-app/SKILL.md @@ -1,13 +1,15 @@ --- name: deploy-slack-app -description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. +description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying a Deno Slack SDK app (workflows, functions, and triggers) to Slack's managed hosting, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. --- # Deploy Slack App Take a Slack app that already works locally and deploy it to a hosting provider as a separate Slack app, with its own app ID, that keeps running without the developer's machine. The local development app is unchanged, and **Step 5: Deploy** explains how the two coexist. This is the step after the `test-slack-app` skill confirms the app responds. -The mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. +A Deno Slack SDK app is the exception: it deploys to Slack's own managed hosting with plain `slack deploy`, and **Step 1b: Check for a Deno Slack SDK App** sends it to **Deploy a Deno Slack SDK App** instead of the provider flow. + +For the provider flow, the mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. Two supported providers, both running the app as a long-lived worker process: @@ -28,7 +30,19 @@ Load the `slack-cli` skill (with your skill tool, if you have one) before runnin This matters more than it looks. Some machines have an unrelated internal tool named `slack` on the path, and running that instead produces confusing failures well into the deploy. -### 1b. Confirm the App Uses Socket Mode +### 1b. Check for a Deno Slack SDK App + +Before reading the manifest for Socket Mode, check whether this is a Deno Slack SDK app. Any one of these is a match: + +- `.slack/hooks.json` has a `get-hooks` command that runs `deno_slack_hooks`. +- `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. +- The project has a `manifest.ts` that imports `Manifest` from `deno-slack-sdk`, usually beside `functions/`, `workflows/`, and `triggers/` folders. + +**A Deno Slack SDK app does not use this skill's provider flow.** Its functions run on Slack's managed hosting, and its manifest sets `socket_mode_enabled` to `false`, so **Step 1c: Confirm the App Uses Socket Mode** would wrongly stop it as a Request URL app. Skip the rest of Steps 1 to 8 and follow **Deploy a Deno Slack SDK App** below. Do not add a `deploy` hook or a Railway or Heroku script to it. + +If none of these match, continue with the next step. + +### 1c. Confirm the App Uses Socket Mode **Read the app's manifest rather than asking.** The project already declares which mode it uses, so a question here is redundant. Check `manifest.json` for `settings.socket_mode_enabled`. If `.slack/config.json` sets the manifest source to `remote`, there is no local file, so read it with `SLACK_CMD manifest info` instead. @@ -37,7 +51,7 @@ This matters more than it looks. Some machines have an unrelated internal tool n If the manifest is ambiguous, read the app's entrypoint. A Bolt for JavaScript app constructed with `socketMode: true` and an `appToken`, or a Bolt for Python app started through `SocketModeHandler`, is a Socket Mode app. -### 1c. Confirm the Runtime Is Supported +### 1d. Confirm the Runtime Is Supported This flow is verified on macOS and Linux. The deploy hook is a shell script, so a Windows developer needs a PowerShell equivalent that does not exist yet. On Windows, say so rather than letting the deploy fail partway through. WSL is a workable path in the meantime. Support may have shipped in a newer version of the Slack Skills Plugin, so ask the developer to update the plugin and try again. If they are already on the latest version, point them to to add a reaction or comment. @@ -197,6 +211,21 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD --- +## Deploy a Deno Slack SDK App + +Use this section instead of Steps 2 to 8 when **Step 1b: Check for a Deno Slack SDK App** found a Deno Slack SDK app. The `slack-cli` skill covers the CLI's commands generally. + +1. **Check the plan.** Deploying a Deno Slack SDK app needs a paid Slack plan or an upgraded developer sandbox. A basic sandbox does not support deploying to Slack's hosting, and the `create-slack-app` skill's **Basic sandboxes** note explains the upgrade. Point the developer to for the current terms. +2. **Choose a team.** Follow **Step 2b: Choose a Team** to pick the team from `SLACK_CMD auth list`. Never pick it yourself. For an Enterprise organization, the CLI asks which of the organization's workspaces the app can access the first time it installs the app, and a background shell cannot answer. Ask the developer which workspaces to grant, as **Step 5: Deploy** describes under "On an Enterprise organization", and add the same `--org-workspace-grant` value to each `run`, `deploy`, and `trigger create` command below. +3. **Confirm it works locally first.** Use the `test-slack-app` skill to run the app and start at least one workflow, as **Step 3: Confirm It Works Locally First** describes. A local run offers to create triggers, which a background shell cannot answer, so run `SLACK_CMD run --hide-triggers --team `, then create a local trigger with `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team ` unless `SLACK_CMD trigger list --app local --team --limit 50` already shows it. +4. **Deploy.** Run `SLACK_CMD deploy --skip-update --hide-triggers --team --app deployed` from the project root, with no `deploy` key in `.slack/hooks.json`. The CLI packages the app and deploys it to Slack, as a separate app with its own app ID in `.slack/apps.json`. `--hide-triggers` skips the CLI's offer to create triggers, which a background shell cannot answer, and the next step creates them. Add the workspace grant from step 2 for an Enterprise organization. Commit `.slack/apps.json` after the first deploy, so later deploys from any checkout reach the same app. +5. **Create the triggers.** Triggers created for the local app do not carry over to the deployed app. For each file in `triggers/`, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app deployed --team `. The output for a link trigger includes its shortcut URL. +6. **Verify.** Run `SLACK_CMD trigger list --app deployed --team --limit 50` to confirm the triggers exist. The list shows 4 triggers unless `--limit` is set. Stop the local `SLACK_CMD run`, start a workflow from one of the triggers, and read the deployed app's logs with `SLACK_CMD activity --app deployed --team `. +7. **Re-deploy.** Shipping a change is the same `SLACK_CMD deploy` command. The triggers stay in place. When a trigger file changes, update the existing trigger rather than creating a second one: find its ID with `SLACK_CMD trigger list --app deployed --team --limit 50`, then run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app deployed --team `. A new file gets `trigger create`, as in step 5. +8. **Tear down.** Name the deployed app ID from `.slack/apps.json` and ask once, then run `SLACK_CMD app delete --team --app deployed --force`. Leave the local app unless the developer asks for it too. + +--- + ## Notes **Serverless providers cannot host a Socket Mode app.** A Socket Mode app is a process that stays resident and holds an outbound websocket open. Vercel, AWS Lambda, and similar platforms run per-request functions with a maximum duration and no always-on process type, so there is nothing for the websocket to live in. When a developer asks for one of these, explain the constraint rather than attempting it. Hosting a Slack app on a serverless platform means a Request URL app, which this skill does not cover yet. @@ -205,6 +234,6 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD **The token handoff is not a documented contract.** The Slack CLI does not pass the tokens to the deploy hook explicitly. It sets them on its own process during app installation, and the hook script inherits them because it runs later in that same process. It works, and it only works for apps with no Slack-hosted function runtime, which covers every Bolt app. That is why each deploy script checks for both tokens and stops with a readable message instead of assuming they are present. -**Not `slack deploy` without a hook.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which is a different product for a different kind of app. The `slack-cli` skill covers the CLI's commands generally. +**Not `slack deploy` without a hook, for a Bolt app.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which hosts Deno Slack SDK apps, not Bolt apps. **Deploy a Deno Slack SDK App** covers that path. The `slack-cli` skill covers the CLI's commands generally. **Building the app comes first.** If there is no app yet, start with the `create-slack-app` skill and come back here once it runs locally. diff --git a/openai-agents-sdk/.agents/skills/slack-cli/SKILL.md b/openai-agents-sdk/.agents/skills/slack-cli/SKILL.md index 9034b02..9004c9e 100644 --- a/openai-agents-sdk/.agents/skills/slack-cli/SKILL.md +++ b/openai-agents-sdk/.agents/skills/slack-cli/SKILL.md @@ -35,7 +35,7 @@ $p = "$env:USERPROFILE\AppData\Local\slack-cli\bin\slack.exe" if (Test-Path $p) { $p } elseif (Test-Path "$env:USERPROFILE\.slack-cli\bin\slack.exe") { "$env:USERPROFILE\.slack-cli\bin\slack.exe" } ``` -If a path is returned, set `SLACK_CMD` to that **absolute path** and proceed to Step 2. Do not also run `_fingerprint`. +If a path is returned, set `SLACK_CMD` to that **absolute path** and go to **1d**. Do not also run `_fingerprint`. ### 1b. `slack` on PATH (verify with fingerprint) @@ -45,22 +45,31 @@ If 1a found nothing, try `slack` on PATH: slack _fingerprint 2>/dev/null ``` -If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and proceed. +If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and go to **1d**. ### 1c. Ask about an alias, or install -If 1b fails or returns a different value, ask the developer using AskUserQuestion: +If 1b fails or returns a different value, ask the developer one question using AskUserQuestion. The options cover both the alias and the install, so the developer chooses whether a remote script runs on their machine: -- "The `slack` command on your system doesn't appear to be the public Slack CLI. Do you have it installed under a different name or alias?" -- Options: "Yes, it's aliased as..." (let them provide the alias), "No, I need to install it" -- If they provide an alias, verify it with ` _fingerprint 2>/dev/null` and set `SLACK_CMD=`. -- If they need to install it, run: +- "I couldn't find the public Slack CLI on your system. Is it installed under a different name or alias, or should it be installed?" +- Options: + - "It's aliased as..." (let them provide the alias) + - "Install it for me" (runs the Slack CLI install script from `downloads.slack-edge.com`) + - "Show me the command, I'll install it" +- **Aliased:** verify it with ` _fingerprint 2>/dev/null`. If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=` and go to **1d**. Otherwise it isn't the public Slack CLI: tell the developer and ask again. +- **Install it for me:** run the install script, then re-run **1a**. The install script writes `~/.slack/bin/slack`. ```text curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash ``` - Then re-run **1a** — the install script will have written `~/.slack/bin/slack`. +- **Show me the command:** print the install command above and don't run it. Wait for the developer to say it's installed, then re-run **1a**. If 1a still finds nothing, tell them and ask this question again. + +Only run the install script when the developer picks "Install it for me". Any other answer, including one typed in by the developer, is not consent to run it. A typed answer like "I'll install it myself" takes the "Show me the command" path. + +### 1d. Continue where you left off + +Once `SLACK_CMD` is set, go back to the skill that sent you to this step, if one did. Continue right after the instruction that sent you here, not at that skill's next numbered step, because the rest of its current step may still apply (the `slack-api` skill checks authentication next, in the same step). For example, the `create-slack-app` skill continues at "Verify the CLI version". This matters most after the developer installs the CLI themselves, because the conversation paused there. If no other skill sent you here, go on to Step 2. **Common mistakes:** Don't use `which slack` to discover the binary — `which` resolves any shell alias and defeats the point of 1a. In Git Bash on Windows, use the POSIX probe form, not PowerShell. diff --git a/openai-agents-sdk/.agents/skills/test-slack-app/SKILL.md b/openai-agents-sdk/.agents/skills/test-slack-app/SKILL.md index 69f08ff..37fcd24 100644 --- a/openai-agents-sdk/.agents/skills/test-slack-app/SKILL.md +++ b/openai-agents-sdk/.agents/skills/test-slack-app/SKILL.md @@ -1,6 +1,6 @@ --- name: test-slack-app -description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces. Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. +description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces, or a Deno Slack SDK app's workflows, functions, and triggers (`slack trigger create`, `deno task test`). Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. --- # Test Slack App @@ -30,6 +30,7 @@ Testing belongs in a workspace nobody is working in: a developer sandbox for pre - **Explain it from the live docs, not from here.** Use the `slack-docs` skill to fetch and summarize , so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps. - **Find the current target.** Run `SLACK_CMD auth list` for the authenticated workspaces and their team IDs, and, from the project directory, `SLACK_CMD app list` for the apps already installed and their IDs. - **Confirm the target is safe.** The CLI cannot tell a sandbox, a Free Team, and a workspace full of real users apart, so ask the developer which one they are pointed at. A sandbox or a Free Team they created for this is fine. A workspace with coworkers in it is not: stop and get them onto one of the other two. +- **A Deno Slack SDK app needs a developer sandbox or a paid plan.** A project is a Deno Slack SDK app when its `.slack/hooks.json` runs `deno_slack_hooks`, or its `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. Slack requires a paid plan for workflow apps, so a Free Team won't work. Steer the developer to a sandbox, per . - **If there is no safe target yet**, set one up with the `create-slack-app` skill (**Step 3: Choose Where to Install the App**), which owns the ranked targets, the `sandbox list` / `sandbox create` flow, and the Developer Program links. Either path finishes in the browser, so have the developer come back here once the workspace exists and they have logged into it. ### 1c. Quick health check @@ -39,6 +40,8 @@ Catch obvious setup problems with the CLI's own validation before the slower han - `SLACK_CMD doctor`: checks the CLI, language runtime, and authentication. - `SLACK_CMD manifest validate`: run from the project directory if the app has a manifest, to confirm the app configuration is well-formed. +For a Deno Slack SDK app (spotted as **1b. Make sure there is a safe workspace to test in** describes), also run the project's own tests. If `deno.json` or `deno.jsonc` defines a `test` task, run `deno task test`. The Deno samples' function tests use `SlackFunctionTester` with a stubbed `fetch`, so they need no workspace. With no `test` task, run `deno test --allow-read` if the project has `*_test.ts` files. + Surface anything these flag before moving on. --- @@ -51,6 +54,8 @@ Whichever path you use below, first turn the app's log level up to debug so you Follow **Step 6: Running an App Locally (`slack run`)** in the `slack-cli` skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox or Free Team where nothing is installed yet. Once it is running, file changes auto-reload. +For a Deno Slack SDK app, there is usually no log-level variable to set. Pass `--activity-level debug` to `SLACK_CMD run` instead, which shows the app's activity logs, including `console.log` output from functions, at debug level. The local run also offers to create triggers, which a background shell cannot answer, so add `--hide-triggers` and create them in **3a. Read the source to find what the app listens for**. + ### Plain Bolt apps without the CLI (best-effort) If the app is a plain Bolt app started with `node` or `python` rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow: @@ -79,6 +84,12 @@ Read the app's listener code and list the interactions it registers. Depending o - **[App Home](https://docs.slack.dev/surfaces/app-home.md):** an `app_home_opened` handler or a published Home tab. - **[Assistant / agent](https://docs.slack.dev/ai.md):** an assistant or `assistant_thread_started` handler, common in the agent templates. +For a Deno Slack SDK app, read these instead: + +- **Workflows:** the `workflows` listed in `manifest.ts`, and the steps each one runs in `workflows/`. +- **Functions:** each `DefineFunction` in `functions/`, its inputs and outputs, and the Slack API calls or datastore writes it makes. +- **Triggers:** each file in `triggers/` and its `type`: shortcut (a link trigger), event, scheduled, or webhook. Triggers are not created when the app is installed. First run `SLACK_CMD trigger list --app local --team --limit 50` to see the triggers that already exist (the list shows 4 unless `--limit` is set). Check each file for placeholder values, such as a sample channel ID or a `start_time` already in the past. For a file with no trigger yet, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team `. For one that already has a trigger, run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app local --team `, so the test uses the file as it is now rather than a second copy. For an Enterprise organization, ask the developer which workspace the trigger is for, or whether all of them, and add `--org-workspace-grant ` or `--org-workspace-grant all`. Never choose `all` yourself. Triggers created for the local app do not carry over to a deployed app. + Name the concrete identifiers you find (the actual command and callback names), not placeholders. ### 3b. Turn each into a "do this, expect that" step @@ -93,11 +104,19 @@ For every registered interaction, give the developer a concrete step and what a - **Modal submit** (`view_submission`) → submit the modal → expect the confirmation or side effect. - **App Home** → click the app in the left sidebar to open its **Home** tab → expect the published view. +For a Deno Slack SDK app, each step starts a workflow from one of its triggers: + +- **Link (shortcut) trigger** → open the shortcut URL that `trigger create` printed, or paste it into a channel and click the button it unfurls into → expect the workflow's first step, such as its form. +- **Event trigger** → cause the event in a channel the trigger watches, such as posting a message or adding a reaction → expect the workflow to run. +- **Scheduled trigger** → read its `schedule` (`start_time` and `frequency`) in the trigger file and wait for that time → expect the workflow to run at that time. +- **Webhook trigger** → send a POST request with a flat JSON body to the URL that `trigger create` printed → expect the workflow to run with those inputs. +- **Each function** → after the workflow runs, confirm the side effect the function's code makes, such as a message posted or a datastore item written. + ### 3c. Confirm and report While the developer interacts, help them confirm it is working: -- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. +- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. For a Deno Slack SDK app, the same output shows each workflow step and function execution. - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the `block-kit` and `slack-api` skills to dig into the payload or method. Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail. diff --git a/openai-agents-sdk/.claude/skills/deploy-slack-app/SKILL.md b/openai-agents-sdk/.claude/skills/deploy-slack-app/SKILL.md index 9e6148d..f9ccd36 100644 --- a/openai-agents-sdk/.claude/skills/deploy-slack-app/SKILL.md +++ b/openai-agents-sdk/.claude/skills/deploy-slack-app/SKILL.md @@ -1,13 +1,15 @@ --- name: deploy-slack-app -description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. +description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying a Deno Slack SDK app (workflows, functions, and triggers) to Slack's managed hosting, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. --- # Deploy Slack App Take a Slack app that already works locally and deploy it to a hosting provider as a separate Slack app, with its own app ID, that keeps running without the developer's machine. The local development app is unchanged, and **Step 5: Deploy** explains how the two coexist. This is the step after the `test-slack-app` skill confirms the app responds. -The mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. +A Deno Slack SDK app is the exception: it deploys to Slack's own managed hosting with plain `slack deploy`, and **Step 1b: Check for a Deno Slack SDK App** sends it to **Deploy a Deno Slack SDK App** instead of the provider flow. + +For the provider flow, the mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. Two supported providers, both running the app as a long-lived worker process: @@ -28,7 +30,19 @@ Load the `slack-cli` skill (with your skill tool, if you have one) before runnin This matters more than it looks. Some machines have an unrelated internal tool named `slack` on the path, and running that instead produces confusing failures well into the deploy. -### 1b. Confirm the App Uses Socket Mode +### 1b. Check for a Deno Slack SDK App + +Before reading the manifest for Socket Mode, check whether this is a Deno Slack SDK app. Any one of these is a match: + +- `.slack/hooks.json` has a `get-hooks` command that runs `deno_slack_hooks`. +- `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. +- The project has a `manifest.ts` that imports `Manifest` from `deno-slack-sdk`, usually beside `functions/`, `workflows/`, and `triggers/` folders. + +**A Deno Slack SDK app does not use this skill's provider flow.** Its functions run on Slack's managed hosting, and its manifest sets `socket_mode_enabled` to `false`, so **Step 1c: Confirm the App Uses Socket Mode** would wrongly stop it as a Request URL app. Skip the rest of Steps 1 to 8 and follow **Deploy a Deno Slack SDK App** below. Do not add a `deploy` hook or a Railway or Heroku script to it. + +If none of these match, continue with the next step. + +### 1c. Confirm the App Uses Socket Mode **Read the app's manifest rather than asking.** The project already declares which mode it uses, so a question here is redundant. Check `manifest.json` for `settings.socket_mode_enabled`. If `.slack/config.json` sets the manifest source to `remote`, there is no local file, so read it with `SLACK_CMD manifest info` instead. @@ -37,7 +51,7 @@ This matters more than it looks. Some machines have an unrelated internal tool n If the manifest is ambiguous, read the app's entrypoint. A Bolt for JavaScript app constructed with `socketMode: true` and an `appToken`, or a Bolt for Python app started through `SocketModeHandler`, is a Socket Mode app. -### 1c. Confirm the Runtime Is Supported +### 1d. Confirm the Runtime Is Supported This flow is verified on macOS and Linux. The deploy hook is a shell script, so a Windows developer needs a PowerShell equivalent that does not exist yet. On Windows, say so rather than letting the deploy fail partway through. WSL is a workable path in the meantime. Support may have shipped in a newer version of the Slack Skills Plugin, so ask the developer to update the plugin and try again. If they are already on the latest version, point them to to add a reaction or comment. @@ -197,6 +211,21 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD --- +## Deploy a Deno Slack SDK App + +Use this section instead of Steps 2 to 8 when **Step 1b: Check for a Deno Slack SDK App** found a Deno Slack SDK app. The `slack-cli` skill covers the CLI's commands generally. + +1. **Check the plan.** Deploying a Deno Slack SDK app needs a paid Slack plan or an upgraded developer sandbox. A basic sandbox does not support deploying to Slack's hosting, and the `create-slack-app` skill's **Basic sandboxes** note explains the upgrade. Point the developer to for the current terms. +2. **Choose a team.** Follow **Step 2b: Choose a Team** to pick the team from `SLACK_CMD auth list`. Never pick it yourself. For an Enterprise organization, the CLI asks which of the organization's workspaces the app can access the first time it installs the app, and a background shell cannot answer. Ask the developer which workspaces to grant, as **Step 5: Deploy** describes under "On an Enterprise organization", and add the same `--org-workspace-grant` value to each `run`, `deploy`, and `trigger create` command below. +3. **Confirm it works locally first.** Use the `test-slack-app` skill to run the app and start at least one workflow, as **Step 3: Confirm It Works Locally First** describes. A local run offers to create triggers, which a background shell cannot answer, so run `SLACK_CMD run --hide-triggers --team `, then create a local trigger with `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team ` unless `SLACK_CMD trigger list --app local --team --limit 50` already shows it. +4. **Deploy.** Run `SLACK_CMD deploy --skip-update --hide-triggers --team --app deployed` from the project root, with no `deploy` key in `.slack/hooks.json`. The CLI packages the app and deploys it to Slack, as a separate app with its own app ID in `.slack/apps.json`. `--hide-triggers` skips the CLI's offer to create triggers, which a background shell cannot answer, and the next step creates them. Add the workspace grant from step 2 for an Enterprise organization. Commit `.slack/apps.json` after the first deploy, so later deploys from any checkout reach the same app. +5. **Create the triggers.** Triggers created for the local app do not carry over to the deployed app. For each file in `triggers/`, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app deployed --team `. The output for a link trigger includes its shortcut URL. +6. **Verify.** Run `SLACK_CMD trigger list --app deployed --team --limit 50` to confirm the triggers exist. The list shows 4 triggers unless `--limit` is set. Stop the local `SLACK_CMD run`, start a workflow from one of the triggers, and read the deployed app's logs with `SLACK_CMD activity --app deployed --team `. +7. **Re-deploy.** Shipping a change is the same `SLACK_CMD deploy` command. The triggers stay in place. When a trigger file changes, update the existing trigger rather than creating a second one: find its ID with `SLACK_CMD trigger list --app deployed --team --limit 50`, then run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app deployed --team `. A new file gets `trigger create`, as in step 5. +8. **Tear down.** Name the deployed app ID from `.slack/apps.json` and ask once, then run `SLACK_CMD app delete --team --app deployed --force`. Leave the local app unless the developer asks for it too. + +--- + ## Notes **Serverless providers cannot host a Socket Mode app.** A Socket Mode app is a process that stays resident and holds an outbound websocket open. Vercel, AWS Lambda, and similar platforms run per-request functions with a maximum duration and no always-on process type, so there is nothing for the websocket to live in. When a developer asks for one of these, explain the constraint rather than attempting it. Hosting a Slack app on a serverless platform means a Request URL app, which this skill does not cover yet. @@ -205,6 +234,6 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD **The token handoff is not a documented contract.** The Slack CLI does not pass the tokens to the deploy hook explicitly. It sets them on its own process during app installation, and the hook script inherits them because it runs later in that same process. It works, and it only works for apps with no Slack-hosted function runtime, which covers every Bolt app. That is why each deploy script checks for both tokens and stops with a readable message instead of assuming they are present. -**Not `slack deploy` without a hook.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which is a different product for a different kind of app. The `slack-cli` skill covers the CLI's commands generally. +**Not `slack deploy` without a hook, for a Bolt app.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which hosts Deno Slack SDK apps, not Bolt apps. **Deploy a Deno Slack SDK App** covers that path. The `slack-cli` skill covers the CLI's commands generally. **Building the app comes first.** If there is no app yet, start with the `create-slack-app` skill and come back here once it runs locally. diff --git a/openai-agents-sdk/.claude/skills/slack-cli/SKILL.md b/openai-agents-sdk/.claude/skills/slack-cli/SKILL.md index 9034b02..9004c9e 100644 --- a/openai-agents-sdk/.claude/skills/slack-cli/SKILL.md +++ b/openai-agents-sdk/.claude/skills/slack-cli/SKILL.md @@ -35,7 +35,7 @@ $p = "$env:USERPROFILE\AppData\Local\slack-cli\bin\slack.exe" if (Test-Path $p) { $p } elseif (Test-Path "$env:USERPROFILE\.slack-cli\bin\slack.exe") { "$env:USERPROFILE\.slack-cli\bin\slack.exe" } ``` -If a path is returned, set `SLACK_CMD` to that **absolute path** and proceed to Step 2. Do not also run `_fingerprint`. +If a path is returned, set `SLACK_CMD` to that **absolute path** and go to **1d**. Do not also run `_fingerprint`. ### 1b. `slack` on PATH (verify with fingerprint) @@ -45,22 +45,31 @@ If 1a found nothing, try `slack` on PATH: slack _fingerprint 2>/dev/null ``` -If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and proceed. +If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and go to **1d**. ### 1c. Ask about an alias, or install -If 1b fails or returns a different value, ask the developer using AskUserQuestion: +If 1b fails or returns a different value, ask the developer one question using AskUserQuestion. The options cover both the alias and the install, so the developer chooses whether a remote script runs on their machine: -- "The `slack` command on your system doesn't appear to be the public Slack CLI. Do you have it installed under a different name or alias?" -- Options: "Yes, it's aliased as..." (let them provide the alias), "No, I need to install it" -- If they provide an alias, verify it with ` _fingerprint 2>/dev/null` and set `SLACK_CMD=`. -- If they need to install it, run: +- "I couldn't find the public Slack CLI on your system. Is it installed under a different name or alias, or should it be installed?" +- Options: + - "It's aliased as..." (let them provide the alias) + - "Install it for me" (runs the Slack CLI install script from `downloads.slack-edge.com`) + - "Show me the command, I'll install it" +- **Aliased:** verify it with ` _fingerprint 2>/dev/null`. If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=` and go to **1d**. Otherwise it isn't the public Slack CLI: tell the developer and ask again. +- **Install it for me:** run the install script, then re-run **1a**. The install script writes `~/.slack/bin/slack`. ```text curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash ``` - Then re-run **1a** — the install script will have written `~/.slack/bin/slack`. +- **Show me the command:** print the install command above and don't run it. Wait for the developer to say it's installed, then re-run **1a**. If 1a still finds nothing, tell them and ask this question again. + +Only run the install script when the developer picks "Install it for me". Any other answer, including one typed in by the developer, is not consent to run it. A typed answer like "I'll install it myself" takes the "Show me the command" path. + +### 1d. Continue where you left off + +Once `SLACK_CMD` is set, go back to the skill that sent you to this step, if one did. Continue right after the instruction that sent you here, not at that skill's next numbered step, because the rest of its current step may still apply (the `slack-api` skill checks authentication next, in the same step). For example, the `create-slack-app` skill continues at "Verify the CLI version". This matters most after the developer installs the CLI themselves, because the conversation paused there. If no other skill sent you here, go on to Step 2. **Common mistakes:** Don't use `which slack` to discover the binary — `which` resolves any shell alias and defeats the point of 1a. In Git Bash on Windows, use the POSIX probe form, not PowerShell. diff --git a/openai-agents-sdk/.claude/skills/test-slack-app/SKILL.md b/openai-agents-sdk/.claude/skills/test-slack-app/SKILL.md index 69f08ff..37fcd24 100644 --- a/openai-agents-sdk/.claude/skills/test-slack-app/SKILL.md +++ b/openai-agents-sdk/.claude/skills/test-slack-app/SKILL.md @@ -1,6 +1,6 @@ --- name: test-slack-app -description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces. Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. +description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces, or a Deno Slack SDK app's workflows, functions, and triggers (`slack trigger create`, `deno task test`). Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. --- # Test Slack App @@ -30,6 +30,7 @@ Testing belongs in a workspace nobody is working in: a developer sandbox for pre - **Explain it from the live docs, not from here.** Use the `slack-docs` skill to fetch and summarize , so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps. - **Find the current target.** Run `SLACK_CMD auth list` for the authenticated workspaces and their team IDs, and, from the project directory, `SLACK_CMD app list` for the apps already installed and their IDs. - **Confirm the target is safe.** The CLI cannot tell a sandbox, a Free Team, and a workspace full of real users apart, so ask the developer which one they are pointed at. A sandbox or a Free Team they created for this is fine. A workspace with coworkers in it is not: stop and get them onto one of the other two. +- **A Deno Slack SDK app needs a developer sandbox or a paid plan.** A project is a Deno Slack SDK app when its `.slack/hooks.json` runs `deno_slack_hooks`, or its `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. Slack requires a paid plan for workflow apps, so a Free Team won't work. Steer the developer to a sandbox, per . - **If there is no safe target yet**, set one up with the `create-slack-app` skill (**Step 3: Choose Where to Install the App**), which owns the ranked targets, the `sandbox list` / `sandbox create` flow, and the Developer Program links. Either path finishes in the browser, so have the developer come back here once the workspace exists and they have logged into it. ### 1c. Quick health check @@ -39,6 +40,8 @@ Catch obvious setup problems with the CLI's own validation before the slower han - `SLACK_CMD doctor`: checks the CLI, language runtime, and authentication. - `SLACK_CMD manifest validate`: run from the project directory if the app has a manifest, to confirm the app configuration is well-formed. +For a Deno Slack SDK app (spotted as **1b. Make sure there is a safe workspace to test in** describes), also run the project's own tests. If `deno.json` or `deno.jsonc` defines a `test` task, run `deno task test`. The Deno samples' function tests use `SlackFunctionTester` with a stubbed `fetch`, so they need no workspace. With no `test` task, run `deno test --allow-read` if the project has `*_test.ts` files. + Surface anything these flag before moving on. --- @@ -51,6 +54,8 @@ Whichever path you use below, first turn the app's log level up to debug so you Follow **Step 6: Running an App Locally (`slack run`)** in the `slack-cli` skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox or Free Team where nothing is installed yet. Once it is running, file changes auto-reload. +For a Deno Slack SDK app, there is usually no log-level variable to set. Pass `--activity-level debug` to `SLACK_CMD run` instead, which shows the app's activity logs, including `console.log` output from functions, at debug level. The local run also offers to create triggers, which a background shell cannot answer, so add `--hide-triggers` and create them in **3a. Read the source to find what the app listens for**. + ### Plain Bolt apps without the CLI (best-effort) If the app is a plain Bolt app started with `node` or `python` rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow: @@ -79,6 +84,12 @@ Read the app's listener code and list the interactions it registers. Depending o - **[App Home](https://docs.slack.dev/surfaces/app-home.md):** an `app_home_opened` handler or a published Home tab. - **[Assistant / agent](https://docs.slack.dev/ai.md):** an assistant or `assistant_thread_started` handler, common in the agent templates. +For a Deno Slack SDK app, read these instead: + +- **Workflows:** the `workflows` listed in `manifest.ts`, and the steps each one runs in `workflows/`. +- **Functions:** each `DefineFunction` in `functions/`, its inputs and outputs, and the Slack API calls or datastore writes it makes. +- **Triggers:** each file in `triggers/` and its `type`: shortcut (a link trigger), event, scheduled, or webhook. Triggers are not created when the app is installed. First run `SLACK_CMD trigger list --app local --team --limit 50` to see the triggers that already exist (the list shows 4 unless `--limit` is set). Check each file for placeholder values, such as a sample channel ID or a `start_time` already in the past. For a file with no trigger yet, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team `. For one that already has a trigger, run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app local --team `, so the test uses the file as it is now rather than a second copy. For an Enterprise organization, ask the developer which workspace the trigger is for, or whether all of them, and add `--org-workspace-grant ` or `--org-workspace-grant all`. Never choose `all` yourself. Triggers created for the local app do not carry over to a deployed app. + Name the concrete identifiers you find (the actual command and callback names), not placeholders. ### 3b. Turn each into a "do this, expect that" step @@ -93,11 +104,19 @@ For every registered interaction, give the developer a concrete step and what a - **Modal submit** (`view_submission`) → submit the modal → expect the confirmation or side effect. - **App Home** → click the app in the left sidebar to open its **Home** tab → expect the published view. +For a Deno Slack SDK app, each step starts a workflow from one of its triggers: + +- **Link (shortcut) trigger** → open the shortcut URL that `trigger create` printed, or paste it into a channel and click the button it unfurls into → expect the workflow's first step, such as its form. +- **Event trigger** → cause the event in a channel the trigger watches, such as posting a message or adding a reaction → expect the workflow to run. +- **Scheduled trigger** → read its `schedule` (`start_time` and `frequency`) in the trigger file and wait for that time → expect the workflow to run at that time. +- **Webhook trigger** → send a POST request with a flat JSON body to the URL that `trigger create` printed → expect the workflow to run with those inputs. +- **Each function** → after the workflow runs, confirm the side effect the function's code makes, such as a message posted or a datastore item written. + ### 3c. Confirm and report While the developer interacts, help them confirm it is working: -- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. +- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. For a Deno Slack SDK app, the same output shows each workflow step and function execution. - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the `block-kit` and `slack-api` skills to dig into the payload or method. Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail. diff --git a/openai-agents-sdk/skills-lock.json b/openai-agents-sdk/skills-lock.json index 6d0ca19..3afcbe9 100644 --- a/openai-agents-sdk/skills-lock.json +++ b/openai-agents-sdk/skills-lock.json @@ -3,75 +3,75 @@ "skills": { "block-kit": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/block-kit/SKILL.md", "computedHash": "04748a453ee9ad97263e82effb17f8ce6788cccc19375b386fc8023ba6708493", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "create-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/create-slack-app/SKILL.md", "computedHash": "34723cf63b151456471eac7bc46d0859dd9e968b4193b15ba3cb42e562d69aca", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "deploy-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/deploy-slack-app/SKILL.md", - "computedHash": "f228a11e02336bd1c5a1e0d04d3bf64e21c9c64ec868424f81aa0e132ecab1ba", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "9d253d439009934c2d48d8d7b852ed9eb7f236c3784a4a2a4e295e8d7b31c022", + "installMode": "copy" }, "slack-api": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-api/SKILL.md", "computedHash": "da79f0eee8d7af9c8247f1530328e794015a7b42e73fce2c82ee7fcd300b1a09", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-cli": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-cli/SKILL.md", - "computedHash": "bfa0d297a23cf0206366e241c69a0fd4240efa8bb34a1ff129b94fadee0d1a24", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "7ec4e33ac63ef195a100d02ed9e40e4347fd65eca4aca028897bd5199fc5e555", + "installMode": "copy" }, "slack-docs": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-docs/SKILL.md", "computedHash": "4c506e7b2fd40b268c8e2fcdf02bc072f33e4b32421cab7a1842b030d9ebacb3", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-messaging": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-messaging/SKILL.md", "computedHash": "4bb55059cf58a4614d896a0e8ad3421d8d5d0ceb76bc1fec6153914cae41934c", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-search": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-search/SKILL.md", "computedHash": "e3fe85c29469e157db02e0898b14c1532f9e35cbe239a814388c7cd2c1a24746", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "test-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/test-slack-app/SKILL.md", - "computedHash": "818e70481f7671d2cbc3e103631d626e4b29bc7520ffbfcfeffc6f920467850d", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "5208d0c2b35db012165885ab759e9ebcecf50f0a5092f888f80f1c2a5a70dd7e", + "installMode": "copy" } } } diff --git a/pydantic-ai/.agents/skills/deploy-slack-app/SKILL.md b/pydantic-ai/.agents/skills/deploy-slack-app/SKILL.md index 9e6148d..f9ccd36 100644 --- a/pydantic-ai/.agents/skills/deploy-slack-app/SKILL.md +++ b/pydantic-ai/.agents/skills/deploy-slack-app/SKILL.md @@ -1,13 +1,15 @@ --- name: deploy-slack-app -description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. +description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying a Deno Slack SDK app (workflows, functions, and triggers) to Slack's managed hosting, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. --- # Deploy Slack App Take a Slack app that already works locally and deploy it to a hosting provider as a separate Slack app, with its own app ID, that keeps running without the developer's machine. The local development app is unchanged, and **Step 5: Deploy** explains how the two coexist. This is the step after the `test-slack-app` skill confirms the app responds. -The mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. +A Deno Slack SDK app is the exception: it deploys to Slack's own managed hosting with plain `slack deploy`, and **Step 1b: Check for a Deno Slack SDK App** sends it to **Deploy a Deno Slack SDK App** instead of the provider flow. + +For the provider flow, the mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. Two supported providers, both running the app as a long-lived worker process: @@ -28,7 +30,19 @@ Load the `slack-cli` skill (with your skill tool, if you have one) before runnin This matters more than it looks. Some machines have an unrelated internal tool named `slack` on the path, and running that instead produces confusing failures well into the deploy. -### 1b. Confirm the App Uses Socket Mode +### 1b. Check for a Deno Slack SDK App + +Before reading the manifest for Socket Mode, check whether this is a Deno Slack SDK app. Any one of these is a match: + +- `.slack/hooks.json` has a `get-hooks` command that runs `deno_slack_hooks`. +- `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. +- The project has a `manifest.ts` that imports `Manifest` from `deno-slack-sdk`, usually beside `functions/`, `workflows/`, and `triggers/` folders. + +**A Deno Slack SDK app does not use this skill's provider flow.** Its functions run on Slack's managed hosting, and its manifest sets `socket_mode_enabled` to `false`, so **Step 1c: Confirm the App Uses Socket Mode** would wrongly stop it as a Request URL app. Skip the rest of Steps 1 to 8 and follow **Deploy a Deno Slack SDK App** below. Do not add a `deploy` hook or a Railway or Heroku script to it. + +If none of these match, continue with the next step. + +### 1c. Confirm the App Uses Socket Mode **Read the app's manifest rather than asking.** The project already declares which mode it uses, so a question here is redundant. Check `manifest.json` for `settings.socket_mode_enabled`. If `.slack/config.json` sets the manifest source to `remote`, there is no local file, so read it with `SLACK_CMD manifest info` instead. @@ -37,7 +51,7 @@ This matters more than it looks. Some machines have an unrelated internal tool n If the manifest is ambiguous, read the app's entrypoint. A Bolt for JavaScript app constructed with `socketMode: true` and an `appToken`, or a Bolt for Python app started through `SocketModeHandler`, is a Socket Mode app. -### 1c. Confirm the Runtime Is Supported +### 1d. Confirm the Runtime Is Supported This flow is verified on macOS and Linux. The deploy hook is a shell script, so a Windows developer needs a PowerShell equivalent that does not exist yet. On Windows, say so rather than letting the deploy fail partway through. WSL is a workable path in the meantime. Support may have shipped in a newer version of the Slack Skills Plugin, so ask the developer to update the plugin and try again. If they are already on the latest version, point them to to add a reaction or comment. @@ -197,6 +211,21 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD --- +## Deploy a Deno Slack SDK App + +Use this section instead of Steps 2 to 8 when **Step 1b: Check for a Deno Slack SDK App** found a Deno Slack SDK app. The `slack-cli` skill covers the CLI's commands generally. + +1. **Check the plan.** Deploying a Deno Slack SDK app needs a paid Slack plan or an upgraded developer sandbox. A basic sandbox does not support deploying to Slack's hosting, and the `create-slack-app` skill's **Basic sandboxes** note explains the upgrade. Point the developer to for the current terms. +2. **Choose a team.** Follow **Step 2b: Choose a Team** to pick the team from `SLACK_CMD auth list`. Never pick it yourself. For an Enterprise organization, the CLI asks which of the organization's workspaces the app can access the first time it installs the app, and a background shell cannot answer. Ask the developer which workspaces to grant, as **Step 5: Deploy** describes under "On an Enterprise organization", and add the same `--org-workspace-grant` value to each `run`, `deploy`, and `trigger create` command below. +3. **Confirm it works locally first.** Use the `test-slack-app` skill to run the app and start at least one workflow, as **Step 3: Confirm It Works Locally First** describes. A local run offers to create triggers, which a background shell cannot answer, so run `SLACK_CMD run --hide-triggers --team `, then create a local trigger with `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team ` unless `SLACK_CMD trigger list --app local --team --limit 50` already shows it. +4. **Deploy.** Run `SLACK_CMD deploy --skip-update --hide-triggers --team --app deployed` from the project root, with no `deploy` key in `.slack/hooks.json`. The CLI packages the app and deploys it to Slack, as a separate app with its own app ID in `.slack/apps.json`. `--hide-triggers` skips the CLI's offer to create triggers, which a background shell cannot answer, and the next step creates them. Add the workspace grant from step 2 for an Enterprise organization. Commit `.slack/apps.json` after the first deploy, so later deploys from any checkout reach the same app. +5. **Create the triggers.** Triggers created for the local app do not carry over to the deployed app. For each file in `triggers/`, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app deployed --team `. The output for a link trigger includes its shortcut URL. +6. **Verify.** Run `SLACK_CMD trigger list --app deployed --team --limit 50` to confirm the triggers exist. The list shows 4 triggers unless `--limit` is set. Stop the local `SLACK_CMD run`, start a workflow from one of the triggers, and read the deployed app's logs with `SLACK_CMD activity --app deployed --team `. +7. **Re-deploy.** Shipping a change is the same `SLACK_CMD deploy` command. The triggers stay in place. When a trigger file changes, update the existing trigger rather than creating a second one: find its ID with `SLACK_CMD trigger list --app deployed --team --limit 50`, then run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app deployed --team `. A new file gets `trigger create`, as in step 5. +8. **Tear down.** Name the deployed app ID from `.slack/apps.json` and ask once, then run `SLACK_CMD app delete --team --app deployed --force`. Leave the local app unless the developer asks for it too. + +--- + ## Notes **Serverless providers cannot host a Socket Mode app.** A Socket Mode app is a process that stays resident and holds an outbound websocket open. Vercel, AWS Lambda, and similar platforms run per-request functions with a maximum duration and no always-on process type, so there is nothing for the websocket to live in. When a developer asks for one of these, explain the constraint rather than attempting it. Hosting a Slack app on a serverless platform means a Request URL app, which this skill does not cover yet. @@ -205,6 +234,6 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD **The token handoff is not a documented contract.** The Slack CLI does not pass the tokens to the deploy hook explicitly. It sets them on its own process during app installation, and the hook script inherits them because it runs later in that same process. It works, and it only works for apps with no Slack-hosted function runtime, which covers every Bolt app. That is why each deploy script checks for both tokens and stops with a readable message instead of assuming they are present. -**Not `slack deploy` without a hook.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which is a different product for a different kind of app. The `slack-cli` skill covers the CLI's commands generally. +**Not `slack deploy` without a hook, for a Bolt app.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which hosts Deno Slack SDK apps, not Bolt apps. **Deploy a Deno Slack SDK App** covers that path. The `slack-cli` skill covers the CLI's commands generally. **Building the app comes first.** If there is no app yet, start with the `create-slack-app` skill and come back here once it runs locally. diff --git a/pydantic-ai/.agents/skills/slack-cli/SKILL.md b/pydantic-ai/.agents/skills/slack-cli/SKILL.md index 9034b02..9004c9e 100644 --- a/pydantic-ai/.agents/skills/slack-cli/SKILL.md +++ b/pydantic-ai/.agents/skills/slack-cli/SKILL.md @@ -35,7 +35,7 @@ $p = "$env:USERPROFILE\AppData\Local\slack-cli\bin\slack.exe" if (Test-Path $p) { $p } elseif (Test-Path "$env:USERPROFILE\.slack-cli\bin\slack.exe") { "$env:USERPROFILE\.slack-cli\bin\slack.exe" } ``` -If a path is returned, set `SLACK_CMD` to that **absolute path** and proceed to Step 2. Do not also run `_fingerprint`. +If a path is returned, set `SLACK_CMD` to that **absolute path** and go to **1d**. Do not also run `_fingerprint`. ### 1b. `slack` on PATH (verify with fingerprint) @@ -45,22 +45,31 @@ If 1a found nothing, try `slack` on PATH: slack _fingerprint 2>/dev/null ``` -If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and proceed. +If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and go to **1d**. ### 1c. Ask about an alias, or install -If 1b fails or returns a different value, ask the developer using AskUserQuestion: +If 1b fails or returns a different value, ask the developer one question using AskUserQuestion. The options cover both the alias and the install, so the developer chooses whether a remote script runs on their machine: -- "The `slack` command on your system doesn't appear to be the public Slack CLI. Do you have it installed under a different name or alias?" -- Options: "Yes, it's aliased as..." (let them provide the alias), "No, I need to install it" -- If they provide an alias, verify it with ` _fingerprint 2>/dev/null` and set `SLACK_CMD=`. -- If they need to install it, run: +- "I couldn't find the public Slack CLI on your system. Is it installed under a different name or alias, or should it be installed?" +- Options: + - "It's aliased as..." (let them provide the alias) + - "Install it for me" (runs the Slack CLI install script from `downloads.slack-edge.com`) + - "Show me the command, I'll install it" +- **Aliased:** verify it with ` _fingerprint 2>/dev/null`. If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=` and go to **1d**. Otherwise it isn't the public Slack CLI: tell the developer and ask again. +- **Install it for me:** run the install script, then re-run **1a**. The install script writes `~/.slack/bin/slack`. ```text curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash ``` - Then re-run **1a** — the install script will have written `~/.slack/bin/slack`. +- **Show me the command:** print the install command above and don't run it. Wait for the developer to say it's installed, then re-run **1a**. If 1a still finds nothing, tell them and ask this question again. + +Only run the install script when the developer picks "Install it for me". Any other answer, including one typed in by the developer, is not consent to run it. A typed answer like "I'll install it myself" takes the "Show me the command" path. + +### 1d. Continue where you left off + +Once `SLACK_CMD` is set, go back to the skill that sent you to this step, if one did. Continue right after the instruction that sent you here, not at that skill's next numbered step, because the rest of its current step may still apply (the `slack-api` skill checks authentication next, in the same step). For example, the `create-slack-app` skill continues at "Verify the CLI version". This matters most after the developer installs the CLI themselves, because the conversation paused there. If no other skill sent you here, go on to Step 2. **Common mistakes:** Don't use `which slack` to discover the binary — `which` resolves any shell alias and defeats the point of 1a. In Git Bash on Windows, use the POSIX probe form, not PowerShell. diff --git a/pydantic-ai/.agents/skills/test-slack-app/SKILL.md b/pydantic-ai/.agents/skills/test-slack-app/SKILL.md index 69f08ff..37fcd24 100644 --- a/pydantic-ai/.agents/skills/test-slack-app/SKILL.md +++ b/pydantic-ai/.agents/skills/test-slack-app/SKILL.md @@ -1,6 +1,6 @@ --- name: test-slack-app -description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces. Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. +description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces, or a Deno Slack SDK app's workflows, functions, and triggers (`slack trigger create`, `deno task test`). Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. --- # Test Slack App @@ -30,6 +30,7 @@ Testing belongs in a workspace nobody is working in: a developer sandbox for pre - **Explain it from the live docs, not from here.** Use the `slack-docs` skill to fetch and summarize , so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps. - **Find the current target.** Run `SLACK_CMD auth list` for the authenticated workspaces and their team IDs, and, from the project directory, `SLACK_CMD app list` for the apps already installed and their IDs. - **Confirm the target is safe.** The CLI cannot tell a sandbox, a Free Team, and a workspace full of real users apart, so ask the developer which one they are pointed at. A sandbox or a Free Team they created for this is fine. A workspace with coworkers in it is not: stop and get them onto one of the other two. +- **A Deno Slack SDK app needs a developer sandbox or a paid plan.** A project is a Deno Slack SDK app when its `.slack/hooks.json` runs `deno_slack_hooks`, or its `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. Slack requires a paid plan for workflow apps, so a Free Team won't work. Steer the developer to a sandbox, per . - **If there is no safe target yet**, set one up with the `create-slack-app` skill (**Step 3: Choose Where to Install the App**), which owns the ranked targets, the `sandbox list` / `sandbox create` flow, and the Developer Program links. Either path finishes in the browser, so have the developer come back here once the workspace exists and they have logged into it. ### 1c. Quick health check @@ -39,6 +40,8 @@ Catch obvious setup problems with the CLI's own validation before the slower han - `SLACK_CMD doctor`: checks the CLI, language runtime, and authentication. - `SLACK_CMD manifest validate`: run from the project directory if the app has a manifest, to confirm the app configuration is well-formed. +For a Deno Slack SDK app (spotted as **1b. Make sure there is a safe workspace to test in** describes), also run the project's own tests. If `deno.json` or `deno.jsonc` defines a `test` task, run `deno task test`. The Deno samples' function tests use `SlackFunctionTester` with a stubbed `fetch`, so they need no workspace. With no `test` task, run `deno test --allow-read` if the project has `*_test.ts` files. + Surface anything these flag before moving on. --- @@ -51,6 +54,8 @@ Whichever path you use below, first turn the app's log level up to debug so you Follow **Step 6: Running an App Locally (`slack run`)** in the `slack-cli` skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox or Free Team where nothing is installed yet. Once it is running, file changes auto-reload. +For a Deno Slack SDK app, there is usually no log-level variable to set. Pass `--activity-level debug` to `SLACK_CMD run` instead, which shows the app's activity logs, including `console.log` output from functions, at debug level. The local run also offers to create triggers, which a background shell cannot answer, so add `--hide-triggers` and create them in **3a. Read the source to find what the app listens for**. + ### Plain Bolt apps without the CLI (best-effort) If the app is a plain Bolt app started with `node` or `python` rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow: @@ -79,6 +84,12 @@ Read the app's listener code and list the interactions it registers. Depending o - **[App Home](https://docs.slack.dev/surfaces/app-home.md):** an `app_home_opened` handler or a published Home tab. - **[Assistant / agent](https://docs.slack.dev/ai.md):** an assistant or `assistant_thread_started` handler, common in the agent templates. +For a Deno Slack SDK app, read these instead: + +- **Workflows:** the `workflows` listed in `manifest.ts`, and the steps each one runs in `workflows/`. +- **Functions:** each `DefineFunction` in `functions/`, its inputs and outputs, and the Slack API calls or datastore writes it makes. +- **Triggers:** each file in `triggers/` and its `type`: shortcut (a link trigger), event, scheduled, or webhook. Triggers are not created when the app is installed. First run `SLACK_CMD trigger list --app local --team --limit 50` to see the triggers that already exist (the list shows 4 unless `--limit` is set). Check each file for placeholder values, such as a sample channel ID or a `start_time` already in the past. For a file with no trigger yet, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team `. For one that already has a trigger, run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app local --team `, so the test uses the file as it is now rather than a second copy. For an Enterprise organization, ask the developer which workspace the trigger is for, or whether all of them, and add `--org-workspace-grant ` or `--org-workspace-grant all`. Never choose `all` yourself. Triggers created for the local app do not carry over to a deployed app. + Name the concrete identifiers you find (the actual command and callback names), not placeholders. ### 3b. Turn each into a "do this, expect that" step @@ -93,11 +104,19 @@ For every registered interaction, give the developer a concrete step and what a - **Modal submit** (`view_submission`) → submit the modal → expect the confirmation or side effect. - **App Home** → click the app in the left sidebar to open its **Home** tab → expect the published view. +For a Deno Slack SDK app, each step starts a workflow from one of its triggers: + +- **Link (shortcut) trigger** → open the shortcut URL that `trigger create` printed, or paste it into a channel and click the button it unfurls into → expect the workflow's first step, such as its form. +- **Event trigger** → cause the event in a channel the trigger watches, such as posting a message or adding a reaction → expect the workflow to run. +- **Scheduled trigger** → read its `schedule` (`start_time` and `frequency`) in the trigger file and wait for that time → expect the workflow to run at that time. +- **Webhook trigger** → send a POST request with a flat JSON body to the URL that `trigger create` printed → expect the workflow to run with those inputs. +- **Each function** → after the workflow runs, confirm the side effect the function's code makes, such as a message posted or a datastore item written. + ### 3c. Confirm and report While the developer interacts, help them confirm it is working: -- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. +- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. For a Deno Slack SDK app, the same output shows each workflow step and function execution. - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the `block-kit` and `slack-api` skills to dig into the payload or method. Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail. diff --git a/pydantic-ai/.claude/skills/deploy-slack-app/SKILL.md b/pydantic-ai/.claude/skills/deploy-slack-app/SKILL.md index 9e6148d..f9ccd36 100644 --- a/pydantic-ai/.claude/skills/deploy-slack-app/SKILL.md +++ b/pydantic-ai/.claude/skills/deploy-slack-app/SKILL.md @@ -1,13 +1,15 @@ --- name: deploy-slack-app -description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. +description: Use when a developer wants to deploy, host, or run a Slack app somewhere it keeps working after the local process stops, or mentions Railway, Heroku, `railway up`, `git push heroku`, `slack deploy`, a `deploy` hook in `.slack/hooks.json`, hosting a Socket Mode or Request URL (HTTP) Bolt app, deploying a Deno Slack SDK app (workflows, functions, and triggers) to Slack's managed hosting, deploying from Windows, graduating an app out of a developer sandbox, or tearing down a deployed app. Not for conceptual questions about how Slack app hosting works, which the `slack-docs` skill answers. --- # Deploy Slack App Take a Slack app that already works locally and deploy it to a hosting provider as a separate Slack app, with its own app ID, that keeps running without the developer's machine. The local development app is unchanged, and **Step 5: Deploy** explains how the two coexist. This is the step after the `test-slack-app` skill confirms the app responds. -The mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. +A Deno Slack SDK app is the exception: it deploys to Slack's own managed hosting with plain `slack deploy`, and **Step 1b: Check for a Deno Slack SDK App** sends it to **Deploy a Deno Slack SDK App** instead of the provider flow. + +For the provider flow, the mechanism is the Slack CLI's `deploy` hook. Adding a `deploy` key to the project's `.slack/hooks.json` replaces Slack's own hosted deployment with a script of your choosing, and the CLI runs that script _after_ it has created and installed the deployed app. That ordering is the whole reason this approach is worth using: the app's bot and app-level tokens are already in the script's environment by the time it runs, so nothing here has to prompt for a secret or store one. Two supported providers, both running the app as a long-lived worker process: @@ -28,7 +30,19 @@ Load the `slack-cli` skill (with your skill tool, if you have one) before runnin This matters more than it looks. Some machines have an unrelated internal tool named `slack` on the path, and running that instead produces confusing failures well into the deploy. -### 1b. Confirm the App Uses Socket Mode +### 1b. Check for a Deno Slack SDK App + +Before reading the manifest for Socket Mode, check whether this is a Deno Slack SDK app. Any one of these is a match: + +- `.slack/hooks.json` has a `get-hooks` command that runs `deno_slack_hooks`. +- `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. +- The project has a `manifest.ts` that imports `Manifest` from `deno-slack-sdk`, usually beside `functions/`, `workflows/`, and `triggers/` folders. + +**A Deno Slack SDK app does not use this skill's provider flow.** Its functions run on Slack's managed hosting, and its manifest sets `socket_mode_enabled` to `false`, so **Step 1c: Confirm the App Uses Socket Mode** would wrongly stop it as a Request URL app. Skip the rest of Steps 1 to 8 and follow **Deploy a Deno Slack SDK App** below. Do not add a `deploy` hook or a Railway or Heroku script to it. + +If none of these match, continue with the next step. + +### 1c. Confirm the App Uses Socket Mode **Read the app's manifest rather than asking.** The project already declares which mode it uses, so a question here is redundant. Check `manifest.json` for `settings.socket_mode_enabled`. If `.slack/config.json` sets the manifest source to `remote`, there is no local file, so read it with `SLACK_CMD manifest info` instead. @@ -37,7 +51,7 @@ This matters more than it looks. Some machines have an unrelated internal tool n If the manifest is ambiguous, read the app's entrypoint. A Bolt for JavaScript app constructed with `socketMode: true` and an `appToken`, or a Bolt for Python app started through `SocketModeHandler`, is a Socket Mode app. -### 1c. Confirm the Runtime Is Supported +### 1d. Confirm the Runtime Is Supported This flow is verified on macOS and Linux. The deploy hook is a shell script, so a Windows developer needs a PowerShell equivalent that does not exist yet. On Windows, say so rather than letting the deploy fail partway through. WSL is a workable path in the meantime. Support may have shipped in a newer version of the Slack Skills Plugin, so ask the developer to update the plugin and try again. If they are already on the latest version, point them to to add a reaction or comment. @@ -197,6 +211,21 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD --- +## Deploy a Deno Slack SDK App + +Use this section instead of Steps 2 to 8 when **Step 1b: Check for a Deno Slack SDK App** found a Deno Slack SDK app. The `slack-cli` skill covers the CLI's commands generally. + +1. **Check the plan.** Deploying a Deno Slack SDK app needs a paid Slack plan or an upgraded developer sandbox. A basic sandbox does not support deploying to Slack's hosting, and the `create-slack-app` skill's **Basic sandboxes** note explains the upgrade. Point the developer to for the current terms. +2. **Choose a team.** Follow **Step 2b: Choose a Team** to pick the team from `SLACK_CMD auth list`. Never pick it yourself. For an Enterprise organization, the CLI asks which of the organization's workspaces the app can access the first time it installs the app, and a background shell cannot answer. Ask the developer which workspaces to grant, as **Step 5: Deploy** describes under "On an Enterprise organization", and add the same `--org-workspace-grant` value to each `run`, `deploy`, and `trigger create` command below. +3. **Confirm it works locally first.** Use the `test-slack-app` skill to run the app and start at least one workflow, as **Step 3: Confirm It Works Locally First** describes. A local run offers to create triggers, which a background shell cannot answer, so run `SLACK_CMD run --hide-triggers --team `, then create a local trigger with `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team ` unless `SLACK_CMD trigger list --app local --team --limit 50` already shows it. +4. **Deploy.** Run `SLACK_CMD deploy --skip-update --hide-triggers --team --app deployed` from the project root, with no `deploy` key in `.slack/hooks.json`. The CLI packages the app and deploys it to Slack, as a separate app with its own app ID in `.slack/apps.json`. `--hide-triggers` skips the CLI's offer to create triggers, which a background shell cannot answer, and the next step creates them. Add the workspace grant from step 2 for an Enterprise organization. Commit `.slack/apps.json` after the first deploy, so later deploys from any checkout reach the same app. +5. **Create the triggers.** Triggers created for the local app do not carry over to the deployed app. For each file in `triggers/`, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app deployed --team `. The output for a link trigger includes its shortcut URL. +6. **Verify.** Run `SLACK_CMD trigger list --app deployed --team --limit 50` to confirm the triggers exist. The list shows 4 triggers unless `--limit` is set. Stop the local `SLACK_CMD run`, start a workflow from one of the triggers, and read the deployed app's logs with `SLACK_CMD activity --app deployed --team `. +7. **Re-deploy.** Shipping a change is the same `SLACK_CMD deploy` command. The triggers stay in place. When a trigger file changes, update the existing trigger rather than creating a second one: find its ID with `SLACK_CMD trigger list --app deployed --team --limit 50`, then run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app deployed --team `. A new file gets `trigger create`, as in step 5. +8. **Tear down.** Name the deployed app ID from `.slack/apps.json` and ask once, then run `SLACK_CMD app delete --team --app deployed --force`. Leave the local app unless the developer asks for it too. + +--- + ## Notes **Serverless providers cannot host a Socket Mode app.** A Socket Mode app is a process that stays resident and holds an outbound websocket open. Vercel, AWS Lambda, and similar platforms run per-request functions with a maximum duration and no always-on process type, so there is nothing for the websocket to live in. When a developer asks for one of these, explain the constraint rather than attempting it. Hosting a Slack app on a serverless platform means a Request URL app, which this skill does not cover yet. @@ -205,6 +234,6 @@ Leave `.slack/hooks.json` and the deploy script in place, so a later `SLACK_CMD **The token handoff is not a documented contract.** The Slack CLI does not pass the tokens to the deploy hook explicitly. It sets them on its own process during app installation, and the hook script inherits them because it runs later in that same process. It works, and it only works for apps with no Slack-hosted function runtime, which covers every Bolt app. That is why each deploy script checks for both tokens and stops with a readable message instead of assuming they are present. -**Not `slack deploy` without a hook.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which is a different product for a different kind of app. The `slack-cli` skill covers the CLI's commands generally. +**Not `slack deploy` without a hook, for a Bolt app.** With no `deploy` key in `.slack/hooks.json`, `SLACK_CMD deploy` targets Slack's own hosted infrastructure, which hosts Deno Slack SDK apps, not Bolt apps. **Deploy a Deno Slack SDK App** covers that path. The `slack-cli` skill covers the CLI's commands generally. **Building the app comes first.** If there is no app yet, start with the `create-slack-app` skill and come back here once it runs locally. diff --git a/pydantic-ai/.claude/skills/slack-cli/SKILL.md b/pydantic-ai/.claude/skills/slack-cli/SKILL.md index 9034b02..9004c9e 100644 --- a/pydantic-ai/.claude/skills/slack-cli/SKILL.md +++ b/pydantic-ai/.claude/skills/slack-cli/SKILL.md @@ -35,7 +35,7 @@ $p = "$env:USERPROFILE\AppData\Local\slack-cli\bin\slack.exe" if (Test-Path $p) { $p } elseif (Test-Path "$env:USERPROFILE\.slack-cli\bin\slack.exe") { "$env:USERPROFILE\.slack-cli\bin\slack.exe" } ``` -If a path is returned, set `SLACK_CMD` to that **absolute path** and proceed to Step 2. Do not also run `_fingerprint`. +If a path is returned, set `SLACK_CMD` to that **absolute path** and go to **1d**. Do not also run `_fingerprint`. ### 1b. `slack` on PATH (verify with fingerprint) @@ -45,22 +45,31 @@ If 1a found nothing, try `slack` on PATH: slack _fingerprint 2>/dev/null ``` -If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and proceed. +If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=slack` and go to **1d**. ### 1c. Ask about an alias, or install -If 1b fails or returns a different value, ask the developer using AskUserQuestion: +If 1b fails or returns a different value, ask the developer one question using AskUserQuestion. The options cover both the alias and the install, so the developer chooses whether a remote script runs on their machine: -- "The `slack` command on your system doesn't appear to be the public Slack CLI. Do you have it installed under a different name or alias?" -- Options: "Yes, it's aliased as..." (let them provide the alias), "No, I need to install it" -- If they provide an alias, verify it with ` _fingerprint 2>/dev/null` and set `SLACK_CMD=`. -- If they need to install it, run: +- "I couldn't find the public Slack CLI on your system. Is it installed under a different name or alias, or should it be installed?" +- Options: + - "It's aliased as..." (let them provide the alias) + - "Install it for me" (runs the Slack CLI install script from `downloads.slack-edge.com`) + - "Show me the command, I'll install it" +- **Aliased:** verify it with ` _fingerprint 2>/dev/null`. If it outputs `d41d8cd98f00b204e9800998ecf8427e`, set `SLACK_CMD=` and go to **1d**. Otherwise it isn't the public Slack CLI: tell the developer and ask again. +- **Install it for me:** run the install script, then re-run **1a**. The install script writes `~/.slack/bin/slack`. ```text curl -fsSL https://downloads.slack-edge.com/slack-cli/install.sh | bash ``` - Then re-run **1a** — the install script will have written `~/.slack/bin/slack`. +- **Show me the command:** print the install command above and don't run it. Wait for the developer to say it's installed, then re-run **1a**. If 1a still finds nothing, tell them and ask this question again. + +Only run the install script when the developer picks "Install it for me". Any other answer, including one typed in by the developer, is not consent to run it. A typed answer like "I'll install it myself" takes the "Show me the command" path. + +### 1d. Continue where you left off + +Once `SLACK_CMD` is set, go back to the skill that sent you to this step, if one did. Continue right after the instruction that sent you here, not at that skill's next numbered step, because the rest of its current step may still apply (the `slack-api` skill checks authentication next, in the same step). For example, the `create-slack-app` skill continues at "Verify the CLI version". This matters most after the developer installs the CLI themselves, because the conversation paused there. If no other skill sent you here, go on to Step 2. **Common mistakes:** Don't use `which slack` to discover the binary — `which` resolves any shell alias and defeats the point of 1a. In Git Bash on Windows, use the POSIX probe form, not PowerShell. diff --git a/pydantic-ai/.claude/skills/test-slack-app/SKILL.md b/pydantic-ai/.claude/skills/test-slack-app/SKILL.md index 69f08ff..37fcd24 100644 --- a/pydantic-ai/.claude/skills/test-slack-app/SKILL.md +++ b/pydantic-ai/.claude/skills/test-slack-app/SKILL.md @@ -1,6 +1,6 @@ --- name: test-slack-app -description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces. Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. +description: Use when a developer wants to test, try out, smoke-test, verify, or confirm that a Slack app built with the Slack CLI (or a plain Bolt app) actually works, by running it in a developer sandbox or a Free Team, never a workspace with real users, with `slack run` and exercising its real slash commands, shortcuts, events, actions, modals, App Home, and assistant surfaces, or a Deno Slack SDK app's workflows, functions, and triggers (`slack trigger create`, `deno task test`). Also covers `slack doctor` and `slack manifest validate` health checks before hands-on testing. --- # Test Slack App @@ -30,6 +30,7 @@ Testing belongs in a workspace nobody is working in: a developer sandbox for pre - **Explain it from the live docs, not from here.** Use the `slack-docs` skill to fetch and summarize , so the recommendation always reflects the current docs rather than a copy that drifts out of date. Tell the developer that Slack recommends a sandbox for building and testing apps. - **Find the current target.** Run `SLACK_CMD auth list` for the authenticated workspaces and their team IDs, and, from the project directory, `SLACK_CMD app list` for the apps already installed and their IDs. - **Confirm the target is safe.** The CLI cannot tell a sandbox, a Free Team, and a workspace full of real users apart, so ask the developer which one they are pointed at. A sandbox or a Free Team they created for this is fine. A workspace with coworkers in it is not: stop and get them onto one of the other two. +- **A Deno Slack SDK app needs a developer sandbox or a paid plan.** A project is a Deno Slack SDK app when its `.slack/hooks.json` runs `deno_slack_hooks`, or its `deno.json` or `deno.jsonc` imports `deno-slack-sdk`. Slack requires a paid plan for workflow apps, so a Free Team won't work. Steer the developer to a sandbox, per . - **If there is no safe target yet**, set one up with the `create-slack-app` skill (**Step 3: Choose Where to Install the App**), which owns the ranked targets, the `sandbox list` / `sandbox create` flow, and the Developer Program links. Either path finishes in the browser, so have the developer come back here once the workspace exists and they have logged into it. ### 1c. Quick health check @@ -39,6 +40,8 @@ Catch obvious setup problems with the CLI's own validation before the slower han - `SLACK_CMD doctor`: checks the CLI, language runtime, and authentication. - `SLACK_CMD manifest validate`: run from the project directory if the app has a manifest, to confirm the app configuration is well-formed. +For a Deno Slack SDK app (spotted as **1b. Make sure there is a safe workspace to test in** describes), also run the project's own tests. If `deno.json` or `deno.jsonc` defines a `test` task, run `deno task test`. The Deno samples' function tests use `SlackFunctionTester` with a stubbed `fetch`, so they need no workspace. With no `test` task, run `deno test --allow-read` if the project has `*_test.ts` files. + Surface anything these flag before moving on. --- @@ -51,6 +54,8 @@ Whichever path you use below, first turn the app's log level up to debug so you Follow **Step 6: Running an App Locally (`slack run`)** in the `slack-cli` skill to start the local dev server in the background. This also installs the app into the target workspace, which matters for a fresh sandbox or Free Team where nothing is installed yet. Once it is running, file changes auto-reload. +For a Deno Slack SDK app, there is usually no log-level variable to set. Pass `--activity-level debug` to `SLACK_CMD run` instead, which shows the app's activity logs, including `console.log` output from functions, at debug level. The local run also offers to create triggers, which a background shell cannot answer, so add `--hide-triggers` and create them in **3a. Read the source to find what the app listens for**. + ### Plain Bolt apps without the CLI (best-effort) If the app is a plain Bolt app started with `node` or `python` rather than the Slack CLI, this skill can still help, but the run path is best-effort and not the primary flow: @@ -79,6 +84,12 @@ Read the app's listener code and list the interactions it registers. Depending o - **[App Home](https://docs.slack.dev/surfaces/app-home.md):** an `app_home_opened` handler or a published Home tab. - **[Assistant / agent](https://docs.slack.dev/ai.md):** an assistant or `assistant_thread_started` handler, common in the agent templates. +For a Deno Slack SDK app, read these instead: + +- **Workflows:** the `workflows` listed in `manifest.ts`, and the steps each one runs in `workflows/`. +- **Functions:** each `DefineFunction` in `functions/`, its inputs and outputs, and the Slack API calls or datastore writes it makes. +- **Triggers:** each file in `triggers/` and its `type`: shortcut (a link trigger), event, scheduled, or webhook. Triggers are not created when the app is installed. First run `SLACK_CMD trigger list --app local --team --limit 50` to see the triggers that already exist (the list shows 4 unless `--limit` is set). Check each file for placeholder values, such as a sample channel ID or a `start_time` already in the past. For a file with no trigger yet, run `SLACK_CMD trigger create --trigger-def triggers/.ts --app local --team `. For one that already has a trigger, run `SLACK_CMD trigger update --trigger-id --trigger-def triggers/.ts --app local --team `, so the test uses the file as it is now rather than a second copy. For an Enterprise organization, ask the developer which workspace the trigger is for, or whether all of them, and add `--org-workspace-grant ` or `--org-workspace-grant all`. Never choose `all` yourself. Triggers created for the local app do not carry over to a deployed app. + Name the concrete identifiers you find (the actual command and callback names), not placeholders. ### 3b. Turn each into a "do this, expect that" step @@ -93,11 +104,19 @@ For every registered interaction, give the developer a concrete step and what a - **Modal submit** (`view_submission`) → submit the modal → expect the confirmation or side effect. - **App Home** → click the app in the left sidebar to open its **Home** tab → expect the published view. +For a Deno Slack SDK app, each step starts a workflow from one of its triggers: + +- **Link (shortcut) trigger** → open the shortcut URL that `trigger create` printed, or paste it into a channel and click the button it unfurls into → expect the workflow's first step, such as its form. +- **Event trigger** → cause the event in a channel the trigger watches, such as posting a message or adding a reaction → expect the workflow to run. +- **Scheduled trigger** → read its `schedule` (`start_time` and `frequency`) in the trigger file and wait for that time → expect the workflow to run at that time. +- **Webhook trigger** → send a POST request with a flat JSON body to the URL that `trigger create` printed → expect the workflow to run with those inputs. +- **Each function** → after the workflow runs, confirm the side effect the function's code makes, such as a message posted or a datastore item written. + ### 3c. Confirm and report While the developer interacts, help them confirm it is working: -- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. +- If the app runs under `slack run`, watch its logs (ask "show me the output from slack run") to confirm events arrive and to read any errors. For a Deno Slack SDK app, the same output shows each workflow step and function execution. - If a response looks wrong (a malformed message or Block Kit view, or an API error), use the `block-kit` and `slack-api` skills to dig into the payload or method. Close with a short summary: what you and the developer confirmed working, and what they should eyeball themselves. Remember this is manual checking: you are helping the developer watch the app respond, not producing an automated pass or fail. diff --git a/pydantic-ai/skills-lock.json b/pydantic-ai/skills-lock.json index 6d0ca19..3afcbe9 100644 --- a/pydantic-ai/skills-lock.json +++ b/pydantic-ai/skills-lock.json @@ -3,75 +3,75 @@ "skills": { "block-kit": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/block-kit/SKILL.md", "computedHash": "04748a453ee9ad97263e82effb17f8ce6788cccc19375b386fc8023ba6708493", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "create-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/create-slack-app/SKILL.md", "computedHash": "34723cf63b151456471eac7bc46d0859dd9e968b4193b15ba3cb42e562d69aca", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "deploy-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/deploy-slack-app/SKILL.md", - "computedHash": "f228a11e02336bd1c5a1e0d04d3bf64e21c9c64ec868424f81aa0e132ecab1ba", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "9d253d439009934c2d48d8d7b852ed9eb7f236c3784a4a2a4e295e8d7b31c022", + "installMode": "copy" }, "slack-api": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-api/SKILL.md", "computedHash": "da79f0eee8d7af9c8247f1530328e794015a7b42e73fce2c82ee7fcd300b1a09", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-cli": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-cli/SKILL.md", - "computedHash": "bfa0d297a23cf0206366e241c69a0fd4240efa8bb34a1ff129b94fadee0d1a24", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "7ec4e33ac63ef195a100d02ed9e40e4347fd65eca4aca028897bd5199fc5e555", + "installMode": "copy" }, "slack-docs": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-docs/SKILL.md", "computedHash": "4c506e7b2fd40b268c8e2fcdf02bc072f33e4b32421cab7a1842b030d9ebacb3", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-messaging": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-messaging/SKILL.md", "computedHash": "4bb55059cf58a4614d896a0e8ad3421d8d5d0ceb76bc1fec6153914cae41934c", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "slack-search": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/slack-search/SKILL.md", "computedHash": "e3fe85c29469e157db02e0898b14c1532f9e35cbe239a814388c7cd2c1a24746", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "installMode": "copy" }, "test-slack-app": { "source": "slackapi/slack-skills-plugin", + "commit": "766e933ec9d9cf7c63ba4da5567caa6c935418a9", "sourceType": "github", "skillPath": "skills/test-slack-app/SKILL.md", - "computedHash": "818e70481f7671d2cbc3e103631d626e4b29bc7520ffbfcfeffc6f920467850d", - "installMode": "copy", - "commit": "a6db580e584b44d723dda4f6c6657aa0d04bf4c1" + "computedHash": "5208d0c2b35db012165885ab759e9ebcecf50f0a5092f888f80f1c2a5a70dd7e", + "installMode": "copy" } } }