@posthog/cli 0.7.27 → 0.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/posthog-api-cli.mjs +293 -139
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# posthog-cli
|
|
2
2
|
|
|
3
|
+
## 0.7.29 — 2026-06-19
|
|
4
|
+
|
|
5
|
+
### Patch changes
|
|
6
|
+
|
|
7
|
+
- [8c030733b1](https://github.com/PostHog/posthog/commit/8c030733b14ad4281505634ab7c1a21e4128ff51) Quiet agent API discovery commands — Thanks @cvolzer3!
|
|
8
|
+
|
|
9
|
+
## 0.7.28 — 2026-06-18
|
|
10
|
+
|
|
11
|
+
### Patch changes
|
|
12
|
+
|
|
13
|
+
- [f0bb5426d5](https://github.com/PostHog/posthog/commit/f0bb5426d51601a7e39c4d3bcadbe592962ab980) Remove the `posthog-cli api` experimental opt-in and skip unavailable generated tools without warning noise. — Thanks @cvolzer3!
|
|
14
|
+
|
|
3
15
|
## 0.7.27 — 2026-06-18
|
|
4
16
|
|
|
5
17
|
### Patch changes
|
package/lib/posthog-api-cli.mjs
CHANGED
|
@@ -27228,7 +27228,7 @@ function isPostHogCodeConsumer(mcpConsumer) {
|
|
|
27228
27228
|
return new MCPClientProfile({ consumer: mcpConsumer }).isPostHogCodeConsumer();
|
|
27229
27229
|
}
|
|
27230
27230
|
|
|
27231
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
27231
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/logger.mjs
|
|
27232
27232
|
var activeLogger;
|
|
27233
27233
|
function log(message) {
|
|
27234
27234
|
if (activeLogger) try {
|
|
@@ -27237,7 +27237,7 @@ function log(message) {
|
|
|
27237
27237
|
}
|
|
27238
27238
|
}
|
|
27239
27239
|
|
|
27240
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27240
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/utils/type-utils.mjs
|
|
27241
27241
|
var nativeIsArray = Array.isArray;
|
|
27242
27242
|
var ObjProto = Object.prototype;
|
|
27243
27243
|
var type_utils_hasOwnProperty = ObjProto.hasOwnProperty;
|
|
@@ -27271,7 +27271,7 @@ function isInstanceOf(candidate, base) {
|
|
|
27271
27271
|
}
|
|
27272
27272
|
}
|
|
27273
27273
|
|
|
27274
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27274
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/vendor/uuidv7.mjs
|
|
27275
27275
|
var DIGITS = "0123456789abcdef";
|
|
27276
27276
|
var UUID = class _UUID {
|
|
27277
27277
|
constructor(bytes) {
|
|
@@ -27433,7 +27433,7 @@ var defaultGenerator;
|
|
|
27433
27433
|
var uuidv72 = () => uuidv7obj().toString();
|
|
27434
27434
|
var uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
|
|
27435
27435
|
|
|
27436
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27436
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/utils/user-agent-utils.mjs
|
|
27437
27437
|
var MOBILE = "Mobile";
|
|
27438
27438
|
var IOS = "iOS";
|
|
27439
27439
|
var ANDROID = "Android";
|
|
@@ -27722,10 +27722,10 @@ var osMatchers = [
|
|
|
27722
27722
|
]
|
|
27723
27723
|
];
|
|
27724
27724
|
|
|
27725
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27725
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/utils/index.mjs
|
|
27726
27726
|
var isError = (x) => x instanceof Error;
|
|
27727
27727
|
|
|
27728
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27728
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/logs/logs-utils.mjs
|
|
27729
27729
|
var OTLP_SEVERITY_MAP = {
|
|
27730
27730
|
trace: {
|
|
27731
27731
|
text: "TRACE",
|
|
@@ -27754,7 +27754,7 @@ var OTLP_SEVERITY_MAP = {
|
|
|
27754
27754
|
};
|
|
27755
27755
|
var DEFAULT_OTLP_SEVERITY = OTLP_SEVERITY_MAP.info;
|
|
27756
27756
|
|
|
27757
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27757
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/index.mjs
|
|
27758
27758
|
var error_tracking_exports = {};
|
|
27759
27759
|
__export(error_tracking_exports, {
|
|
27760
27760
|
DEFAULT_EXCEPTION_STEPS_CONFIG: () => DEFAULT_EXCEPTION_STEPS_CONFIG,
|
|
@@ -27784,7 +27784,7 @@ __export(error_tracking_exports, {
|
|
|
27784
27784
|
winjsStackLineParser: () => winjsStackLineParser
|
|
27785
27785
|
});
|
|
27786
27786
|
|
|
27787
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27787
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs
|
|
27788
27788
|
var parsedStackResults;
|
|
27789
27789
|
var lastKeysCount;
|
|
27790
27790
|
var cachedFilenameChunkIds;
|
|
@@ -27819,7 +27819,7 @@ function getFilenameToChunkIdMap(stackParser) {
|
|
|
27819
27819
|
return cachedFilenameChunkIds;
|
|
27820
27820
|
}
|
|
27821
27821
|
|
|
27822
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27822
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/error-properties-builder.mjs
|
|
27823
27823
|
var MAX_CAUSE_RECURSION = 4;
|
|
27824
27824
|
var ErrorPropertiesBuilder = class {
|
|
27825
27825
|
constructor(coercers, stackParser, modifiers = []) {
|
|
@@ -27930,7 +27930,7 @@ var ErrorPropertiesBuilder = class {
|
|
|
27930
27930
|
}
|
|
27931
27931
|
};
|
|
27932
27932
|
|
|
27933
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27933
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/base.mjs
|
|
27934
27934
|
var UNKNOWN_FUNCTION = "?";
|
|
27935
27935
|
function createFrame(platform, filename, func, lineno, colno) {
|
|
27936
27936
|
const frame = {
|
|
@@ -27944,7 +27944,7 @@ function createFrame(platform, filename, func, lineno, colno) {
|
|
|
27944
27944
|
return frame;
|
|
27945
27945
|
}
|
|
27946
27946
|
|
|
27947
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27947
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/safari.mjs
|
|
27948
27948
|
var extractSafariExtensionDetails = (func, filename) => {
|
|
27949
27949
|
const isSafariExtension = -1 !== func.indexOf("safari-extension");
|
|
27950
27950
|
const isSafariWebExtension = -1 !== func.indexOf("safari-web-extension");
|
|
@@ -27957,7 +27957,7 @@ var extractSafariExtensionDetails = (func, filename) => {
|
|
|
27957
27957
|
];
|
|
27958
27958
|
};
|
|
27959
27959
|
|
|
27960
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27960
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/chrome.mjs
|
|
27961
27961
|
var chromeRegexNoFnName = /^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i;
|
|
27962
27962
|
var chromeRegex = /^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
27963
27963
|
var chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
|
|
@@ -27983,7 +27983,7 @@ var chromeStackLineParser = (line, platform) => {
|
|
|
27983
27983
|
}
|
|
27984
27984
|
};
|
|
27985
27985
|
|
|
27986
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
27986
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/gecko.mjs
|
|
27987
27987
|
var geckoREgex = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
|
|
27988
27988
|
var geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
|
|
27989
27989
|
var geckoStackLineParser = (line, platform) => {
|
|
@@ -28006,14 +28006,14 @@ var geckoStackLineParser = (line, platform) => {
|
|
|
28006
28006
|
}
|
|
28007
28007
|
};
|
|
28008
28008
|
|
|
28009
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28009
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/winjs.mjs
|
|
28010
28010
|
var winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
28011
28011
|
var winjsStackLineParser = (line, platform) => {
|
|
28012
28012
|
const parts = winjsRegex.exec(line);
|
|
28013
28013
|
return parts ? createFrame(platform, parts[2], parts[1] || UNKNOWN_FUNCTION, +parts[3], parts[4] ? +parts[4] : void 0) : void 0;
|
|
28014
28014
|
};
|
|
28015
28015
|
|
|
28016
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28016
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/opera.mjs
|
|
28017
28017
|
var opera10Regex = / line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i;
|
|
28018
28018
|
var opera10StackLineParser = (line, platform) => {
|
|
28019
28019
|
const parts = opera10Regex.exec(line);
|
|
@@ -28025,7 +28025,7 @@ var opera11StackLineParser = (line, platform) => {
|
|
|
28025
28025
|
return parts ? createFrame(platform, parts[5], parts[3] || parts[4] || UNKNOWN_FUNCTION, +parts[1], +parts[2]) : void 0;
|
|
28026
28026
|
};
|
|
28027
28027
|
|
|
28028
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28028
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/node.mjs
|
|
28029
28029
|
var FILENAME_MATCH = /^\s*[-]{4,}$/;
|
|
28030
28030
|
var FULL_MATCH = /at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;
|
|
28031
28031
|
var nodeStackLineParser = (line, platform) => {
|
|
@@ -28090,7 +28090,7 @@ function _parseIntOrUndefined(input) {
|
|
|
28090
28090
|
return parseInt(input || "", 10) || void 0;
|
|
28091
28091
|
}
|
|
28092
28092
|
|
|
28093
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28093
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/parsers/index.mjs
|
|
28094
28094
|
var WEBPACK_ERROR_REGEXP = /\(error: (.*)\)/;
|
|
28095
28095
|
var STACKTRACE_FRAME_LIMIT = 50;
|
|
28096
28096
|
function reverseAndStripFrames(stack) {
|
|
@@ -28132,7 +28132,7 @@ function createStackParser(platform, ...parsers) {
|
|
|
28132
28132
|
};
|
|
28133
28133
|
}
|
|
28134
28134
|
|
|
28135
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28135
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/dom-exception-coercer.mjs
|
|
28136
28136
|
var DOMExceptionCoercer = class {
|
|
28137
28137
|
match(err2) {
|
|
28138
28138
|
return this.isDOMException(err2) || this.isDOMError(err2);
|
|
@@ -28163,7 +28163,7 @@ var DOMExceptionCoercer = class {
|
|
|
28163
28163
|
}
|
|
28164
28164
|
};
|
|
28165
28165
|
|
|
28166
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28166
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/error-coercer.mjs
|
|
28167
28167
|
var ErrorCoercer = class {
|
|
28168
28168
|
match(err2) {
|
|
28169
28169
|
return isPlainError(err2);
|
|
@@ -28190,7 +28190,7 @@ var ErrorCoercer = class {
|
|
|
28190
28190
|
}
|
|
28191
28191
|
};
|
|
28192
28192
|
|
|
28193
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28193
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/error-event-coercer.mjs
|
|
28194
28194
|
var ErrorEventCoercer = class {
|
|
28195
28195
|
constructor() {
|
|
28196
28196
|
}
|
|
@@ -28209,7 +28209,7 @@ var ErrorEventCoercer = class {
|
|
|
28209
28209
|
}
|
|
28210
28210
|
};
|
|
28211
28211
|
|
|
28212
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28212
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/string-coercer.mjs
|
|
28213
28213
|
var ERROR_TYPES_PATTERN = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;
|
|
28214
28214
|
var StringCoercer = class {
|
|
28215
28215
|
match(input) {
|
|
@@ -28239,7 +28239,7 @@ var StringCoercer = class {
|
|
|
28239
28239
|
}
|
|
28240
28240
|
};
|
|
28241
28241
|
|
|
28242
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28242
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/types.mjs
|
|
28243
28243
|
var severityLevels = [
|
|
28244
28244
|
"fatal",
|
|
28245
28245
|
"error",
|
|
@@ -28249,7 +28249,7 @@ var severityLevels = [
|
|
|
28249
28249
|
"debug"
|
|
28250
28250
|
];
|
|
28251
28251
|
|
|
28252
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28252
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/utils.mjs
|
|
28253
28253
|
function extractExceptionKeysForMessage(err2, maxLength = 40) {
|
|
28254
28254
|
const keys = Object.keys(err2);
|
|
28255
28255
|
keys.sort();
|
|
@@ -28264,7 +28264,7 @@ function extractExceptionKeysForMessage(err2, maxLength = 40) {
|
|
|
28264
28264
|
return "";
|
|
28265
28265
|
}
|
|
28266
28266
|
|
|
28267
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28267
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/object-coercer.mjs
|
|
28268
28268
|
var ObjectCoercer = class {
|
|
28269
28269
|
match(candidate) {
|
|
28270
28270
|
return "object" == typeof candidate && null !== candidate;
|
|
@@ -28313,7 +28313,7 @@ var ObjectCoercer = class {
|
|
|
28313
28313
|
}
|
|
28314
28314
|
};
|
|
28315
28315
|
|
|
28316
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28316
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/event-coercer.mjs
|
|
28317
28317
|
var EventCoercer = class {
|
|
28318
28318
|
match(err2) {
|
|
28319
28319
|
return isEvent(err2);
|
|
@@ -28329,7 +28329,7 @@ var EventCoercer = class {
|
|
|
28329
28329
|
}
|
|
28330
28330
|
};
|
|
28331
28331
|
|
|
28332
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28332
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/primitive-coercer.mjs
|
|
28333
28333
|
var PrimitiveCoercer = class {
|
|
28334
28334
|
match(candidate) {
|
|
28335
28335
|
return isPrimitive(candidate);
|
|
@@ -28344,7 +28344,7 @@ var PrimitiveCoercer = class {
|
|
|
28344
28344
|
}
|
|
28345
28345
|
};
|
|
28346
28346
|
|
|
28347
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28347
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/coercers/promise-rejection-event.mjs
|
|
28348
28348
|
var PromiseRejectionEventCoercer = class {
|
|
28349
28349
|
match(err2) {
|
|
28350
28350
|
return isBuiltin(err2, "PromiseRejectionEvent") || this.isCustomEventWrappingRejection(err2);
|
|
@@ -28378,7 +28378,7 @@ var PromiseRejectionEventCoercer = class {
|
|
|
28378
28378
|
}
|
|
28379
28379
|
};
|
|
28380
28380
|
|
|
28381
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28381
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/utils.mjs
|
|
28382
28382
|
var ReduceableCache = class {
|
|
28383
28383
|
constructor(_maxSize2) {
|
|
28384
28384
|
this._maxSize = _maxSize2;
|
|
@@ -28402,7 +28402,7 @@ var ReduceableCache = class {
|
|
|
28402
28402
|
}
|
|
28403
28403
|
};
|
|
28404
28404
|
|
|
28405
|
-
// ../../node_modules/.pnpm/@posthog+core@1.
|
|
28405
|
+
// ../../node_modules/.pnpm/@posthog+core@1.35.1/node_modules/@posthog/core/dist/error-tracking/exception-steps.mjs
|
|
28406
28406
|
var EXCEPTION_STEP_INTERNAL_FIELDS = {
|
|
28407
28407
|
MESSAGE: "$message",
|
|
28408
28408
|
TIMESTAMP: "$timestamp"
|
|
@@ -28540,7 +28540,8 @@ function getUtf8ByteLength(value) {
|
|
|
28540
28540
|
return byteLength;
|
|
28541
28541
|
}
|
|
28542
28542
|
|
|
28543
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28543
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/constants.mjs
|
|
28544
|
+
var DEFAULT_CONTEXT_PARAMETER_DESCRIPTION = `Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): "Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization."`;
|
|
28544
28545
|
var POSTHOG_MCP_ANALYTICS_SOURCE = "posthog_mcp_analytics";
|
|
28545
28546
|
var PostHogMCPAnalyticsEvent = {
|
|
28546
28547
|
Custom: "$mcp_custom",
|
|
@@ -28571,11 +28572,12 @@ var PostHogMCPAnalyticsProperty = {
|
|
|
28571
28572
|
ServerVersion: "$mcp_server_version",
|
|
28572
28573
|
SessionId: "$session_id",
|
|
28573
28574
|
Source: "$mcp_source",
|
|
28575
|
+
ToolCategory: "$mcp_tool_category",
|
|
28574
28576
|
ToolDescription: "$mcp_tool_description",
|
|
28575
28577
|
ToolName: "$mcp_tool_name"
|
|
28576
28578
|
};
|
|
28577
28579
|
|
|
28578
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28580
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/event-types.mjs
|
|
28579
28581
|
var MCPAnalyticsEventType = {
|
|
28580
28582
|
identify: "posthog:identify",
|
|
28581
28583
|
custom: "posthog:custom",
|
|
@@ -28589,7 +28591,7 @@ var MCPAnalyticsEventType = {
|
|
|
28589
28591
|
mcpToolsList: "mcp:tools/list"
|
|
28590
28592
|
};
|
|
28591
28593
|
|
|
28592
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28594
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/posthog-events.mjs
|
|
28593
28595
|
var BUILT_IN_EVENT_NAME_BY_TYPE = {
|
|
28594
28596
|
[MCPAnalyticsEventType.custom]: PostHogMCPAnalyticsEvent.Custom,
|
|
28595
28597
|
[MCPAnalyticsEventType.identify]: PostHogMCPAnalyticsEvent.Identify,
|
|
@@ -28653,6 +28655,7 @@ function addCommonEventProperties(event, properties) {
|
|
|
28653
28655
|
if (event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolName] = event.resourceName;
|
|
28654
28656
|
}
|
|
28655
28657
|
if (event.toolDescription && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolDescription] = event.toolDescription;
|
|
28658
|
+
if (event.toolCategory && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolCategory] = event.toolCategory;
|
|
28656
28659
|
if (event.listedToolNames && event.listedToolNames.length > 0 && event.eventType === MCPAnalyticsEventType.mcpToolsList) properties[PostHogMCPAnalyticsProperty.ListedToolNames] = event.listedToolNames;
|
|
28657
28660
|
if (void 0 !== event.duration) properties[PostHogMCPAnalyticsProperty.DurationMs] = event.duration;
|
|
28658
28661
|
if (event.serverName) properties[PostHogMCPAnalyticsProperty.ServerName] = event.serverName;
|
|
@@ -28685,6 +28688,7 @@ function buildExceptionEvent(event) {
|
|
|
28685
28688
|
if (event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolName] = event.resourceName;
|
|
28686
28689
|
}
|
|
28687
28690
|
if (event.toolDescription && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolDescription] = event.toolDescription;
|
|
28691
|
+
if (event.toolCategory && event.eventType === MCPAnalyticsEventType.mcpToolsCall) properties[PostHogMCPAnalyticsProperty.ToolCategory] = event.toolCategory;
|
|
28688
28692
|
if (event.serverName) properties[PostHogMCPAnalyticsProperty.ServerName] = event.serverName;
|
|
28689
28693
|
if (event.serverVersion) properties[PostHogMCPAnalyticsProperty.ServerVersion] = event.serverVersion;
|
|
28690
28694
|
if (event.clientName) properties[PostHogMCPAnalyticsProperty.ClientName] = event.clientName;
|
|
@@ -28699,12 +28703,12 @@ function buildExceptionEvent(event) {
|
|
|
28699
28703
|
};
|
|
28700
28704
|
}
|
|
28701
28705
|
|
|
28702
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28706
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/ids.mjs
|
|
28703
28707
|
function newPrefixedId(prefix) {
|
|
28704
28708
|
return `${prefix}_${uuidv72()}`;
|
|
28705
28709
|
}
|
|
28706
28710
|
|
|
28707
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28711
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/mcp-payloads.mjs
|
|
28708
28712
|
var REDACTED_VALUE = "[redacted]";
|
|
28709
28713
|
var BASE64_PATTERN = /^[A-Za-z0-9+/\n\r]+=*$/;
|
|
28710
28714
|
var SIZE_GATE = 10240;
|
|
@@ -28728,7 +28732,7 @@ function sanitizeCapturedValue(value) {
|
|
|
28728
28732
|
return result;
|
|
28729
28733
|
}
|
|
28730
28734
|
|
|
28731
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28735
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/sanitization.mjs
|
|
28732
28736
|
function isRecord(value) {
|
|
28733
28737
|
return !!value && "object" == typeof value && !Array.isArray(value);
|
|
28734
28738
|
}
|
|
@@ -28738,6 +28742,7 @@ function sanitizeEvent(event) {
|
|
|
28738
28742
|
};
|
|
28739
28743
|
if (null != result.response) result.response = sanitizeResponse(result.response);
|
|
28740
28744
|
if (null != result.parameters) result.parameters = sanitizeParameters(result.parameters);
|
|
28745
|
+
if (null != result.userIntent) result.userIntent = sanitizeCapturedValue(result.userIntent);
|
|
28741
28746
|
return result;
|
|
28742
28747
|
}
|
|
28743
28748
|
function sanitizeResponse(response) {
|
|
@@ -28790,7 +28795,7 @@ function sanitizeParameters(obj) {
|
|
|
28790
28795
|
return sanitizeCapturedValue(obj);
|
|
28791
28796
|
}
|
|
28792
28797
|
|
|
28793
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
28798
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/truncation.mjs
|
|
28794
28799
|
var MAX_DEPTH = 10;
|
|
28795
28800
|
var MAX_BREADTH = 100;
|
|
28796
28801
|
var MAX_STRING_LENGTH = 32768;
|
|
@@ -29019,7 +29024,7 @@ function truncateEvent(event) {
|
|
|
29019
29024
|
return truncateToSize(result);
|
|
29020
29025
|
}
|
|
29021
29026
|
|
|
29022
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
29027
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/sink.mjs
|
|
29023
29028
|
async function processMcpEvent(event, options) {
|
|
29024
29029
|
let processed = event;
|
|
29025
29030
|
try {
|
|
@@ -29079,7 +29084,84 @@ var McpEventSink = class {
|
|
|
29079
29084
|
}
|
|
29080
29085
|
};
|
|
29081
29086
|
|
|
29082
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
29087
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/tools.mjs
|
|
29088
|
+
var GET_MORE_TOOLS_NAME = "get_more_tools";
|
|
29089
|
+
function getReportMissingToolDescriptor(name = GET_MORE_TOOLS_NAME) {
|
|
29090
|
+
return {
|
|
29091
|
+
name,
|
|
29092
|
+
description: "Check for additional tools whenever your task might benefit from specialized capabilities - even if existing tools could work as a fallback.",
|
|
29093
|
+
inputSchema: {
|
|
29094
|
+
type: "object",
|
|
29095
|
+
properties: {
|
|
29096
|
+
context: {
|
|
29097
|
+
type: "string",
|
|
29098
|
+
description: "A description of your goal and what kind of tool would help accomplish it."
|
|
29099
|
+
}
|
|
29100
|
+
},
|
|
29101
|
+
required: [
|
|
29102
|
+
"context"
|
|
29103
|
+
]
|
|
29104
|
+
},
|
|
29105
|
+
annotations: {
|
|
29106
|
+
title: "Get More Tools",
|
|
29107
|
+
readOnlyHint: true,
|
|
29108
|
+
openWorldHint: true,
|
|
29109
|
+
idempotentHint: true,
|
|
29110
|
+
destructiveHint: false
|
|
29111
|
+
}
|
|
29112
|
+
};
|
|
29113
|
+
}
|
|
29114
|
+
|
|
29115
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/context-parameters.mjs
|
|
29116
|
+
function isContextEnabled(context) {
|
|
29117
|
+
return false !== context;
|
|
29118
|
+
}
|
|
29119
|
+
function getContextDescription(context) {
|
|
29120
|
+
return "object" == typeof context ? context.description : void 0;
|
|
29121
|
+
}
|
|
29122
|
+
function addContextParameterToTool(tool14, contextDescriptionOverride) {
|
|
29123
|
+
const modifiedTool = {
|
|
29124
|
+
...tool14
|
|
29125
|
+
};
|
|
29126
|
+
const toolName = tool14.name || "unknown";
|
|
29127
|
+
const schema19 = modifiedTool.inputSchema;
|
|
29128
|
+
if (schema19?.properties?.context) {
|
|
29129
|
+
log(`WARN: Tool "${toolName}" already has 'context' parameter. Skipping context injection.`);
|
|
29130
|
+
return modifiedTool;
|
|
29131
|
+
}
|
|
29132
|
+
if (schema19?.oneOf || schema19?.allOf || schema19?.anyOf) {
|
|
29133
|
+
log(`WARN: Tool "${toolName}" has complex schema (oneOf/allOf/anyOf). Skipping context injection.`);
|
|
29134
|
+
return modifiedTool;
|
|
29135
|
+
}
|
|
29136
|
+
if (!modifiedTool.inputSchema) modifiedTool.inputSchema = {
|
|
29137
|
+
type: "object",
|
|
29138
|
+
properties: {},
|
|
29139
|
+
required: []
|
|
29140
|
+
};
|
|
29141
|
+
const contextDescription = contextDescriptionOverride || DEFAULT_CONTEXT_PARAMETER_DESCRIPTION;
|
|
29142
|
+
modifiedTool.inputSchema = JSON.parse(JSON.stringify(modifiedTool.inputSchema));
|
|
29143
|
+
const inputSchema = modifiedTool.inputSchema;
|
|
29144
|
+
if (!inputSchema.properties) inputSchema.properties = {};
|
|
29145
|
+
if (false === inputSchema.additionalProperties) inputSchema.additionalProperties = void 0;
|
|
29146
|
+
inputSchema.properties.context = {
|
|
29147
|
+
type: "string",
|
|
29148
|
+
description: contextDescription
|
|
29149
|
+
};
|
|
29150
|
+
if (Array.isArray(inputSchema.required)) {
|
|
29151
|
+
if (!inputSchema.required.includes("context")) inputSchema.required.push("context");
|
|
29152
|
+
} else inputSchema.required = [
|
|
29153
|
+
"context"
|
|
29154
|
+
];
|
|
29155
|
+
return modifiedTool;
|
|
29156
|
+
}
|
|
29157
|
+
function addContextParameterToTools(tools, contextDescriptionOverride) {
|
|
29158
|
+
return tools.map((tool14) => {
|
|
29159
|
+
if ("get_more_tools" === tool14.name) return tool14;
|
|
29160
|
+
return addContextParameterToTool(tool14, contextDescriptionOverride);
|
|
29161
|
+
});
|
|
29162
|
+
}
|
|
29163
|
+
|
|
29164
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/exceptions.mjs
|
|
29083
29165
|
var errorPropertiesBuilder = new error_tracking_exports.ErrorPropertiesBuilder([
|
|
29084
29166
|
new error_tracking_exports.EventCoercer(),
|
|
29085
29167
|
new error_tracking_exports.ErrorCoercer(),
|
|
@@ -29103,7 +29185,7 @@ function extractCallToolResultMessage(result) {
|
|
|
29103
29185
|
return result.content.filter(isTextContentPart).map((contentPart) => contentPart.text).join(" ").trim() || "Unknown error";
|
|
29104
29186
|
}
|
|
29105
29187
|
|
|
29106
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
29188
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/instrument-highlevel.mjs
|
|
29107
29189
|
var MCP_ANALYTICS_PROCESSED = Symbol("__posthog_mcp_analytics_processed__");
|
|
29108
29190
|
|
|
29109
29191
|
// ../../node_modules/.pnpm/posthog-node@5.25.0/node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
@@ -32909,17 +32991,24 @@ var PostHog = class extends PostHogBackendClient {
|
|
|
32909
32991
|
}
|
|
32910
32992
|
};
|
|
32911
32993
|
|
|
32912
|
-
// ../../node_modules/.pnpm/@posthog+mcp@0.
|
|
32994
|
+
// ../../node_modules/.pnpm/@posthog+mcp@0.4.0_@modelcontextprotocol+sdk@1.29.0_@cfworker+json-schema@4.1.1_zod@4.3.6__posthog-node@5.25.0/node_modules/@posthog/mcp/dist/extensions/posthog-mcp.mjs
|
|
32913
32995
|
var PostHogMCP = class extends PostHog {
|
|
32914
32996
|
#sink;
|
|
32997
|
+
#missingCapabilityToolName;
|
|
32998
|
+
constructor(apiKey, options = {}) {
|
|
32999
|
+
super(apiKey, options), this.#sink = new McpEventSink(this);
|
|
33000
|
+
this.#missingCapabilityToolName = options.missingCapabilityToolName ?? GET_MORE_TOOLS_NAME;
|
|
33001
|
+
}
|
|
32915
33002
|
captureToolCall(data) {
|
|
32916
33003
|
const event = baseEvent(MCPAnalyticsEventType.mcpToolsCall, data);
|
|
32917
33004
|
event.resourceName = data.toolName;
|
|
32918
33005
|
event.toolDescription = data.toolDescription;
|
|
33006
|
+
event.toolCategory = data.category;
|
|
32919
33007
|
event.parameters = data.parameters;
|
|
32920
33008
|
event.response = data.response;
|
|
32921
33009
|
event.duration = data.durationMs;
|
|
32922
33010
|
event.isError = data.isError;
|
|
33011
|
+
applyIntent(event, data.intent, data.intentSource);
|
|
32923
33012
|
if (data.isError) event.error = captureException(data.error ?? `Tool ${data.toolName} returned an error`);
|
|
32924
33013
|
this.#emit(event);
|
|
32925
33014
|
}
|
|
@@ -32932,14 +33021,49 @@ var PostHogMCP = class extends PostHog {
|
|
|
32932
33021
|
event.duration = data.durationMs;
|
|
32933
33022
|
this.#emit(event);
|
|
32934
33023
|
}
|
|
33024
|
+
captureToolsList(data) {
|
|
33025
|
+
const event = baseEvent(MCPAnalyticsEventType.mcpToolsList, data);
|
|
33026
|
+
event.listedToolNames = data.toolNames;
|
|
33027
|
+
event.parameters = data.parameters;
|
|
33028
|
+
event.response = data.response;
|
|
33029
|
+
event.duration = data.durationMs;
|
|
33030
|
+
event.isError = data.isError;
|
|
33031
|
+
if (data.isError) event.error = captureException(data.error ?? "tools/list failed");
|
|
33032
|
+
this.#emit(event);
|
|
33033
|
+
}
|
|
33034
|
+
prepareToolList(tools, options = {}) {
|
|
33035
|
+
const contextOption = options.context ?? true;
|
|
33036
|
+
let prepared = isContextEnabled(contextOption) ? addContextParameterToTools(tools, getContextDescription(contextOption)) : [
|
|
33037
|
+
...tools
|
|
33038
|
+
];
|
|
33039
|
+
if (options.reportMissing && !prepared.some((tool14) => tool14?.name === this.#missingCapabilityToolName)) prepared = [
|
|
33040
|
+
...prepared,
|
|
33041
|
+
getReportMissingToolDescriptor(this.#missingCapabilityToolName)
|
|
33042
|
+
];
|
|
33043
|
+
return prepared;
|
|
33044
|
+
}
|
|
33045
|
+
prepareToolCall(name, args) {
|
|
33046
|
+
const rawContext = args?.context;
|
|
33047
|
+
const intent = "string" == typeof rawContext && rawContext.trim() ? rawContext.trim() : void 0;
|
|
33048
|
+
return {
|
|
33049
|
+
intent,
|
|
33050
|
+
intentSource: intent ? "context_parameter" : void 0,
|
|
33051
|
+
args: stripContext(args),
|
|
33052
|
+
isMissingCapability: name === this.#missingCapabilityToolName
|
|
33053
|
+
};
|
|
33054
|
+
}
|
|
33055
|
+
captureMissingCapability(data) {
|
|
33056
|
+
const event = baseEvent(MCPAnalyticsEventType.mcpMissingCapability, data);
|
|
33057
|
+
event.resourceName = this.#missingCapabilityToolName;
|
|
33058
|
+
event.parameters = data.parameters;
|
|
33059
|
+
applyIntent(event, data.context, "context_parameter");
|
|
33060
|
+
this.#emit(event);
|
|
33061
|
+
}
|
|
32935
33062
|
#emit(event) {
|
|
32936
33063
|
this.#sink.capture(event, {
|
|
32937
33064
|
enableExceptionAutocapture: this.options.enableExceptionAutocapture ?? true
|
|
32938
33065
|
}).catch((error48) => log(`Warning: PostHogMCP failed to capture event - ${error48}`));
|
|
32939
33066
|
}
|
|
32940
|
-
constructor(...args) {
|
|
32941
|
-
super(...args), this.#sink = new McpEventSink(this);
|
|
32942
|
-
}
|
|
32943
33067
|
};
|
|
32944
33068
|
function baseEvent(eventType, common) {
|
|
32945
33069
|
const event = {
|
|
@@ -32953,6 +33077,17 @@ function baseEvent(eventType, common) {
|
|
|
32953
33077
|
if (common.setProperties && Object.keys(common.setProperties).length > 0) event.identifyActorData = common.setProperties;
|
|
32954
33078
|
return event;
|
|
32955
33079
|
}
|
|
33080
|
+
function applyIntent(event, intent, source) {
|
|
33081
|
+
const trimmed = "string" == typeof intent ? intent.trim() : "";
|
|
33082
|
+
if (!trimmed) return;
|
|
33083
|
+
event.userIntent = trimmed;
|
|
33084
|
+
event.userIntentSource = source ?? "context_parameter";
|
|
33085
|
+
}
|
|
33086
|
+
function stripContext(args) {
|
|
33087
|
+
if (!args || !("context" in args)) return args;
|
|
33088
|
+
const { context: _context, ...rest } = args;
|
|
33089
|
+
return rest;
|
|
33090
|
+
}
|
|
32956
33091
|
|
|
32957
33092
|
// cf-stub:cloudflare:workers
|
|
32958
33093
|
var env = void 0;
|
|
@@ -33605,6 +33740,9 @@ function createExecTool(allTools, context, toolDescription, commandReference, mc
|
|
|
33605
33740
|
if (!rest) {
|
|
33606
33741
|
throw new Error("Usage: call [--json] [--confirm] <tool_name> <json_input>");
|
|
33607
33742
|
}
|
|
33743
|
+
if (!context) {
|
|
33744
|
+
throw new Error("Cannot call PostHog tools without an API context");
|
|
33745
|
+
}
|
|
33608
33746
|
const { forceJson, confirmed, rest: callArgs } = parseCallFlags(rest);
|
|
33609
33747
|
if (!callArgs) {
|
|
33610
33748
|
throw new Error("Usage: call [--json] [--confirm] <tool_name> <json_input>");
|
|
@@ -38212,7 +38350,7 @@ Do NOT use this to change lifecycle state \u2014 use the dedicated launch, end,
|
|
|
38212
38350
|
}
|
|
38213
38351
|
},
|
|
38214
38352
|
"llma-evaluation-create": {
|
|
38215
|
-
description: "Create a new
|
|
38353
|
+
description: "Create a new AI observability evaluation. For 'llm_judge' type, provide evaluation_config.prompt and model_configuration (provider + model). For 'hog' type, provide evaluation_config.source (Hog code returning a boolean). For 'sentiment' type, use output_type='sentiment', omit model_configuration, and optionally set evaluation_config.source='user_messages'. When enabled, the evaluation runs automatically on new $ai_generation events. Results appear as '$ai_evaluation' events.",
|
|
38216
38354
|
category: "AI observability",
|
|
38217
38355
|
feature: "llm_analytics",
|
|
38218
38356
|
summary: "Create evaluation",
|
|
@@ -38226,7 +38364,7 @@ Do NOT use this to change lifecycle state \u2014 use the dedicated launch, end,
|
|
|
38226
38364
|
}
|
|
38227
38365
|
},
|
|
38228
38366
|
"llma-evaluation-delete": {
|
|
38229
|
-
description: "Soft-delete an
|
|
38367
|
+
description: "Soft-delete an AI observability evaluation. The evaluation stops running and is hidden from list views. Historical evaluation results ($ai_evaluation events) are preserved.",
|
|
38230
38368
|
category: "AI observability",
|
|
38231
38369
|
feature: "llm_analytics",
|
|
38232
38370
|
summary: "Delete evaluation",
|
|
@@ -38240,7 +38378,7 @@ Do NOT use this to change lifecycle state \u2014 use the dedicated launch, end,
|
|
|
38240
38378
|
}
|
|
38241
38379
|
},
|
|
38242
38380
|
"llma-evaluation-get": {
|
|
38243
|
-
description: "Get a specific
|
|
38381
|
+
description: "Get a specific AI observability evaluation by its UUID. Returns the full evaluation configuration including type, config, output type, enabled status, and model configuration.",
|
|
38244
38382
|
category: "AI observability",
|
|
38245
38383
|
feature: "llm_analytics",
|
|
38246
38384
|
summary: "Get evaluation",
|
|
@@ -38268,7 +38406,7 @@ Do NOT use this to change lifecycle state \u2014 use the dedicated launch, end,
|
|
|
38268
38406
|
}
|
|
38269
38407
|
},
|
|
38270
38408
|
"llma-evaluation-list": {
|
|
38271
|
-
description: "List all
|
|
38409
|
+
description: "List all AI observability evaluations for the current project. Optionally filter by name/description search or enabled status. Evaluations automatically score $ai_generation events for quality, relevance, safety, sentiment, and other criteria. Supported types are 'llm_judge' (LLM scores outputs against a prompt), 'hog' (deterministic Hog code), and 'sentiment' (user-message sentiment analysis). Results are stored as '$ai_evaluation' events.",
|
|
38272
38410
|
category: "AI observability",
|
|
38273
38411
|
feature: "llm_analytics",
|
|
38274
38412
|
summary: "List evaluations",
|
|
@@ -38394,7 +38532,7 @@ Do NOT use this to change lifecycle state \u2014 use the dedicated launch, end,
|
|
|
38394
38532
|
}
|
|
38395
38533
|
},
|
|
38396
38534
|
"llma-evaluation-summary-create": {
|
|
38397
|
-
description: 'Generate an AI-powered summary of
|
|
38535
|
+
description: 'Generate an AI-powered summary of boolean AI observability evaluation results for a given evaluation config. Pass an evaluation_id and an optional filter ("all", "pass", "fail", or "na") to scope which runs are analyzed. Returns an overall assessment, pattern groups for passing, failing, and N/A runs (each with title, description, frequency, and example generation IDs), actionable recommendations, and run statistics. Optionally pass generation_ids to restrict the analysis to specific runs. Results are cached for one hour \u2014 use force_refresh to recompute. Rate-limited; requires AI data processing approval for the organization.',
|
|
38398
38536
|
category: "AI observability",
|
|
38399
38537
|
feature: "llm_analytics",
|
|
38400
38538
|
summary: "Summarize evaluation results",
|
|
@@ -38423,7 +38561,7 @@ Do NOT use this to change lifecycle state \u2014 use the dedicated launch, end,
|
|
|
38423
38561
|
}
|
|
38424
38562
|
},
|
|
38425
38563
|
"llma-evaluation-update": {
|
|
38426
|
-
description: "Update an existing
|
|
38564
|
+
description: "Update an existing AI observability evaluation (partial update). Toggle enabled/disabled, update the evaluation config (prompt, Hog source, or sentiment source), or change the model configuration for llm_judge evaluations.",
|
|
38427
38565
|
category: "AI observability",
|
|
38428
38566
|
feature: "llm_analytics",
|
|
38429
38567
|
summary: "Update evaluation",
|
|
@@ -42379,7 +42517,7 @@ var tool_definitions_default = {
|
|
|
42379
42517
|
}
|
|
42380
42518
|
},
|
|
42381
42519
|
"evaluation-get": {
|
|
42382
|
-
description: "Get a specific AI observability evaluation by its UUID. Returns full details including name, type (llm_judge or
|
|
42520
|
+
description: "Get a specific AI observability evaluation by its UUID. Returns full details including name, type (llm_judge, hog, or sentiment), configuration, conditions, and enabled status.",
|
|
42383
42521
|
category: "AI observability",
|
|
42384
42522
|
feature: "llm_analytics",
|
|
42385
42523
|
summary: "Get a specific evaluation by ID.",
|
|
@@ -42393,7 +42531,7 @@ var tool_definitions_default = {
|
|
|
42393
42531
|
}
|
|
42394
42532
|
},
|
|
42395
42533
|
"evaluation-create": {
|
|
42396
|
-
description: "Create a new AI observability evaluation.
|
|
42534
|
+
description: "Create a new AI observability evaluation. Supported types are 'llm_judge' (LLM scores generations against a prompt), 'hog' (deterministic code returning a boolean), and 'sentiment' (user-message sentiment analysis). For llm_judge evaluations, provide evaluation_config.prompt and model_configuration. For hog evaluations, provide evaluation_config.source. For sentiment evaluations, use output_type='sentiment', omit model_configuration, and optionally set evaluation_config.source='user_messages'.",
|
|
42397
42535
|
category: "AI observability",
|
|
42398
42536
|
feature: "llm_analytics",
|
|
42399
42537
|
summary: "Create a new evaluation.",
|
|
@@ -42937,29 +43075,11 @@ function getToolsForFeatures(options) {
|
|
|
42937
43075
|
return entries.map(([toolName, _2]) => toolName);
|
|
42938
43076
|
}
|
|
42939
43077
|
|
|
42940
|
-
// src/cli/experimental.ts
|
|
42941
|
-
var EXPERIMENTAL_API_ENV = "POSTHOG_CLI_EXPERIMENTAL_API";
|
|
42942
|
-
var ENABLED_VALUES = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
42943
|
-
function isExperimentalApiEnabled(env3 = process.env) {
|
|
42944
|
-
const value = env3[EXPERIMENTAL_API_ENV];
|
|
42945
|
-
return value ? ENABLED_VALUES.has(value.toLowerCase()) : false;
|
|
42946
|
-
}
|
|
42947
|
-
function requireExperimentalApiEnabled(opts = {}) {
|
|
42948
|
-
if (opts.flagEnabled || isExperimentalApiEnabled(opts.env)) {
|
|
42949
|
-
return;
|
|
42950
|
-
}
|
|
42951
|
-
throw new Error(
|
|
42952
|
-
`The \`posthog-cli api\` command group is experimental. Set ${EXPERIMENTAL_API_ENV}=1 or pass --experimental to use it.`
|
|
42953
|
-
);
|
|
42954
|
-
}
|
|
42955
|
-
|
|
42956
43078
|
// src/cli/agent-help.ts
|
|
42957
43079
|
var AGENT_HELP_HEADER = `# PostHog API guide for agents
|
|
42958
43080
|
|
|
42959
43081
|
\`posthog-cli api\` is the agent-first interface to the PostHog API. It exposes the same tool surface as the PostHog MCP server's \`exec\` tool, so the reference below is the canonical guide for interacting with PostHog. Treat it as instructions to follow, not just documentation.
|
|
42960
43082
|
|
|
42961
|
-
The command group is experimental: pass \`--experimental\` right after \`api\`, or set \`${EXPERIMENTAL_API_ENV}=1\` in the environment.
|
|
42962
|
-
|
|
42963
43083
|
On top of the reference below, the CLI adds:
|
|
42964
43084
|
|
|
42965
43085
|
- \`posthog-cli api call --dry-run <tool> '<json>'\` \u2014 validate input against the tool schema without executing. Use it before any mutation.
|
|
@@ -43011,7 +43131,7 @@ import * as fs from "node:fs/promises";
|
|
|
43011
43131
|
import * as path from "node:path";
|
|
43012
43132
|
|
|
43013
43133
|
// src/cli/agents-md-snippet.md
|
|
43014
|
-
var agents_md_snippet_default = "## PostHog\n\nUse `posthog-cli api` for all PostHog-related queries and operations. You should use `posthog-cli api` over direct MCP tool calls whenever the CLI is available
|
|
43134
|
+
var agents_md_snippet_default = "## PostHog\n\nUse `posthog-cli api` for all PostHog-related data queries and operations. You should use `posthog-cli api` over direct MCP tool calls whenever the CLI is available.\n\nBefore your first PostHog command in a session, run `posthog-cli api --agent-help` and load its full output into your context. It prints the complete agent guide \u2014 command reference, schema drill-down rules, data discovery workflow, and the tool index \u2014 for interacting with PostHog APIs. Treat that output as instructions to follow, not just documentation.\n\nBefore starting a PostHog task, run `posthog-cli api skill list` and check for a skill matching the task. If one matches, install it with `posthog-cli api skill install <skill-id>` (add `--force` to refresh an already-installed skill), then read `.agents/skills/<skill-id>/SKILL.md` and follow it. Skills contain task-specific workflows that individual tools do not.\n";
|
|
43015
43135
|
|
|
43016
43136
|
// src/cli/utils.ts
|
|
43017
43137
|
function errorCode(error48) {
|
|
@@ -43260,7 +43380,7 @@ var package_default = {
|
|
|
43260
43380
|
"@hono/node-server": "^2.0.2",
|
|
43261
43381
|
"@modelcontextprotocol/ext-apps": "^1.5.0",
|
|
43262
43382
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
43263
|
-
"@posthog/mcp-analytics": "npm:@posthog/mcp@0.
|
|
43383
|
+
"@posthog/mcp-analytics": "npm:@posthog/mcp@0.4.0",
|
|
43264
43384
|
"@posthog/quill": "workspace:*",
|
|
43265
43385
|
"@posthog/quill-charts": "workspace:*",
|
|
43266
43386
|
"@toon-format/toon": "^2.1.0",
|
|
@@ -55324,6 +55444,7 @@ var EvaluationsCreateParams = /* @__PURE__ */ object({
|
|
|
55324
55444
|
)
|
|
55325
55445
|
});
|
|
55326
55446
|
var evaluationsCreateBodyNameMax = 400;
|
|
55447
|
+
var evaluationsCreateBodyEvaluationConfigThreeSourceDefault = `user_messages`;
|
|
55327
55448
|
var evaluationsCreateBodyOutputConfigAllowsNaDefault = false;
|
|
55328
55449
|
var evaluationsCreateBodyConditionsItemIdMax = 100;
|
|
55329
55450
|
var evaluationsCreateBodyConditionsItemRolloutPercentageDefault = 100;
|
|
@@ -55334,8 +55455,8 @@ var EvaluationsCreateBody = /* @__PURE__ */ object({
|
|
|
55334
55455
|
name: string2().max(evaluationsCreateBodyNameMax).describe("Name of the evaluation."),
|
|
55335
55456
|
description: string2().optional().describe("Optional description of what this evaluation checks."),
|
|
55336
55457
|
enabled: boolean2().optional().describe("Whether the evaluation runs automatically on new $ai_generation events."),
|
|
55337
|
-
evaluation_type: _enum2(["llm_judge", "hog"]).describe("* `llm_judge` - LLM as a judge\n* `hog` - Hog").describe(
|
|
55338
|
-
"'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code.\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog"
|
|
55458
|
+
evaluation_type: _enum2(["llm_judge", "hog", "sentiment"]).describe("* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis").describe(
|
|
55459
|
+
"'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis"
|
|
55339
55460
|
),
|
|
55340
55461
|
evaluation_config: union([
|
|
55341
55462
|
object({
|
|
@@ -55343,9 +55464,16 @@ var EvaluationsCreateBody = /* @__PURE__ */ object({
|
|
|
55343
55464
|
}),
|
|
55344
55465
|
object({
|
|
55345
55466
|
source: string2().min(1).describe("Hog source code. Must return true (pass), false (fail), or null for N/A.")
|
|
55467
|
+
}),
|
|
55468
|
+
object({
|
|
55469
|
+
source: _enum2(["user_messages"]).default(evaluationsCreateBodyEvaluationConfigThreeSourceDefault).describe("Classify sentiment from user messages in the generation input.")
|
|
55346
55470
|
})
|
|
55347
|
-
]).optional().describe(
|
|
55348
|
-
|
|
55471
|
+
]).optional().describe(
|
|
55472
|
+
"Configuration dict. For 'llm_judge': {prompt}; for 'hog': {source}; for 'sentiment': {source: 'user_messages'}."
|
|
55473
|
+
),
|
|
55474
|
+
output_type: _enum2(["boolean", "sentiment"]).describe("* `boolean` - Boolean (Pass/Fail)\n* `sentiment` - Sentiment").describe(
|
|
55475
|
+
"Output format. Use 'boolean' for pass/fail evaluations and 'sentiment' for sentiment analysis.\n\n* `boolean` - Boolean (Pass/Fail)\n* `sentiment` - Sentiment"
|
|
55476
|
+
),
|
|
55349
55477
|
output_config: object({
|
|
55350
55478
|
allows_na: boolean2().default(evaluationsCreateBodyOutputConfigAllowsNaDefault).describe("Whether the evaluation can return N/A for non-applicable generations.")
|
|
55351
55479
|
}).optional().describe("Output config. For 'boolean' output_type: {allows_na} to permit N/A results."),
|
|
@@ -55396,6 +55524,7 @@ var EvaluationsPartialUpdateParams = /* @__PURE__ */ object({
|
|
|
55396
55524
|
)
|
|
55397
55525
|
});
|
|
55398
55526
|
var evaluationsPartialUpdateBodyNameMax = 400;
|
|
55527
|
+
var evaluationsPartialUpdateBodyEvaluationConfigThreeSourceDefault = `user_messages`;
|
|
55399
55528
|
var evaluationsPartialUpdateBodyOutputConfigAllowsNaDefault = false;
|
|
55400
55529
|
var evaluationsPartialUpdateBodyConditionsItemIdMax = 100;
|
|
55401
55530
|
var evaluationsPartialUpdateBodyConditionsItemRolloutPercentageDefault = 100;
|
|
@@ -55406,8 +55535,8 @@ var EvaluationsPartialUpdateBody = /* @__PURE__ */ object({
|
|
|
55406
55535
|
name: string2().max(evaluationsPartialUpdateBodyNameMax).optional().describe("Name of the evaluation."),
|
|
55407
55536
|
description: string2().optional().describe("Optional description of what this evaluation checks."),
|
|
55408
55537
|
enabled: boolean2().optional().describe("Whether the evaluation runs automatically on new $ai_generation events."),
|
|
55409
|
-
evaluation_type: _enum2(["llm_judge", "hog"]).describe("* `llm_judge` - LLM as a judge\n* `hog` - Hog").optional().describe(
|
|
55410
|
-
"'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code.\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog"
|
|
55538
|
+
evaluation_type: _enum2(["llm_judge", "hog", "sentiment"]).describe("* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis").optional().describe(
|
|
55539
|
+
"'llm_judge' uses an LLM to score outputs against a prompt; 'hog' runs deterministic Hog code; 'sentiment' classifies user-message sentiment.\n\n* `llm_judge` - LLM as a judge\n* `hog` - Hog\n* `sentiment` - Sentiment analysis"
|
|
55411
55540
|
),
|
|
55412
55541
|
evaluation_config: union([
|
|
55413
55542
|
object({
|
|
@@ -55415,9 +55544,16 @@ var EvaluationsPartialUpdateBody = /* @__PURE__ */ object({
|
|
|
55415
55544
|
}),
|
|
55416
55545
|
object({
|
|
55417
55546
|
source: string2().min(1).describe("Hog source code. Must return true (pass), false (fail), or null for N/A.")
|
|
55547
|
+
}),
|
|
55548
|
+
object({
|
|
55549
|
+
source: _enum2(["user_messages"]).default(evaluationsPartialUpdateBodyEvaluationConfigThreeSourceDefault).describe("Classify sentiment from user messages in the generation input.")
|
|
55418
55550
|
})
|
|
55419
|
-
]).optional().describe(
|
|
55420
|
-
|
|
55551
|
+
]).optional().describe(
|
|
55552
|
+
"Configuration dict. For 'llm_judge': {prompt}; for 'hog': {source}; for 'sentiment': {source: 'user_messages'}."
|
|
55553
|
+
),
|
|
55554
|
+
output_type: _enum2(["boolean", "sentiment"]).describe("* `boolean` - Boolean (Pass/Fail)\n* `sentiment` - Sentiment").optional().describe(
|
|
55555
|
+
"Output format. Use 'boolean' for pass/fail evaluations and 'sentiment' for sentiment analysis.\n\n* `boolean` - Boolean (Pass/Fail)\n* `sentiment` - Sentiment"
|
|
55556
|
+
),
|
|
55421
55557
|
output_config: object({
|
|
55422
55558
|
allows_na: boolean2().default(evaluationsPartialUpdateBodyOutputConfigAllowsNaDefault).describe("Whether the evaluation can return N/A for non-applicable generations.")
|
|
55423
55559
|
}).optional().describe("Output config. For 'boolean' output_type: {allows_na} to permit N/A results."),
|
|
@@ -82570,11 +82706,29 @@ var AssistantTrendsFilter = external_exports.object({
|
|
|
82570
82706
|
"BoxPlot",
|
|
82571
82707
|
"SlopeGraph"
|
|
82572
82708
|
]).describe(
|
|
82573
|
-
"Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then."
|
|
82709
|
+
"Visualization type. Available values: `ActionsLineGraph` - time-series line chart; most common option, as it shows change over time. `ActionsBar` - time-series bar chart. `ActionsAreaGraph` - time-series area chart. `ActionsLineGraphCumulative` - cumulative time-series line chart; good for cumulative metrics. `BoldNumber` - total value single large number. Use when user explicitly asks for a single output number. You CANNOT use this with breakdown or if the insight has more than one series. `Metric` - single large number with a period-over-period change pill and a sparkline. Like `BoldNumber` but trend-aware; configure it with the `metric*` fields below. Single series, no breakdown. `ActionsBarValue` - total value (NOT time-series) bar chart; good for categorical data. `ActionsPie` - total value pie chart; good for visualizing proportions. `ActionsTable` - total value table; good when using breakdown to list users or other entities. `WorldMap` - total value world map; use when breaking down by country name using property `$geoip_country_name`, and only then."
|
|
82574
82710
|
).default("ActionsLineGraph").optional(),
|
|
82575
82711
|
formulaNodes: external_exports.array(TrendsFormulaNode).describe(
|
|
82576
82712
|
"Use custom formulas to perform mathematical operations like calculating percentages or metrics. Use the following syntax: `A/B`, where `A` and `B` are the names of the series. You can combine math aggregations and formulas. When using a formula, you must:\n- Identify and specify **all** events and actions needed to solve the formula.\n- Carefully review the list of available events and actions to find appropriate entities for each part of the formula.\n- Ensure that you find events and actions corresponding to both the numerator and denominator in ratio calculations. Examples of using math formulas:\n- If you want to calculate the percentage of users who have completed onboarding, you need to find and use events or actions similar to `$identify` and `onboarding complete`, so the formula will be `A / B`, where `A` is `onboarding complete` (unique users) and `B` is `$identify` (unique users)."
|
|
82577
82713
|
).optional(),
|
|
82714
|
+
metricChangeDecreaseColor: external_exports.string().describe(
|
|
82715
|
+
'Only applies when `display` is `Metric`. Hex color (e.g. `#db3707`) for the change pill when the metric went DOWN. Defaults to red (`#db3707`). For a "lower is better" metric (latency, error rate, cost), set this to a green (e.g. `#388600`) so a decrease reads as good.'
|
|
82716
|
+
).optional(),
|
|
82717
|
+
metricChangeIncreaseColor: external_exports.string().describe(
|
|
82718
|
+
'Only applies when `display` is `Metric`. Hex color (e.g. `#388600`) for the change pill when the metric went UP. Defaults to green (`#388600`). For a "lower is better" metric (latency, error rate, cost), set this to a red (e.g. `#db3707`) so an increase reads as bad.'
|
|
82719
|
+
).optional(),
|
|
82720
|
+
metricColorByDirection: external_exports.coerce.boolean().describe(
|
|
82721
|
+
"Only applies when `display` is `Metric`. Color the sparkline under the big number by whether the metric increased or decreased over the period (using the increase/decrease line colors)."
|
|
82722
|
+
).default(false).optional(),
|
|
82723
|
+
metricLineDecreaseColor: external_exports.string().describe(
|
|
82724
|
+
'Only applies when `display` is `Metric` and `metricColorByDirection` is `true`. Hex color for the sparkline when the metric went DOWN. Defaults to red (`#db3707`). Flip to a green for a "lower is better" metric.'
|
|
82725
|
+
).optional(),
|
|
82726
|
+
metricLineIncreaseColor: external_exports.string().describe(
|
|
82727
|
+
'Only applies when `display` is `Metric` and `metricColorByDirection` is `true`. Hex color for the sparkline when the metric went UP. Defaults to green (`#388600`). Flip to a red for a "lower is better" metric.'
|
|
82728
|
+
).optional(),
|
|
82729
|
+
metricShowChange: external_exports.coerce.boolean().describe(
|
|
82730
|
+
"Only applies when `display` is `Metric`. Show the change pill next to the big number \u2014 the percentage change from the first to the last point of the series over the selected date range."
|
|
82731
|
+
).default(true).optional(),
|
|
82578
82732
|
showAlertThresholdLines: external_exports.coerce.boolean().describe("Whether to show alert threshold lines on the chart.").default(false).optional(),
|
|
82579
82733
|
showLabelsOnSeries: external_exports.coerce.boolean().describe("Whether to show labels on each series.").default(false).optional(),
|
|
82580
82734
|
showLegend: external_exports.coerce.boolean().describe("Whether to show the legend describing series and breakdowns.").default(false).optional(),
|
|
@@ -89630,21 +89784,21 @@ var ExternalDataSchemasPartialUpdateParams = /* @__PURE__ */ object({
|
|
|
89630
89784
|
var ExternalDataSchemasPartialUpdateBody = /* @__PURE__ */ object({
|
|
89631
89785
|
should_sync: boolean2().optional(),
|
|
89632
89786
|
sync_type: union([
|
|
89633
|
-
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc"]).describe(
|
|
89634
|
-
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89787
|
+
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc", "xmin"]).describe(
|
|
89788
|
+
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89635
89789
|
),
|
|
89636
89790
|
_null3()
|
|
89637
89791
|
]).optional().describe(
|
|
89638
|
-
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89792
|
+
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89639
89793
|
),
|
|
89640
89794
|
incremental_field: string2().nullish().describe("Column name used to track sync progress."),
|
|
89641
89795
|
incremental_field_type: union([
|
|
89642
|
-
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid"]).describe(
|
|
89643
|
-
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
89796
|
+
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid", "xid"]).describe(
|
|
89797
|
+
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89644
89798
|
),
|
|
89645
89799
|
_null3()
|
|
89646
89800
|
]).optional().describe(
|
|
89647
|
-
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
89801
|
+
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89648
89802
|
),
|
|
89649
89803
|
sync_frequency: union([
|
|
89650
89804
|
_enum2([
|
|
@@ -89698,21 +89852,21 @@ var ExternalDataSchemasCancelCreateParams = /* @__PURE__ */ object({
|
|
|
89698
89852
|
var ExternalDataSchemasCancelCreateBody = /* @__PURE__ */ object({
|
|
89699
89853
|
should_sync: boolean2().optional(),
|
|
89700
89854
|
sync_type: union([
|
|
89701
|
-
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc"]).describe(
|
|
89702
|
-
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89855
|
+
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc", "xmin"]).describe(
|
|
89856
|
+
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89703
89857
|
),
|
|
89704
89858
|
_null3()
|
|
89705
89859
|
]).optional().describe(
|
|
89706
|
-
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89860
|
+
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89707
89861
|
),
|
|
89708
89862
|
incremental_field: string2().nullish().describe("Column name used to track sync progress."),
|
|
89709
89863
|
incremental_field_type: union([
|
|
89710
|
-
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid"]).describe(
|
|
89711
|
-
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
89864
|
+
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid", "xid"]).describe(
|
|
89865
|
+
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89712
89866
|
),
|
|
89713
89867
|
_null3()
|
|
89714
89868
|
]).optional().describe(
|
|
89715
|
-
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
89869
|
+
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89716
89870
|
),
|
|
89717
89871
|
sync_frequency: union([
|
|
89718
89872
|
_enum2([
|
|
@@ -89772,21 +89926,21 @@ var ExternalDataSchemasIncrementalFieldsCreateParams = /* @__PURE__ */ object({
|
|
|
89772
89926
|
var ExternalDataSchemasIncrementalFieldsCreateBody = /* @__PURE__ */ object({
|
|
89773
89927
|
should_sync: boolean2().optional(),
|
|
89774
89928
|
sync_type: union([
|
|
89775
|
-
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc"]).describe(
|
|
89776
|
-
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89929
|
+
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc", "xmin"]).describe(
|
|
89930
|
+
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89777
89931
|
),
|
|
89778
89932
|
_null3()
|
|
89779
89933
|
]).optional().describe(
|
|
89780
|
-
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89934
|
+
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89781
89935
|
),
|
|
89782
89936
|
incremental_field: string2().nullish().describe("Column name used to track sync progress."),
|
|
89783
89937
|
incremental_field_type: union([
|
|
89784
|
-
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid"]).describe(
|
|
89785
|
-
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
89938
|
+
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid", "xid"]).describe(
|
|
89939
|
+
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89786
89940
|
),
|
|
89787
89941
|
_null3()
|
|
89788
89942
|
]).optional().describe(
|
|
89789
|
-
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
89943
|
+
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89790
89944
|
),
|
|
89791
89945
|
sync_frequency: union([
|
|
89792
89946
|
_enum2([
|
|
@@ -89840,21 +89994,21 @@ var ExternalDataSchemasReloadCreateParams = /* @__PURE__ */ object({
|
|
|
89840
89994
|
var ExternalDataSchemasReloadCreateBody = /* @__PURE__ */ object({
|
|
89841
89995
|
should_sync: boolean2().optional(),
|
|
89842
89996
|
sync_type: union([
|
|
89843
|
-
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc"]).describe(
|
|
89844
|
-
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
89997
|
+
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc", "xmin"]).describe(
|
|
89998
|
+
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89845
89999
|
),
|
|
89846
90000
|
_null3()
|
|
89847
90001
|
]).optional().describe(
|
|
89848
|
-
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
90002
|
+
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89849
90003
|
),
|
|
89850
90004
|
incremental_field: string2().nullish().describe("Column name used to track sync progress."),
|
|
89851
90005
|
incremental_field_type: union([
|
|
89852
|
-
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid"]).describe(
|
|
89853
|
-
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
90006
|
+
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid", "xid"]).describe(
|
|
90007
|
+
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89854
90008
|
),
|
|
89855
90009
|
_null3()
|
|
89856
90010
|
]).optional().describe(
|
|
89857
|
-
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
90011
|
+
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89858
90012
|
),
|
|
89859
90013
|
sync_frequency: union([
|
|
89860
90014
|
_enum2([
|
|
@@ -89908,21 +90062,21 @@ var ExternalDataSchemasResyncCreateParams = /* @__PURE__ */ object({
|
|
|
89908
90062
|
var ExternalDataSchemasResyncCreateBody = /* @__PURE__ */ object({
|
|
89909
90063
|
should_sync: boolean2().optional(),
|
|
89910
90064
|
sync_type: union([
|
|
89911
|
-
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc"]).describe(
|
|
89912
|
-
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
90065
|
+
_enum2(["full_refresh", "incremental", "append", "webhook", "cdc", "xmin"]).describe(
|
|
90066
|
+
"* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89913
90067
|
),
|
|
89914
90068
|
_null3()
|
|
89915
90069
|
]).optional().describe(
|
|
89916
|
-
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc"
|
|
90070
|
+
"Sync strategy: incremental, full_refresh, append, or cdc.\n\n* `full_refresh` - full_refresh\n* `incremental` - incremental\n* `append` - append\n* `webhook` - webhook\n* `cdc` - cdc\n* `xmin` - xmin"
|
|
89917
90071
|
),
|
|
89918
90072
|
incremental_field: string2().nullish().describe("Column name used to track sync progress."),
|
|
89919
90073
|
incremental_field_type: union([
|
|
89920
|
-
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid"]).describe(
|
|
89921
|
-
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
90074
|
+
_enum2(["integer", "numeric", "datetime", "date", "timestamp", "objectid", "xid"]).describe(
|
|
90075
|
+
"* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89922
90076
|
),
|
|
89923
90077
|
_null3()
|
|
89924
90078
|
]).optional().describe(
|
|
89925
|
-
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid"
|
|
90079
|
+
"Data type of the incremental field.\n\n* `integer` - integer\n* `numeric` - numeric\n* `datetime` - datetime\n* `date` - date\n* `timestamp` - timestamp\n* `objectid` - objectid\n* `xid` - xid"
|
|
89926
90080
|
),
|
|
89927
90081
|
sync_frequency: union([
|
|
89928
90082
|
_enum2([
|
|
@@ -100075,7 +100229,6 @@ var TOOL_MAP = {
|
|
|
100075
100229
|
};
|
|
100076
100230
|
|
|
100077
100231
|
// src/cli/tools.ts
|
|
100078
|
-
var warnedSkippedTools = /* @__PURE__ */ new Set();
|
|
100079
100232
|
function materializeTool(name, factory, definition) {
|
|
100080
100233
|
return {
|
|
100081
100234
|
...factory(),
|
|
@@ -100085,16 +100238,6 @@ function materializeTool(name, factory, definition) {
|
|
|
100085
100238
|
annotations: definition.annotations
|
|
100086
100239
|
};
|
|
100087
100240
|
}
|
|
100088
|
-
function warnSkippedTool(name, reason) {
|
|
100089
|
-
const detail = reason instanceof Error ? reason.message : String(reason);
|
|
100090
|
-
const warningKey = `${name}:${detail}`;
|
|
100091
|
-
if (warnedSkippedTools.has(warningKey)) {
|
|
100092
|
-
return;
|
|
100093
|
-
}
|
|
100094
|
-
warnedSkippedTools.add(warningKey);
|
|
100095
|
-
process.stderr.write(`Warning: Skipping PostHog API tool "${name}": ${detail}
|
|
100096
|
-
`);
|
|
100097
|
-
}
|
|
100098
100241
|
function getCliTools(options = {}) {
|
|
100099
100242
|
const factories = {
|
|
100100
100243
|
...TOOL_MAP,
|
|
@@ -100107,14 +100250,12 @@ function getCliTools(options = {}) {
|
|
|
100107
100250
|
for (const name of names) {
|
|
100108
100251
|
const factory = factories[name];
|
|
100109
100252
|
if (!factory) {
|
|
100110
|
-
warnSkippedTool(name, "no implementation factory was registered");
|
|
100111
100253
|
continue;
|
|
100112
100254
|
}
|
|
100113
100255
|
try {
|
|
100114
100256
|
const definition = getToolDefinition(name);
|
|
100115
100257
|
tools.push(materializeTool(name, () => factory(), definition));
|
|
100116
|
-
} catch
|
|
100117
|
-
warnSkippedTool(name, error48);
|
|
100258
|
+
} catch {
|
|
100118
100259
|
continue;
|
|
100119
100260
|
}
|
|
100120
100261
|
}
|
|
@@ -100132,7 +100273,6 @@ function usage() {
|
|
|
100132
100273
|
return `PostHog agent CLI
|
|
100133
100274
|
|
|
100134
100275
|
Usage:
|
|
100135
|
-
posthog-cli api --experimental <command>
|
|
100136
100276
|
posthog-cli api --agent-help
|
|
100137
100277
|
posthog-cli api tools
|
|
100138
100278
|
posthog-cli api search <regex>
|
|
@@ -100143,7 +100283,6 @@ Usage:
|
|
|
100143
100283
|
posthog-cli api skill install [--force] <skill-id>
|
|
100144
100284
|
posthog-cli api agents-md install [--path AGENTS.md]
|
|
100145
100285
|
|
|
100146
|
-
Experimental: set ${EXPERIMENTAL_API_ENV}=1 or pass --experimental to enable this command group.
|
|
100147
100286
|
Destructive tools require --confirm when executed. Use --dry-run before mutations.
|
|
100148
100287
|
Agents: run \`posthog-cli api --agent-help\` and load the output into context before anything else.`;
|
|
100149
100288
|
}
|
|
@@ -100164,6 +100303,20 @@ function printResult(result) {
|
|
|
100164
100303
|
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
100165
100304
|
`);
|
|
100166
100305
|
}
|
|
100306
|
+
function buildStaticExec() {
|
|
100307
|
+
const tools = getCliTools();
|
|
100308
|
+
const execTool = createExecTool(
|
|
100309
|
+
tools,
|
|
100310
|
+
void 0,
|
|
100311
|
+
"Execute a PostHog CLI command",
|
|
100312
|
+
COMMAND_REFERENCE,
|
|
100313
|
+
"posthog-cli",
|
|
100314
|
+
void 0,
|
|
100315
|
+
[],
|
|
100316
|
+
{ requireDestructiveConfirmation: true }
|
|
100317
|
+
);
|
|
100318
|
+
return { execTool, tools };
|
|
100319
|
+
}
|
|
100167
100320
|
async function buildExec(config2 = resolveCliConfig()) {
|
|
100168
100321
|
const context = await buildCliContext(config2);
|
|
100169
100322
|
const aiConsentGiven = await context.stateManager.getAiConsentGiven();
|
|
@@ -100187,12 +100340,15 @@ async function buildExec(config2 = resolveCliConfig()) {
|
|
|
100187
100340
|
[],
|
|
100188
100341
|
{ requireDestructiveConfirmation: true }
|
|
100189
100342
|
);
|
|
100190
|
-
return {
|
|
100343
|
+
return { context, execTool, tools };
|
|
100191
100344
|
}
|
|
100192
|
-
|
|
100193
|
-
|
|
100194
|
-
|
|
100195
|
-
|
|
100345
|
+
function buildAgentHelpForStaticCatalog() {
|
|
100346
|
+
return buildAgentHelp(getCliTools());
|
|
100347
|
+
}
|
|
100348
|
+
async function runStaticExecCommand(command) {
|
|
100349
|
+
const { execTool } = buildStaticExec();
|
|
100350
|
+
const result = await execTool.handler(void 0, { command });
|
|
100351
|
+
printResult(result);
|
|
100196
100352
|
}
|
|
100197
100353
|
async function runExecCommand(command) {
|
|
100198
100354
|
const config2 = resolveCliConfig();
|
|
@@ -100211,7 +100367,7 @@ async function runDryCall(args) {
|
|
|
100211
100367
|
if (!toolName) {
|
|
100212
100368
|
throw new Error("Usage: posthog-cli api call --dry-run [--json] [--confirm] <tool> <json>");
|
|
100213
100369
|
}
|
|
100214
|
-
const { tools } =
|
|
100370
|
+
const { tools } = buildStaticExec();
|
|
100215
100371
|
const tool14 = tools.find((candidate) => candidate.name === toolName);
|
|
100216
100372
|
if (!tool14) {
|
|
100217
100373
|
throw new Error(`Unknown tool: "${toolName}". Run "posthog-cli api search <term>".`);
|
|
@@ -100275,7 +100431,6 @@ async function runAgentsMdCommand(args) {
|
|
|
100275
100431
|
}
|
|
100276
100432
|
async function main() {
|
|
100277
100433
|
const args = process.argv.slice(2);
|
|
100278
|
-
const experimental = takeFlag(args, "--experimental");
|
|
100279
100434
|
const command = args.shift();
|
|
100280
100435
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
100281
100436
|
process.stdout.write(`${usage()}
|
|
@@ -100283,17 +100438,16 @@ async function main() {
|
|
|
100283
100438
|
return;
|
|
100284
100439
|
}
|
|
100285
100440
|
if (command === "agent-help" || command === "--agent-help") {
|
|
100286
|
-
process.stdout.write(`${
|
|
100441
|
+
process.stdout.write(`${buildAgentHelpForStaticCatalog()}
|
|
100287
100442
|
`);
|
|
100288
100443
|
return;
|
|
100289
100444
|
}
|
|
100290
|
-
requireExperimentalApiEnabled({ flagEnabled: experimental });
|
|
100291
100445
|
switch (command) {
|
|
100292
100446
|
case "tools":
|
|
100293
|
-
await
|
|
100447
|
+
await runStaticExecCommand("tools");
|
|
100294
100448
|
return;
|
|
100295
100449
|
case "search":
|
|
100296
|
-
await
|
|
100450
|
+
await runStaticExecCommand(`search ${args.join(" ")}`);
|
|
100297
100451
|
return;
|
|
100298
100452
|
case "info": {
|
|
100299
100453
|
const json2 = takeFlag(args, "--json");
|
|
@@ -100301,7 +100455,7 @@ async function main() {
|
|
|
100301
100455
|
if (!toolName) {
|
|
100302
100456
|
throw new Error("Usage: posthog-cli api info [--json] <tool>");
|
|
100303
100457
|
}
|
|
100304
|
-
await
|
|
100458
|
+
await runStaticExecCommand(`info ${json2 ? "--json " : ""}${toolName}`);
|
|
100305
100459
|
return;
|
|
100306
100460
|
}
|
|
100307
100461
|
case "schema": {
|
|
@@ -100309,7 +100463,7 @@ async function main() {
|
|
|
100309
100463
|
if (!toolName) {
|
|
100310
100464
|
throw new Error("Usage: posthog-cli api schema <tool> [field.path]");
|
|
100311
100465
|
}
|
|
100312
|
-
await
|
|
100466
|
+
await runStaticExecCommand(`schema ${toolName}${args[0] ? ` ${args[0]}` : ""}`);
|
|
100313
100467
|
return;
|
|
100314
100468
|
}
|
|
100315
100469
|
case "call": {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"hasInstallScript": true,
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"name": "@posthog/cli",
|
|
22
|
-
"version": "0.7.
|
|
22
|
+
"version": "0.7.29"
|
|
23
23
|
},
|
|
24
24
|
"node_modules/detect-libc": {
|
|
25
25
|
"engines": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"requires": true,
|
|
51
|
-
"version": "0.7.
|
|
51
|
+
"version": "0.7.29"
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"artifactDownloadUrls": [
|
|
3
|
-
"https://github.com/PostHog/posthog/releases/download/posthog-cli/v0.7.
|
|
3
|
+
"https://github.com/PostHog/posthog/releases/download/posthog-cli/v0.7.29"
|
|
4
4
|
],
|
|
5
5
|
"bin": {
|
|
6
6
|
"posthog-cli": "run-posthog-cli.js"
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"zipExt": ".tar.gz"
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
"version": "0.7.
|
|
117
|
+
"version": "0.7.29",
|
|
118
118
|
"volta": {
|
|
119
119
|
"node": "18.14.1",
|
|
120
120
|
"npm": "9.5.0"
|