Repository navigation
feat(telemetry): track SDK version traits and upgrade posthog-node to v6 #1616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
34c4a16
261f1c9
96c492f
e4fcfb0
99ecdfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import type { LLMProvider } from '@posthog/warlock'; | |
| import { downloadSkill } from '@shared/skill-install'; | ||
| import type { SkillEntry } from '@shared/skill-menu'; | ||
| import { | ||
| DEFAULT_SKILL_TAG, | ||
| FRAMEWORK_KEY, | ||
| resolveTraitSkills, | ||
| type MatchKeys, | ||
|
|
@@ -31,38 +32,64 @@ export async function installTraitSkills({ | |
| matchKeys, | ||
| installDir, | ||
| triageProvider, | ||
| reportTelemetry = false, | ||
| signal, | ||
| }: { | ||
| entries: readonly SkillEntry[]; | ||
| matchKeys: MatchKeys; | ||
| installDir: string; | ||
| triageProvider: LLMProvider | undefined; | ||
| reportTelemetry?: boolean; | ||
| signal?: AbortSignal; | ||
| }): Promise<{ paths: string[]; aborted: boolean }> { | ||
| const paths: string[] = []; | ||
| if (signal?.aborted) return { paths, aborted: true }; | ||
|
|
||
| for (const skill of resolveTraitSkills(entries, matchKeys)) { | ||
| const matched = resolveTraitSkills(entries, matchKeys); | ||
| const resolvedIds: string[] = []; | ||
| const nonDefaultIds: string[] = []; | ||
| const failedIds: string[] = []; | ||
|
|
||
| for (const skill of matched) { | ||
| if (signal?.aborted) return { paths, aborted: true }; | ||
| const installed = await downloadSkill(skill, installDir, { | ||
| scan: (dir) => scanInstalledSkill(dir, triageProvider), | ||
| }); | ||
| if (signal?.aborted) return { paths, aborted: true }; | ||
| analytics.wizardCapture('sdk trait skill resolved', { | ||
| skill_id: skill.id, | ||
| installed: installed.success, | ||
| }); | ||
| if (!installed.success) { | ||
| failedIds.push(skill.id); | ||
| logToFile( | ||
| `[sdk-skills] unavailable ${skill.id}: ${ | ||
| installed.error ?? 'unknown error' | ||
| }`, | ||
| ); | ||
| continue; | ||
| } | ||
| resolvedIds.push(skill.id); | ||
| if (!skill.tags?.includes(DEFAULT_SKILL_TAG)) { | ||
| nonDefaultIds.push(skill.id); | ||
| } | ||
| const skillPath = path.join('.claude', 'skills', skill.id, 'SKILL.md'); | ||
| paths.push(skillPath); | ||
| logToFile(`[sdk-skills] installed ${skill.id} at ${skillPath}`); | ||
| } | ||
|
|
||
| const declaredSdks = matchKeys.posthogSdks ?? []; | ||
| if (reportTelemetry && (declaredSdks.length > 0 || matched.length > 0)) { | ||
| const matchedTags = new Set(matched.flatMap((skill) => skill.tags ?? [])); | ||
| const unmatchedSdks = declaredSdks.filter( | ||
| (sdk) => !matchedTags.has(`posthogSdks:${sdk}`), | ||
| ); | ||
| if (resolvedIds.length > 0) { | ||
| analytics.setTag('sdk_skills', resolvedIds.join(',')); | ||
| } | ||
| analytics.setTag('sdk_non_default_major', nonDefaultIds.length > 0); | ||
| analytics.wizardCapture('sdk skills resolved', { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new
|
||
| resolved_sdk_skill_ids: resolvedIds, | ||
| non_default_sdk_skill_ids: nonDefaultIds, | ||
| failed_sdk_skill_ids: failedIds, | ||
| unmatched_sdks: unmatchedSdks, | ||
| }); | ||
| } | ||
| return { paths, aborted: false }; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.