Skip to content

Commit 27b8022

Browse files
[dev] [Marfuen] mariano/more-4 (#1584)
* chore(tasks): remove console logs and add feature flag for automation * chore: return a nicer message at the end of the chat --------- Co-authored-by: Mariano Fuentes <marfuen98@gmail.com>
1 parent f038059 commit 27b8022

3 files changed

Lines changed: 34 additions & 19 deletions

File tree

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/components/TaskPropertiesSidebar.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { Control, Departments, Member, Task, TaskFrequency, TaskStatus, Use
55
import { format } from 'date-fns';
66
import { Sparkles } from 'lucide-react';
77
import Link from 'next/link';
8+
import { useFeatureFlagEnabled } from 'posthog-js/react';
89
import { useState } from 'react';
910
import { TaskStatusIndicator } from '../../components/TaskStatusIndicator';
1011
import { PropertySelector } from './PropertySelector';
@@ -32,6 +33,7 @@ export function TaskPropertiesSidebar({
3233
orgId,
3334
}: TaskPropertiesSidebarProps) {
3435
const [dropdownOpen, setDropdownOpen] = useState(false);
36+
const isTaskAutomationEnabled = useFeatureFlagEnabled('is-task-automation-enabled');
3537

3638
return (
3739
<div className="space-y-4">
@@ -262,17 +264,19 @@ export function TaskPropertiesSidebar({
262264
</div>
263265

264266
{/* Automation Button */}
265-
<div className="mt-6">
266-
<Link href={`/${orgId}/tasks/${task.id}/automation`} className="block">
267-
<Button
268-
className="w-full bg-primary text-primary-foreground hover:bg-primary/90"
269-
size="sm"
270-
>
271-
<Sparkles className="mr-2 h-4 w-4" />
272-
AI Automation
273-
</Button>
274-
</Link>
275-
</div>
267+
{isTaskAutomationEnabled && (
268+
<div className="mt-6">
269+
<Link href={`/${orgId}/tasks/${task.id}/automation`} className="block">
270+
<Button
271+
className="w-full bg-primary text-primary-foreground hover:bg-primary/90"
272+
size="sm"
273+
>
274+
<Sparkles className="mr-2 h-4 w-4" />
275+
AI Automation
276+
</Button>
277+
</Link>
278+
</div>
279+
)}
276280
</div>
277281
);
278282
}

apps/app/src/app/(app)/[orgId]/tasks/[taskId]/page.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@ export default async function TaskPage({
1111
}: {
1212
params: Promise<{ taskId: string; orgId: string; locale: string }>;
1313
}) {
14-
console.log('[TaskPage] Starting page render');
1514
const { taskId, orgId } = await params;
16-
console.log('[TaskPage] Params extracted:', { taskId, orgId });
17-
console.log('[TaskPage] Getting session');
1815
const session = await auth.api.getSession({
1916
headers: await headers(),
2017
});
21-
console.log('[TaskPage] Session obtained, fetching data');
2218

2319
const [task, members] = await Promise.all([getTask(taskId, session), getMembers(orgId, session)]);
2420

@@ -30,15 +26,13 @@ export default async function TaskPage({
3026
}
3127

3228
const getTask = async (taskId: string, session: Session) => {
33-
console.log('[getTask] Starting task fetch for:', taskId);
3429
const activeOrgId = session?.session.activeOrganizationId;
3530

3631
if (!activeOrgId) {
3732
console.warn('Could not determine active organization ID in getTask');
3833
return null;
3934
}
4035

41-
console.log('[getTask] Querying database for task');
4236
try {
4337
const task = await db.task.findUnique({
4438
where: {
@@ -50,7 +44,6 @@ const getTask = async (taskId: string, session: Session) => {
5044
},
5145
});
5246

53-
console.log('[getTask] Database query successful');
5447
return task;
5548
} catch (error) {
5649
console.error('[getTask] Database query failed:', error);

apps/app/src/app/api/tasks-automations/chat/automation-prompt.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ Before finalizing, verify ALL of the following:
110110
1. Generate the automation script based on requirements
111111
2. Use the `storeToS3` tool to save the automation
112112
3. Use actual organization and task IDs from ACTUAL_VALUES_JSON
113-
4. Reply with ONLY a brief confirmation focused on WHAT the automation does (not HOW it's built)
113+
4. Send a final message with:
114+
- Brief confirmation that automation was created
115+
- Quick breakdown of what the automation does (2-3 bullet points)
116+
- What data it will return/report
114117
5. NEVER mention technical details like Lambda, S3, file paths, or code in your responses
115118
116119
# AVAILABLE TOOLS
@@ -164,6 +167,21 @@ I'll create an automation that checks your GitHub repository for Dependabot conf
164167
I'll create a Lambda that calls the GitHub REST API and save it to S3.
165168
```
166169
170+
## Final Confirmation Message Format:
171+
172+
After creating the automation, send a message like this:
173+
174+
```
175+
✓ Created your automation! Here's what it does:
176+
177+
• Connects to your GitHub repository using your GITHUB_TOKEN
178+
• Checks if Dependabot is enabled by looking for .github/dependabot.yml
179+
• Scans vulnerability alerts settings in the repository configuration
180+
• Returns a report showing Dependabot status and any configuration details found
181+
182+
You can now test this automation to see it in action.
183+
```
184+
167185
# Example Interaction
168186
169187
User: "I need to automatically download invoices from our vendor portal every month"

0 commit comments

Comments
 (0)