This repository was archived by the owner on Aug 6, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { Text } from "@components/text" ;
22import { TaskAutomationValidationError } from "@posthog/api-client/posthog-client" ;
3- import { parseSkillTemplateId } from "@posthog/core/automations/automationTemplatePresentation" ;
43import { Stack , useLocalSearchParams , useRouter } from "expo-router" ;
54import { useState } from "react" ;
65import {
@@ -21,6 +20,7 @@ import {
2120 useUpdateTaskAutomation ,
2221} from "@/features/tasks/hooks/useAutomations" ;
2322import { useTask } from "@/features/tasks/hooks/useTasks" ;
23+ import { parseSkillTemplateId } from "@/features/tasks/skills/skillTemplateIds" ;
2424import { useThemeColors } from "@/lib/theme" ;
2525
2626export default function AutomationDetailScreen ( ) {
Original file line number Diff line number Diff line change 11import { TaskAutomationValidationError } from "@posthog/api-client/posthog-client" ;
2- import { formatSkillTemplateId } from "@posthog/core/automations/automationTemplatePresentation" ;
32import { getCalendars } from "expo-localization" ;
43import { Stack , useLocalSearchParams , useRouter } from "expo-router" ;
54import { useMemo , useRef , useState } from "react" ;
@@ -15,6 +14,7 @@ import { Text } from "@/components/text";
1514import { AutomationForm } from "@/features/tasks/components/AutomationForm" ;
1615import { useCreateTaskAutomation } from "@/features/tasks/hooks/useAutomations" ;
1716import { useSkillStoreSkill } from "@/features/tasks/skills/hooks" ;
17+ import { formatSkillTemplateId } from "@/features/tasks/skills/skillTemplateIds" ;
1818import { useScreenInsets } from "@/hooks/useScreenInsets" ;
1919import { useThemeColors } from "@/lib/theme" ;
2020
Original file line number Diff line number Diff line change 11import { Text } from "@components/text" ;
22import type { TaskAutomation } from "@posthog/api-client/posthog-client" ;
33import { formatAutomationScheduleSummary } from "@posthog/core/automations/automationSchedule" ;
4- import { getAutomationTemplatePresentation } from "@posthog/core/automations/automationTemplatePresentation" ;
54import type { TaskRun } from "@posthog/shared" ;
65import { ActivityIndicator , Pressable , View } from "react-native" ;
6+ import { getAutomationTemplatePresentation } from "../utils/automationTemplatePresentation" ;
77import { AutomationStatusBadge } from "./AutomationStatusBadge" ;
88
99interface AutomationDetailProps {
Original file line number Diff line number Diff line change 11import { Text } from "@components/text" ;
22import type { TaskAutomation } from "@posthog/api-client/posthog-client" ;
33import { formatAutomationScheduleSummary } from "@posthog/core/automations/automationSchedule" ;
4- import { getAutomationTemplatePresentation } from "@posthog/core/automations/automationTemplatePresentation" ;
54import type { TaskRun } from "@posthog/shared" ;
65import { format , formatDistanceToNow } from "date-fns" ;
76import { memo } from "react" ;
87import { Pressable , View } from "react-native" ;
8+ import { getAutomationTemplatePresentation } from "../utils/automationTemplatePresentation" ;
99import { AutomationStatusBadge } from "./AutomationStatusBadge" ;
1010
1111interface AutomationItemProps {
Original file line number Diff line number Diff line change 1+ export const SKILL_TEMPLATE_ID_PREFIX = "llm-skill:" ;
2+
3+ export function formatSkillTemplateId ( skillName : string ) : string {
4+ return `${ SKILL_TEMPLATE_ID_PREFIX } ${ skillName . trim ( ) } ` ;
5+ }
6+
7+ export function parseSkillTemplateId (
8+ templateId : string | null | undefined ,
9+ ) : string | null {
10+ if ( ! templateId ?. startsWith ( SKILL_TEMPLATE_ID_PREFIX ) ) return null ;
11+ const skillName = templateId . slice ( SKILL_TEMPLATE_ID_PREFIX . length ) . trim ( ) ;
12+ return skillName || null ;
13+ }
Original file line number Diff line number Diff line change 1- import { getAutomationTemplatePresentation } from "@posthog/core/automations/automationTemplatePresentation" ;
21import { describe , expect , it } from "vitest" ;
2+ import { getAutomationTemplatePresentation } from "./automationTemplatePresentation" ;
33
44describe ( "automationTemplatePresentation" , ( ) => {
55 it ( "prefers repository context when one exists for skill-backed automations" , ( ) => {
Original file line number Diff line number Diff line change 11import type { TaskAutomation } from "@posthog/api-client/posthog-client" ;
2-
3- export const SKILL_TEMPLATE_ID_PREFIX = "llm-skill:" ;
4-
5- export function formatSkillTemplateId ( skillName : string ) : string {
6- return `${ SKILL_TEMPLATE_ID_PREFIX } ${ skillName . trim ( ) } ` ;
7- }
8-
9- export function parseSkillTemplateId (
10- templateId : string | null | undefined ,
11- ) : string | null {
12- if ( ! templateId ?. startsWith ( SKILL_TEMPLATE_ID_PREFIX ) ) return null ;
13- const skillName = templateId . slice ( SKILL_TEMPLATE_ID_PREFIX . length ) . trim ( ) ;
14- return skillName || null ;
15- }
2+ import { parseSkillTemplateId } from "../skills/skillTemplateIds" ;
163
174export interface AutomationTemplatePresentation {
185 templateName : string | null ;
19- repositoryLabel : string | null ;
206 contextLabel : string | null ;
7+ repositoryLabel : string | null ;
218 secondaryLabel : string ;
229}
2310
@@ -30,8 +17,8 @@ export function getAutomationTemplatePresentation(
3017 return {
3118 templateName :
3219 skillName ?? ( automation . template_id ? "Template automation" : null ) ,
33- repositoryLabel,
3420 contextLabel,
21+ repositoryLabel,
3522 secondaryLabel : repositoryLabel ?? contextLabel ?? "No repository context" ,
3623 } ;
3724}
You can’t perform that action at this time.
0 commit comments