:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { defineCommand } from '@/core/command'
import { describeAliases, describeCommands, describeGlobalOptions } from '@/core/manifest'
import { VERSION } from '@/version'
export default defineCommand({
description: 'List every command, for agents and scripts',
notes: 'Agents can learn the whole CLI from one call: every command, its arguments, options and scopes.',
examples: ['hog commands -o json'],
run: ({ ctx }) => ({
cli: 'hog',
version: VERSION,
agent: ctx.mode.agent ?? null,
agentReason: ctx.mode.agentReason,
globalOptions: describeGlobalOptions(),
commands: describeCommands(ctx.tree),
aliases: describeAliases(ctx.tree),
}),
human({ result, out }) {
const width = Math.max(...result.commands.map((entry) => entry.name.length)) + 2
for (const entry of result.commands) {
const use = entry.use ? out.style(` (use ${entry.use})`, 'dim') : ''
out.line(` ${entry.name.padEnd(width)}${entry.description}${use}`)
}
},
})