install-slack-app.ts
commands/install-slack-app/install-slack-app.ts
31
Lines
877
Bytes
1
Exports
4
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file lives in the command layer. It likely turns a user action into concrete program behavior.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with commands, integrations. It contains 31 lines, 4 detected imports, and 1 detected exports.
Important relationships
Detected exports
call
Keywords
browserslack_app_urlcurrentlocalcommandresultlogeventopenbrowserutilssaveglobalconfigslackslackappinstallcount
Detected imports
../../commands.js../../services/analytics/index.js../../utils/browser.js../../utils/config.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
import type { LocalCommandResult } from '../../commands.js'
import { logEvent } from '../../services/analytics/index.js'
import { openBrowser } from '../../utils/browser.js'
import { saveGlobalConfig } from '../../utils/config.js'
const SLACK_APP_URL = 'https://slack.com/marketplace/A08SF47R6P4-claude'
export async function call(): Promise<LocalCommandResult> {
logEvent('tengu_install_slack_app_clicked', {})
// Track that user has clicked to install
saveGlobalConfig(current => ({
...current,
slackAppInstallCount: (current.slackAppInstallCount ?? 0) + 1,
}))
const success = await openBrowser(SLACK_APP_URL)
if (success) {
return {
type: 'text',
value: 'Opening Slack app installation page in browser…',
}
} else {
return {
type: 'text',
value: `Couldn't open browser. Visit: ${SLACK_APP_URL}`,
}
}
}