Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { mcpCommand } from './src/commands/mcp';
import { mcpAnalyticsCommand } from './src/commands/mcp-analytics';
import { auditCommand } from './src/commands/audit';
import { doctorCommand } from './src/commands/doctor';
import { ingestionWarningsCommand } from './src/commands/ingestion-warnings';
import { migrateCommand } from './src/commands/migrate';
import { revenueCommand } from './src/commands/revenue';
import { warehouseCommand } from './src/commands/warehouse';
Expand Down Expand Up @@ -66,6 +67,7 @@ Wizard.use(basicIntegrationCommand)
.use(cliCommand)
.use(auditCommand)
.use(doctorCommand)
.use(ingestionWarningsCommand)
.use(migrateCommand)
.use(revenueCommand)
.use(warehouseCommand)
Expand Down
15 changes: 15 additions & 0 deletions src/commands/ingestion-warnings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { ingestionWarningsConfig } from '@lib/programs/ingestion-warnings/index';

import type { Command } from './command';
import { nativeCommandFactory } from './factories/native-command-factory';

/**
* `wizard ingestion-warnings` — flat skill command.
*
* Diagnoses the ingestion warnings firing on the user's PostHog project and
* fixes the instrumentation producing them. Stays flat: there's a single
* thing to do here, not a family of choices.
*/
export const ingestionWarningsCommand: Command = nativeCommandFactory(
ingestionWarningsConfig,
);
39 changes: 39 additions & 0 deletions src/lib/programs/ingestion-warnings/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type { AbortCase } from '@lib/agent/agent-runner';
import { createSkillProgram } from '@lib/programs/agent-skill/index';

/**
* `[ABORT] <reason>` cases the ingestion-warnings skill can emit.
* Kept in sync with the abort reason declared in the context-mill skill's
* `description.md` / `references/1-triage.md`.
*/
export const INGESTION_WARNINGS_ABORT_CASES: AbortCase[] = [
{
// Skill emits: [ABORT] Could not read ingestion warnings and no PostHog instrumentation found to scan
match:
/^could not read ingestion warnings and no posthog instrumentation found to scan$/i,
message: 'No ingestion warnings to work from',
body:
"The wizard couldn't read this project's ingestion warnings and found " +
'no PostHog SDK usage in this directory to scan for the patterns that ' +
'cause them. Run this command from the root of the project that sends ' +
'events to PostHog, signed in to the right project.',
docsUrl: 'https://posthog.com/docs/data/ingestion-warnings',
},
];

export const ingestionWarningsConfig = createSkillProgram({
skillId: 'ingestion-warnings',
command: 'ingestion-warnings',
id: 'ingestion-warnings',
description:
"Diagnose and fix the instrumentation behind your project's ingestion warnings",
integrationLabel: 'ingestion-warnings',
successMessage:
'Ingestion warnings triaged! See ./posthog-ingestion-warnings-report.md',
reportFile: 'posthog-ingestion-warnings-report.md',
docsUrl: 'https://posthog.com/docs/data/ingestion-warnings',
spinnerMessage: 'Diagnosing ingestion warnings...',
estimatedDurationMinutes: 5,
abortCases: INGESTION_WARNINGS_ABORT_CASES,
requires: ['posthog-integration'],
});
3 changes: 3 additions & 0 deletions src/lib/programs/program-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { warehouseSourceConfig } from './warehouse-source/index.js';
import { auditConfig } from './audit/index.js';
import { eventsAuditConfig } from './events-audit/index.js';
import { posthogDoctorConfig } from './posthog-doctor/index.js';
import { ingestionWarningsConfig } from './ingestion-warnings/index.js';
import { webAnalyticsDoctorConfig } from './web-analytics-doctor/index.js';
import { migrationConfig } from './migration/index.js';
import { errorTrackingUploadSourceMapsConfig } from './error-tracking-upload-source-maps/index.js';
Expand Down Expand Up @@ -70,6 +71,7 @@ export const PROGRAM_REGISTRY = [
auditConfig,
eventsAuditConfig,
posthogDoctorConfig,
ingestionWarningsConfig,
webAnalyticsDoctorConfig,
migrationConfig,
selfDrivingConfig,
Expand All @@ -95,6 +97,7 @@ export const Program = {
Audit: auditConfig.id,
EventsAudit: eventsAuditConfig.id,
PosthogDoctor: posthogDoctorConfig.id,
IngestionWarnings: ingestionWarningsConfig.id,
WebAnalyticsDoctor: webAnalyticsDoctorConfig.id,
SelfDriving: selfDrivingConfig.id,
AgentSkill: agentSkillConfig.id,
Expand Down
Loading