-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add organization flow with slack message
- Loading branch information
Showing
7 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { execute } from 'flows-ai' | ||
import { sequence } from 'flows-ai/flows' | ||
|
||
import { githubAgent, slackAgent } from './agents' | ||
import { githubProjectHealthAnalysisFlow } from './flows' | ||
|
||
const projectName = process.argv[2] | ||
|
||
if (!projectName) { | ||
throw new Error( | ||
'Please provide a project name, e.g.: bun run-project-analysis.ts facebook/react-native' | ||
) | ||
} | ||
|
||
if (!process.env['SLACK_API_TOKEN']) { | ||
throw new Error('Please set SLACK_API_TOKEN environment variable.') | ||
} | ||
|
||
const channelId = process.env['SLACK_CHANNEL_ID'] | ||
if (!channelId) { | ||
throw new Error('Please set SLACK_CHANNEL_ID environment variable.') | ||
} | ||
|
||
/** | ||
* In this example, we run already defined `githubProjectHealthAnalysisFlow`, | ||
* and then, we send the report to Slack. | ||
*/ | ||
const response = await execute( | ||
sequence([ | ||
githubProjectHealthAnalysisFlow, | ||
{ | ||
agent: 'slackAgent', | ||
input: `Send the report to the channel "${channelId}"`, | ||
}, | ||
]), | ||
{ | ||
agents: { | ||
githubAgent, | ||
slackAgent, | ||
}, | ||
input: projectName, | ||
onFlowStart: (flow) => { | ||
console.log('Executing', flow.agent.name) | ||
}, | ||
} | ||
) | ||
|
||
console.log(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters