Skip to content

: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.

chore(hogvm): move the remaining callers to bin/hoglang and drop bin/hog (#124302)

Rafael Audibertad692c4f7797
diff --git a/.github/scripts/trunk-impacted-targets.js b/.github/scripts/trunk-impacted-targets.js
index 6f99db6b73f3..96604288de77 100644
--- a/.github/scripts/trunk-impacted-targets.js
+++ b/.github/scripts/trunk-impacted-targets.js
@@ -722,8 +722,6 @@ const TRIPWIRE_RULES = [
// report_test_timings, the dockerignore check runs in container-images-ci,
// and the sandbox scripts are baked into the sandbox image; all of those
// sit on the fullstack lanes already.
- ['bin/hog', FULLSTACK],
- ['bin/hoge', FULLSTACK],
['bin/hoglang', FULLSTACK],
['bin/report-jest-timings', FULLSTACK],
['bin/render-jest-timings-example', FULLSTACK],
diff --git a/bin/hog b/bin/hog
deleted file mode 100755
index bcd21e8b661c..000000000000
--- a/bin/hog
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-set -e
-
-if [[ "$@" == *".hoge"* ]]; then
- if [[ "$@" == *"--python"* ]]; then
- exec python3 -m common.hogvm.python.cli "$@"
-
- elif [[ "$@" == *"--debug"* ]]; then
- echo "Running in Python VM with debug mode"
- exec python3 -m common.hogvm.python.cli "$@"
-
- else # default to nodejs because it's fastest
- set -- "${@/--nodejs/}"
- VM_PATH="$(dirname "$0")/../common/hogvm/typescript"
- CLI_PATH="$(dirname "$0")/../common/hogvm/typescript/dist/cli.js"
- # TODO: recompile if something changed
- if [ ! -f $CLI_PATH ]; then
- echo "Building TypeScript HogVM"
- cd $VM_PATH
- pnpm run build
- cd -
- fi
- exec node $CLI_PATH "$@"
- fi
-elif [[ "$@" == *"--out"* ]]; then
- exec python3 -m posthog.hogql.cli --out "$@"
-elif [[ "$@" == *".hog"* ]]; then
- exec python3 -m posthog.hogql.cli --run "$@"
-else
- echo "$0 - the full hog! 🦔+🐗=Hog"
- echo ""
- echo "Usage: bin/hog <file.hog> run .hog source code"
- echo " bin/hog <file.hoge> run compiled .hoge bytecode"
- echo " bin/hoge <file.hog> [output.hoge] compile .hog into .hoge"
- echo ""
- echo "Options: bin/hog --debug run the debugger (Python only)"
- echo " bin/hog --python use the Python VM"
- echo " bin/hog --nodejs use the Node.js VM"
- exit 1
-fi
diff --git a/bin/hoge b/bin/hoge
deleted file mode 100755
index 26e1043b6f95..000000000000
--- a/bin/hoge
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-set -e
-
-if [[ "$@" == *".hog"* ]]; then
- exec python3 -m posthog.hogql.cli --compile "$@"
-elif [[ "$@" == *".js"* ]]; then
- exec python3 -m posthog.hogql.cli --compile "$@"
-else
- echo "$0 - the Hog compilër! 🦔+🕶️= Hoge"
- echo ""
- echo "Usage: bin/hoge <file.hog> [output.hoge] compile .hog into .hoge"
- echo " bin/hoge <file.hog> <output.js> compile .hog into .js"
- echo " bin/hog <file.hog> run .hog source code"
- echo " bin/hog <file.hoge> run compiled .hoge bytecode"
- exit 1
-fi
diff --git a/hogli.yaml b/hogli.yaml
index d8f12e48bfd9..4b65ce2612fa 100644
--- a/hogli.yaml
+++ b/hogli.yaml
@@ -994,12 +994,6 @@ tools:
development
services:
- temporal
- tool:hog:
- bin_script: hog
- description: Run HogQL interpreter (TypeScript/Python) or compiled bytecode
- tool:hoge:
- bin_script: hoge
- description: Compile HogQL source to bytecode or JavaScript
tool:hoglang:
bin_script: hoglang
description: Run HogLang source or bytecode, or compile source to bytecode or JavaScript
diff --git a/nodejs/src/cdp/templates/compiler.ts b/nodejs/src/cdp/templates/compiler.ts
index 1eff5f95b7ca..9e02a2102206 100644
--- a/nodejs/src/cdp/templates/compiler.ts
+++ b/nodejs/src/cdp/templates/compiler.ts
@@ -52,7 +52,7 @@ export async function compileHog(hog: string): Promise<HogBytecode> {
)
}
- // We invoke the ./bin/hog from the root of the directory like bin/hoge <file.hog> [output.hoge]
+ // We invoke ./bin/hoglang from the root of the directory like bin/hoglang compile <file.hog> [output.hoge]
// We need to write and read from a temp file
const uuid = new UUIDT().toString()
const tempFile = path.join(tmpdir(), `hog-${uuid}.hog`)
@@ -62,7 +62,7 @@ export async function compileHog(hog: string): Promise<HogBytecode> {
try {
await new Promise((resolve, reject) => {
exec(
- `cd ${ROOT_DIR} && ./bin/hoge ${tempFile} ${outputFile}`,
+ `cd ${ROOT_DIR} && ./bin/hoglang compile ${tempFile} ${outputFile}`,
{
env: {
...process.env,
diff --git a/nodejs/src/logs/transformations/benchmarks/hogvm-log-bench.ts b/nodejs/src/logs/transformations/benchmarks/hogvm-log-bench.ts
index 107dc7713820..63be00fe55ea 100644
--- a/nodejs/src/logs/transformations/benchmarks/hogvm-log-bench.ts
+++ b/nodejs/src/logs/transformations/benchmarks/hogvm-log-bench.ts
@@ -18,7 +18,7 @@ const ITERATIONS = 5_000
const TIMEOUT_MS = 10
async function main(): Promise<void> {
- console.info(`Compiling ${BENCH_PROGRAMS.length} Hog programs via bin/hog...`)
+ console.info(`Compiling ${BENCH_PROGRAMS.length} Hog programs via bin/hoglang...`)
const compiled = await Promise.all(
BENCH_PROGRAMS.map(async (program) => ({ program, bytecode: await compileHog(program.hog) }))
)
diff --git a/nodejs/src/logs/transformations/benchmarks/transformer-log-bench.ts b/nodejs/src/logs/transformations/benchmarks/transformer-log-bench.ts
index aa02caf8cfdc..05a1b24b394e 100644
--- a/nodejs/src/logs/transformations/benchmarks/transformer-log-bench.ts
+++ b/nodejs/src/logs/transformations/benchmarks/transformer-log-bench.ts
@@ -45,7 +45,7 @@ function toWireRecord(record: LogRecord): LogRecord {
}
async function main(): Promise<void> {
- console.info(`Compiling ${BENCH_PROGRAMS.length} Hog programs via bin/hog...`)
+ console.info(`Compiling ${BENCH_PROGRAMS.length} Hog programs via bin/hoglang...`)
const compiled = await Promise.all(
BENCH_PROGRAMS.map(async (program) => ({ program, bytecode: await compileHog(program.hog) }))
)
diff --git a/rust/common/hogvm/tests/compile_tests.sh b/rust/common/hogvm/tests/compile_tests.sh
index effc8482604e..72f621998c48 100755
--- a/rust/common/hogvm/tests/compile_tests.sh
+++ b/rust/common/hogvm/tests/compile_tests.sh
@@ -3,5 +3,5 @@
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR/../../../..
rm rust/common/hogvm/tests/static/test_programs/*.hoge
-find rust/common/hogvm/tests/static/test_programs -type f -exec bin/hoge {} \;
+find rust/common/hogvm/tests/static/test_programs -type f -exec bin/hoglang compile {} \;
cd $SCRIPT_DIR