@shipeasy/openapi 1.6.0 → 2.1.0
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/README.md +37 -0
- package/dist/chunk-EPLLHLZN.js +1616 -0
- package/dist/chunk-EPLLHLZN.js.map +1 -0
- package/dist/chunk-SPH5HWCD.js +3326 -0
- package/dist/chunk-SPH5HWCD.js.map +1 -0
- package/dist/client-pVkoo3Bf.d.ts +11186 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +215 -0
- package/dist/client.js.map +1 -0
- package/dist/custom.d.ts +64 -0
- package/dist/custom.js +292 -0
- package/dist/custom.js.map +1 -0
- package/dist/index.d.ts +29 -41
- package/dist/index.js +258 -4375
- package/dist/index.js.map +1 -0
- package/dist/node-context.d.ts +81 -33
- package/dist/node-context.js +98 -44
- package/dist/node-context.js.map +1 -0
- package/dist/schemas.d.ts +7920 -0
- package/dist/schemas.js +1083 -0
- package/dist/schemas.js.map +1 -0
- package/openapi.json +15297 -3044
- package/openapi.yaml +13979 -0
- package/package.json +33 -26
- package/spec/components/errors.yaml +53 -0
- package/spec/components/parameters.yaml +24 -0
- package/spec/components/responses.yaml +107 -0
- package/spec/components/schemas/alert-rules.yaml +175 -0
- package/spec/components/schemas/attributes.yaml +157 -0
- package/spec/components/schemas/common.yaml +87 -0
- package/spec/components/schemas/configs.yaml +371 -0
- package/spec/components/schemas/connectors.yaml +593 -0
- package/spec/components/schemas/errors-api.yaml +209 -0
- package/spec/components/schemas/events.yaml +321 -0
- package/spec/components/schemas/experiments.yaml +865 -0
- package/spec/components/schemas/gate-templates.yaml +198 -0
- package/spec/components/schemas/gates.yaml +890 -0
- package/spec/components/schemas/i18n.yaml +478 -0
- package/spec/components/schemas/keys.yaml +186 -0
- package/spec/components/schemas/killswitches.yaml +309 -0
- package/spec/components/schemas/metrics.yaml +547 -0
- package/spec/components/schemas/ops.yaml +1011 -0
- package/spec/components/schemas/projects.yaml +222 -0
- package/spec/components/schemas/search.yaml +46 -0
- package/spec/components/schemas/universes.yaml +127 -0
- package/spec/openapi.yaml +348 -0
- package/spec/paths/alert-rules.yaml +250 -0
- package/spec/paths/attributes.yaml +261 -0
- package/spec/paths/configs.yaml +744 -0
- package/spec/paths/connectors.yaml +748 -0
- package/spec/paths/errors.yaml +382 -0
- package/spec/paths/events.yaml +366 -0
- package/spec/paths/experiments.yaml +777 -0
- package/spec/paths/gate-templates.yaml +263 -0
- package/spec/paths/gates.yaml +451 -0
- package/spec/paths/i18n.yaml +544 -0
- package/spec/paths/keys.yaml +181 -0
- package/spec/paths/killswitches.yaml +557 -0
- package/spec/paths/metrics.yaml +302 -0
- package/spec/paths/ops.yaml +446 -0
- package/spec/paths/projects.yaml +210 -0
- package/spec/paths/search.yaml +62 -0
- package/spec/paths/universes.yaml +247 -0
- package/dist/operations/attributes.d.ts +0 -33
- package/dist/operations/attributes.js +0 -16
- package/dist/operations/cli-adapter.d.ts +0 -35
- package/dist/operations/cli-adapter.js +0 -91
- package/dist/operations/coerce.d.ts +0 -32
- package/dist/operations/coerce.js +0 -53
- package/dist/operations/configs.d.ts +0 -28
- package/dist/operations/configs.js +0 -119
- package/dist/operations/docs.d.ts +0 -37
- package/dist/operations/docs.js +0 -39
- package/dist/operations/events.d.ts +0 -28
- package/dist/operations/events.js +0 -121
- package/dist/operations/experiments.d.ts +0 -28
- package/dist/operations/experiments.js +0 -280
- package/dist/operations/gates.d.ts +0 -28
- package/dist/operations/gates.js +0 -132
- package/dist/operations/i18n.d.ts +0 -28
- package/dist/operations/i18n.js +0 -121
- package/dist/operations/index.d.ts +0 -63
- package/dist/operations/index.js +0 -1751
- package/dist/operations/killswitches.d.ts +0 -28
- package/dist/operations/killswitches.js +0 -126
- package/dist/operations/mcp-adapter.d.ts +0 -35
- package/dist/operations/mcp-adapter.js +0 -94
- package/dist/operations/metrics.d.ts +0 -30
- package/dist/operations/metrics.js +0 -114
- package/dist/operations/ops.d.ts +0 -28
- package/dist/operations/ops.js +0 -313
- package/dist/operations/projects.d.ts +0 -28
- package/dist/operations/projects.js +0 -36
- package/dist/operations/sdk-docs.d.ts +0 -28
- package/dist/operations/sdk-docs.js +0 -160
- package/dist/operations/types.d.ts +0 -138
- package/dist/operations/types.js +0 -9
- package/dist/operations/universes.d.ts +0 -28
- package/dist/operations/universes.js +0 -93
- package/dist/operations/util.d.ts +0 -33
- package/dist/operations/util.js +0 -9
- package/dist/resources/alert-rules.d.ts +0 -50
- package/dist/resources/alert-rules.js +0 -75
- package/dist/resources/attributes.d.ts +0 -19
- package/dist/resources/attributes.js +0 -10
- package/dist/resources/configs.d.ts +0 -681
- package/dist/resources/configs.js +0 -509
- package/dist/resources/events.d.ts +0 -61
- package/dist/resources/events.js +0 -42
- package/dist/resources/experiments.d.ts +0 -849
- package/dist/resources/experiments.js +0 -707
- package/dist/resources/gates.d.ts +0 -808
- package/dist/resources/gates.js +0 -522
- package/dist/resources/i18n.d.ts +0 -84
- package/dist/resources/i18n.js +0 -60
- package/dist/resources/index.d.ts +0 -2767
- package/dist/resources/index.js +0 -2563
- package/dist/resources/killswitches.d.ts +0 -436
- package/dist/resources/killswitches.js +0 -514
- package/dist/resources/metrics.d.ts +0 -54
- package/dist/resources/metrics.js +0 -40
- package/dist/resources/ops.d.ts +0 -88
- package/dist/resources/ops.js +0 -36
- package/dist/resources/projects.d.ts +0 -54
- package/dist/resources/projects.js +0 -14
- package/dist/resources/universes.d.ts +0 -185
- package/dist/resources/universes.js +0 -234
- package/dist/schemas/alert-rules.d.ts +0 -65
- package/dist/schemas/alert-rules.js +0 -37
- package/dist/schemas/configs.d.ts +0 -154
- package/dist/schemas/configs.js +0 -134
- package/dist/schemas/constants.d.ts +0 -6
- package/dist/schemas/constants.js +0 -7
- package/dist/schemas/experiments.d.ts +0 -229
- package/dist/schemas/experiments.js +0 -221
- package/dist/schemas/folder.d.ts +0 -10
- package/dist/schemas/folder.js +0 -8
- package/dist/schemas/gates.d.ts +0 -386
- package/dist/schemas/gates.js +0 -190
- package/dist/schemas/index.d.ts +0 -11
- package/dist/schemas/index.js +0 -762
- package/dist/schemas/killswitches.d.ts +0 -110
- package/dist/schemas/killswitches.js +0 -226
- package/dist/schemas/metric-name.d.ts +0 -5
- package/dist/schemas/metric-name.js +0 -6
- package/dist/schemas/pagination.d.ts +0 -37
- package/dist/schemas/pagination.js +0 -44
- package/dist/schemas/universes.d.ts +0 -35
- package/dist/schemas/universes.js +0 -55
- package/dist/transport.d.ts +0 -30
- package/dist/transport.js +0 -44
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { i as Client, k as Config, m as ConfigureOptions, L as CreateClientConfig, gL as Options, hf as RequestResult, kx as approveEvent, ky as client, kz as configure, kA as createAlertRule, kB as createAttribute, kC as createClient, kD as createClientConfig, kE as createConfig, kF as createConnector, kG as createEvent, kH as createExperiment, kI as createGate, kJ as createGateTemplate, kK as createI18nDraft, kL as createI18nProfile, kM as createKey, kN as createKillswitch, kO as createMetric, kP as createOpsItem, kQ as createTriggerConnector, kR as createUniverse, kS as deleteAlertRule, kT as deleteAttribute, kU as deleteConfig, kV as deleteConnector, kW as deleteEvent, kX as deleteExperiment, kY as deleteGate, kZ as deleteGateTemplate, k_ as deleteKillswitch, k$ as deleteMetric, l0 as deleteUniverse, l1 as disableGate, l2 as discardConfigDraft, l3 as enableGate, l4 as fileErrorTicket, l5 as fireConnector, l6 as getAttribute, l7 as getConfig, l8 as getConnector, l9 as getCurrentProject, la as getError, lb as getErrorSeries, lc as getEvent, ld as getExperiment, le as getExperimentResults, lf as getExperimentTimeseries, lg as getGateTemplate, lh as getKillswitch, li as getMetric, lj as getOpsItem, lk as linkPrToOpsItem, ll as listAlertRules, lm as listAttributes, ln as listConfigActivity, lo as listConfigs, lp as listConnectors, lq as listErrors, lr as listEvents, ls as listExperiments, lt as listGateTemplates, lu as listGates, lv as listI18nDrafts, lw as listI18nKeys, lx as listI18nProfiles, ly as listKeys, lz as listKillswitches, lA as listMetrics, lB as listOpsItems, lC as listSlackChannels, lD as listUniverses, lE as notifyOps, lF as publishConfigDraft, lG as publishI18nProfile, lH as pushI18nKeys, lI as reanalyzeExperiment, lJ as revokeKey, lK as saveConfigDraft, lL as searchResources, lM as setExperimentMetrics, lN as setExperimentStatus, lO as setI18nLabel, lP as setKillswitchSwitch, lQ as setKillswitchValue, lR as testConnector, lS as unsetKillswitchSwitch, lT as updateAlertRule, lU as updateAttribute, lV as updateConfig, lW as updateConfigSchema, lX as updateConnector, lY as updateErrorStatus, lZ as updateEvent, l_ as updateExperiment, l$ as updateGate, m0 as updateGateTemplate, m1 as updateI18nDraft, m2 as updateI18nKey, m3 as updateKillswitch, m4 as updateMetric, m5 as updateOpsItem, m6 as updateProject, m7 as updateTriggerConnector, m8 as updateUniverse, m9 as upsertProject } from './client-pVkoo3Bf.js';
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {
|
|
2
|
+
approveEvent,
|
|
3
|
+
client,
|
|
4
|
+
configure,
|
|
5
|
+
createAlertRule,
|
|
6
|
+
createAttribute,
|
|
7
|
+
createClient,
|
|
8
|
+
createConfig,
|
|
9
|
+
createConfig2,
|
|
10
|
+
createConnector,
|
|
11
|
+
createEvent,
|
|
12
|
+
createExperiment,
|
|
13
|
+
createGate,
|
|
14
|
+
createGateTemplate,
|
|
15
|
+
createI18nDraft,
|
|
16
|
+
createI18nProfile,
|
|
17
|
+
createKey,
|
|
18
|
+
createKillswitch,
|
|
19
|
+
createMetric,
|
|
20
|
+
createOpsItem,
|
|
21
|
+
createTriggerConnector,
|
|
22
|
+
createUniverse,
|
|
23
|
+
deleteAlertRule,
|
|
24
|
+
deleteAttribute,
|
|
25
|
+
deleteConfig,
|
|
26
|
+
deleteConnector,
|
|
27
|
+
deleteEvent,
|
|
28
|
+
deleteExperiment,
|
|
29
|
+
deleteGate,
|
|
30
|
+
deleteGateTemplate,
|
|
31
|
+
deleteKillswitch,
|
|
32
|
+
deleteMetric,
|
|
33
|
+
deleteUniverse,
|
|
34
|
+
disableGate,
|
|
35
|
+
discardConfigDraft,
|
|
36
|
+
enableGate,
|
|
37
|
+
fileErrorTicket,
|
|
38
|
+
fireConnector,
|
|
39
|
+
getAttribute,
|
|
40
|
+
getConfig,
|
|
41
|
+
getConnector,
|
|
42
|
+
getCurrentProject,
|
|
43
|
+
getError,
|
|
44
|
+
getErrorSeries,
|
|
45
|
+
getEvent,
|
|
46
|
+
getExperiment,
|
|
47
|
+
getExperimentResults,
|
|
48
|
+
getExperimentTimeseries,
|
|
49
|
+
getGateTemplate,
|
|
50
|
+
getKillswitch,
|
|
51
|
+
getMetric,
|
|
52
|
+
getOpsItem,
|
|
53
|
+
linkPrToOpsItem,
|
|
54
|
+
listAlertRules,
|
|
55
|
+
listAttributes,
|
|
56
|
+
listConfigActivity,
|
|
57
|
+
listConfigs,
|
|
58
|
+
listConnectors,
|
|
59
|
+
listErrors,
|
|
60
|
+
listEvents,
|
|
61
|
+
listExperiments,
|
|
62
|
+
listGateTemplates,
|
|
63
|
+
listGates,
|
|
64
|
+
listI18nDrafts,
|
|
65
|
+
listI18nKeys,
|
|
66
|
+
listI18nProfiles,
|
|
67
|
+
listKeys,
|
|
68
|
+
listKillswitches,
|
|
69
|
+
listMetrics,
|
|
70
|
+
listOpsItems,
|
|
71
|
+
listSlackChannels,
|
|
72
|
+
listUniverses,
|
|
73
|
+
notifyOps,
|
|
74
|
+
publishConfigDraft,
|
|
75
|
+
publishI18nProfile,
|
|
76
|
+
pushI18nKeys,
|
|
77
|
+
reanalyzeExperiment,
|
|
78
|
+
revokeKey,
|
|
79
|
+
saveConfigDraft,
|
|
80
|
+
searchResources,
|
|
81
|
+
setExperimentMetrics,
|
|
82
|
+
setExperimentStatus,
|
|
83
|
+
setI18nLabel,
|
|
84
|
+
setKillswitchSwitch,
|
|
85
|
+
setKillswitchValue,
|
|
86
|
+
testConnector,
|
|
87
|
+
unsetKillswitchSwitch,
|
|
88
|
+
updateAlertRule,
|
|
89
|
+
updateAttribute,
|
|
90
|
+
updateConfig,
|
|
91
|
+
updateConfigSchema,
|
|
92
|
+
updateConnector,
|
|
93
|
+
updateErrorStatus,
|
|
94
|
+
updateEvent,
|
|
95
|
+
updateExperiment,
|
|
96
|
+
updateGate,
|
|
97
|
+
updateGateTemplate,
|
|
98
|
+
updateI18nDraft,
|
|
99
|
+
updateI18nKey,
|
|
100
|
+
updateKillswitch,
|
|
101
|
+
updateMetric,
|
|
102
|
+
updateOpsItem,
|
|
103
|
+
updateProject,
|
|
104
|
+
updateTriggerConnector,
|
|
105
|
+
updateUniverse,
|
|
106
|
+
upsertProject
|
|
107
|
+
} from "./chunk-EPLLHLZN.js";
|
|
108
|
+
export {
|
|
109
|
+
approveEvent,
|
|
110
|
+
client,
|
|
111
|
+
configure,
|
|
112
|
+
createAlertRule,
|
|
113
|
+
createAttribute,
|
|
114
|
+
createClient,
|
|
115
|
+
createConfig as createClientConfig,
|
|
116
|
+
createConfig2 as createConfig,
|
|
117
|
+
createConnector,
|
|
118
|
+
createEvent,
|
|
119
|
+
createExperiment,
|
|
120
|
+
createGate,
|
|
121
|
+
createGateTemplate,
|
|
122
|
+
createI18nDraft,
|
|
123
|
+
createI18nProfile,
|
|
124
|
+
createKey,
|
|
125
|
+
createKillswitch,
|
|
126
|
+
createMetric,
|
|
127
|
+
createOpsItem,
|
|
128
|
+
createTriggerConnector,
|
|
129
|
+
createUniverse,
|
|
130
|
+
deleteAlertRule,
|
|
131
|
+
deleteAttribute,
|
|
132
|
+
deleteConfig,
|
|
133
|
+
deleteConnector,
|
|
134
|
+
deleteEvent,
|
|
135
|
+
deleteExperiment,
|
|
136
|
+
deleteGate,
|
|
137
|
+
deleteGateTemplate,
|
|
138
|
+
deleteKillswitch,
|
|
139
|
+
deleteMetric,
|
|
140
|
+
deleteUniverse,
|
|
141
|
+
disableGate,
|
|
142
|
+
discardConfigDraft,
|
|
143
|
+
enableGate,
|
|
144
|
+
fileErrorTicket,
|
|
145
|
+
fireConnector,
|
|
146
|
+
getAttribute,
|
|
147
|
+
getConfig,
|
|
148
|
+
getConnector,
|
|
149
|
+
getCurrentProject,
|
|
150
|
+
getError,
|
|
151
|
+
getErrorSeries,
|
|
152
|
+
getEvent,
|
|
153
|
+
getExperiment,
|
|
154
|
+
getExperimentResults,
|
|
155
|
+
getExperimentTimeseries,
|
|
156
|
+
getGateTemplate,
|
|
157
|
+
getKillswitch,
|
|
158
|
+
getMetric,
|
|
159
|
+
getOpsItem,
|
|
160
|
+
linkPrToOpsItem,
|
|
161
|
+
listAlertRules,
|
|
162
|
+
listAttributes,
|
|
163
|
+
listConfigActivity,
|
|
164
|
+
listConfigs,
|
|
165
|
+
listConnectors,
|
|
166
|
+
listErrors,
|
|
167
|
+
listEvents,
|
|
168
|
+
listExperiments,
|
|
169
|
+
listGateTemplates,
|
|
170
|
+
listGates,
|
|
171
|
+
listI18nDrafts,
|
|
172
|
+
listI18nKeys,
|
|
173
|
+
listI18nProfiles,
|
|
174
|
+
listKeys,
|
|
175
|
+
listKillswitches,
|
|
176
|
+
listMetrics,
|
|
177
|
+
listOpsItems,
|
|
178
|
+
listSlackChannels,
|
|
179
|
+
listUniverses,
|
|
180
|
+
notifyOps,
|
|
181
|
+
publishConfigDraft,
|
|
182
|
+
publishI18nProfile,
|
|
183
|
+
pushI18nKeys,
|
|
184
|
+
reanalyzeExperiment,
|
|
185
|
+
revokeKey,
|
|
186
|
+
saveConfigDraft,
|
|
187
|
+
searchResources,
|
|
188
|
+
setExperimentMetrics,
|
|
189
|
+
setExperimentStatus,
|
|
190
|
+
setI18nLabel,
|
|
191
|
+
setKillswitchSwitch,
|
|
192
|
+
setKillswitchValue,
|
|
193
|
+
testConnector,
|
|
194
|
+
unsetKillswitchSwitch,
|
|
195
|
+
updateAlertRule,
|
|
196
|
+
updateAttribute,
|
|
197
|
+
updateConfig,
|
|
198
|
+
updateConfigSchema,
|
|
199
|
+
updateConnector,
|
|
200
|
+
updateErrorStatus,
|
|
201
|
+
updateEvent,
|
|
202
|
+
updateExperiment,
|
|
203
|
+
updateGate,
|
|
204
|
+
updateGateTemplate,
|
|
205
|
+
updateI18nDraft,
|
|
206
|
+
updateI18nKey,
|
|
207
|
+
updateKillswitch,
|
|
208
|
+
updateMetric,
|
|
209
|
+
updateOpsItem,
|
|
210
|
+
updateProject,
|
|
211
|
+
updateTriggerConnector,
|
|
212
|
+
updateUniverse,
|
|
213
|
+
upsertProject
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/custom.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The custom-operations registry — hand-written operations that are NOT admin
|
|
3
|
+
* API endpoints (so they can't be generated from the spec): the metric-DSL
|
|
4
|
+
* grammar (pure) and the SDK-docs fetcher (outbound `fetch` to GitHub Pages).
|
|
5
|
+
*
|
|
6
|
+
* It mirrors the old operations registry in spirit, but is deliberately tiny and
|
|
7
|
+
* framework-agnostic: each `CustomOp` carries its command path, params, and a
|
|
8
|
+
* self-contained `run`. Both consumers project it with a thin adapter — the CLI
|
|
9
|
+
* (`commands/custom.ts`) and, later, the MCP server — so the surface stays in
|
|
10
|
+
* sync across them. `run` never touches the filesystem, so it's worker-safe.
|
|
11
|
+
*/
|
|
12
|
+
type CustomParamType = "string" | "number" | "boolean";
|
|
13
|
+
interface CustomParam {
|
|
14
|
+
name: string;
|
|
15
|
+
type: CustomParamType;
|
|
16
|
+
description?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/** Render as a positional CLI argument (vs a `--flag`). */
|
|
19
|
+
positional?: boolean;
|
|
20
|
+
enum?: string[];
|
|
21
|
+
}
|
|
22
|
+
interface CustomOp {
|
|
23
|
+
/** Command path, e.g. `["docs"]` → `shipeasy docs <name>`, `["metrics"]` → `metrics <name>`. */
|
|
24
|
+
group: string[];
|
|
25
|
+
/** Verb. */
|
|
26
|
+
name: string;
|
|
27
|
+
summary: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
params: CustomParam[];
|
|
30
|
+
examples?: {
|
|
31
|
+
note?: string;
|
|
32
|
+
run: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** Self-contained handler. `args` are the coerced param values. */
|
|
35
|
+
run: (args: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
36
|
+
}
|
|
37
|
+
/** Thrown by a custom op for a user-facing error with an HTTP-ish status. */
|
|
38
|
+
declare class CustomOpError extends Error {
|
|
39
|
+
status: number;
|
|
40
|
+
constructor(message: string, status?: number);
|
|
41
|
+
}
|
|
42
|
+
declare const opId: (op: CustomOp) => string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The Shipeasy metric query DSL grammar — printed by `shipeasy metrics grammar`
|
|
46
|
+
* / the `metrics_grammar` MCP tool.
|
|
47
|
+
*
|
|
48
|
+
* This is the one-stop reference for both humans and AI agents that need to
|
|
49
|
+
* author a `metrics create --query "..."` string. It is intentionally
|
|
50
|
+
* self-contained: the formal grammar (precise, for machine parsing), a full
|
|
51
|
+
* aggregation reference (semantics + value-label rules + experiment behaviour),
|
|
52
|
+
* the selector/filter/group-by rules, hard constraints, and glossed examples.
|
|
53
|
+
* Keep it in sync with the parser (`cli/src/query-dsl/parse.ts`) and the IR
|
|
54
|
+
* (`cli/src/query-dsl/ir.ts`) — they are the source of truth for semantics.
|
|
55
|
+
*/
|
|
56
|
+
declare const METRIC_GRAMMAR = "SHIPEASY METRIC QUERY DSL\n=========================\n\nA metric is ONE aggregation over ONE event stream. This DSL is the string you\npass to `metrics create --query \"...\"` (equivalently the typed `query_ir`).\nThere is no arithmetic, no formulas across events, no subqueries \u2014 one event\nselector, one aggregation, an optional group-by.\n\n\nGRAMMAR (BNF)\n-------------\n Query := AggFunc \"(\" Selector (\",\" Identifier)? \")\" GroupBy?\n AggFunc := \"count_users\" | \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\"\n | \"unique\" | \"p50\" | \"p75\" | \"p90\" | \"p95\" | \"p99\" | \"p999\"\n | \"retention_\" <N> \"d\" (N = 1..90)\n Selector := Identifier (\"{\" Filter (\",\" Filter)* \",\"? \"}\")?\n Filter := Identifier MatchOp StringLiteral\n MatchOp := \"=\" | \"!=\" | \"=~\" | \"!~\"\n GroupBy := (\"by\" | \"without\") \"(\" Identifier (\",\" Identifier)* \",\"? \")\"\n StringLiteral := double-quoted; \\\" is a literal quote, \\\\ is a backslash\n Identifier := [A-Za-z_][A-Za-z0-9_]* (case-sensitive)\n\n The trailing Identifier after the selector \u2014 \"(\" Selector \",\" Identifier \")\" \u2014\n is the VALUE LABEL: the numeric event label the aggregation reduces. Whether it\n is required, optional, or forbidden depends on the aggregation (see below).\n\n\nAGGREGATIONS\n------------\n Function Value label Meaning In experiments\n -------------- ------------ ------------------------------ ---------------\n count_users forbidden distinct users who fired it exact\n count forbidden number of events (rows) exact\n sum(e, v) required \u03A3 of numeric label v exact\n avg(e, v) required mean of label v exact\n retention_Nd(e) forbidden % of users who returned exact\n within N days (N = 1..90)\n min(e, v) required minimum of label v approx \u2192 avg *\n max(e, v) required maximum of label v approx \u2192 avg *\n unique(e, v) required distinct values of label v approx \u2192 avg *\n p50 \u2026 p999(e,v) required quantile of v (50/75/90/ approx \u2192 avg *\n 95/99/99.9th percentile)\n\n * Display-only aggregations. The experiment t-test needs a per-user mean and\n variance, so min/max/unique/quantile are computed exactly on dashboards but\n collapse to a per-user `avg` when used as an experiment metric. If you need\n an exact experiment metric, pick count_users / count / sum / avg / retention.\n\n \"count\" is the DSL spelling of the internal count_events (one per matching\n row); \"count_users\" is unique-by-user. Getting these two confused is the most\n common mistake \u2014 count double-counts a user who fired the event twice.\n\n\nSELECTOR & FILTERS\n------------------\n The selector is the event name plus an optional `{ ... }` filter set that\n narrows which events count. Each filter compares an event LABEL to a quoted\n string:\n\n = equal != not equal\n =~ regex match !~ regex NOT match\n\n - Values are ALWAYS double-quoted strings, even for numeric labels \u2014 they are\n coerced on the server (`amount=~\"^1[0-9]$\"`, `status=\"200\"`).\n - Multiple filters are AND-ed: `{country=\"US\", tier!=\"free\"}`.\n - Every filter label AND the value label must be a label DECLARED on the source\n event. Undeclared labels are a validation error, not a silent no-match.\n\n\nGROUP-BY\n--------\n Splits the result into one series per label combination.\n by (a, b) one series per distinct (a, b) \u2014 keep only these labels\n without (a, b) group by all declared labels EXCEPT a, b\n\n NOTE: group-by is a DASHBOARD-only feature. In an experiment the group-by is\n ignored \u2014 a per-user reducer is applied across the whole arm instead.\n\n\nNOT SUPPORTED (will fail to parse)\n----------------------------------\n - arithmetic / ratios / formulas: `count(a) / count(b)`\n - more than one event per query\n - arbitrary quantiles (only the fixed p50/p75/p90/p95/p99/p999)\n - unquoted or numeric filter values: `{status=200}` \u2192 must be `\"200\"`\n - trailing tokens after the query\n\n\nEXAMPLES (query \u2014 what it measures)\n--------------------------------------\n count_users(checkout_completed)\n distinct users who completed checkout.\n\n count(add_to_cart{country=\"US\"})\n number of US add-to-cart events (a user can count many times).\n\n sum(purchase{country=\"US\"}, amount)\n total purchase amount from US purchase events.\n\n avg(req_dur{tier!=\"free\"}, ms) without (region)\n mean request duration for non-free tiers, one series per region-excluded\n label combination.\n\n p99(req_dur{route=~\"/api/.*\"}, ms) by (route, status)\n 99th-percentile latency of /api/* requests, split by route and status.\n\n unique(login{method=\"sso\"}, device_id)\n distinct SSO devices seen (display-only; an experiment would use per-user avg).\n\n retention_7d(session_start)\n share of users who started a new session within 7 days.\n";
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Every custom (non-spec) operation, in surface order. The CLI and MCP each
|
|
60
|
+
* project this with a thin adapter so the sugar commands stay in sync.
|
|
61
|
+
*/
|
|
62
|
+
declare const customOperations: CustomOp[];
|
|
63
|
+
|
|
64
|
+
export { type CustomOp, CustomOpError, type CustomParam, type CustomParamType, METRIC_GRAMMAR, customOperations, opId };
|
package/dist/custom.js
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
// src/custom/grammar.ts
|
|
2
|
+
var METRIC_GRAMMAR = `SHIPEASY METRIC QUERY DSL
|
|
3
|
+
=========================
|
|
4
|
+
|
|
5
|
+
A metric is ONE aggregation over ONE event stream. This DSL is the string you
|
|
6
|
+
pass to \`metrics create --query "..."\` (equivalently the typed \`query_ir\`).
|
|
7
|
+
There is no arithmetic, no formulas across events, no subqueries \u2014 one event
|
|
8
|
+
selector, one aggregation, an optional group-by.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
GRAMMAR (BNF)
|
|
12
|
+
-------------
|
|
13
|
+
Query := AggFunc "(" Selector ("," Identifier)? ")" GroupBy?
|
|
14
|
+
AggFunc := "count_users" | "count" | "sum" | "avg" | "min" | "max"
|
|
15
|
+
| "unique" | "p50" | "p75" | "p90" | "p95" | "p99" | "p999"
|
|
16
|
+
| "retention_" <N> "d" (N = 1..90)
|
|
17
|
+
Selector := Identifier ("{" Filter ("," Filter)* ","? "}")?
|
|
18
|
+
Filter := Identifier MatchOp StringLiteral
|
|
19
|
+
MatchOp := "=" | "!=" | "=~" | "!~"
|
|
20
|
+
GroupBy := ("by" | "without") "(" Identifier ("," Identifier)* ","? ")"
|
|
21
|
+
StringLiteral := double-quoted; \\" is a literal quote, \\\\ is a backslash
|
|
22
|
+
Identifier := [A-Za-z_][A-Za-z0-9_]* (case-sensitive)
|
|
23
|
+
|
|
24
|
+
The trailing Identifier after the selector \u2014 "(" Selector "," Identifier ")" \u2014
|
|
25
|
+
is the VALUE LABEL: the numeric event label the aggregation reduces. Whether it
|
|
26
|
+
is required, optional, or forbidden depends on the aggregation (see below).
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
AGGREGATIONS
|
|
30
|
+
------------
|
|
31
|
+
Function Value label Meaning In experiments
|
|
32
|
+
-------------- ------------ ------------------------------ ---------------
|
|
33
|
+
count_users forbidden distinct users who fired it exact
|
|
34
|
+
count forbidden number of events (rows) exact
|
|
35
|
+
sum(e, v) required \u03A3 of numeric label v exact
|
|
36
|
+
avg(e, v) required mean of label v exact
|
|
37
|
+
retention_Nd(e) forbidden % of users who returned exact
|
|
38
|
+
within N days (N = 1..90)
|
|
39
|
+
min(e, v) required minimum of label v approx \u2192 avg *
|
|
40
|
+
max(e, v) required maximum of label v approx \u2192 avg *
|
|
41
|
+
unique(e, v) required distinct values of label v approx \u2192 avg *
|
|
42
|
+
p50 \u2026 p999(e,v) required quantile of v (50/75/90/ approx \u2192 avg *
|
|
43
|
+
95/99/99.9th percentile)
|
|
44
|
+
|
|
45
|
+
* Display-only aggregations. The experiment t-test needs a per-user mean and
|
|
46
|
+
variance, so min/max/unique/quantile are computed exactly on dashboards but
|
|
47
|
+
collapse to a per-user \`avg\` when used as an experiment metric. If you need
|
|
48
|
+
an exact experiment metric, pick count_users / count / sum / avg / retention.
|
|
49
|
+
|
|
50
|
+
"count" is the DSL spelling of the internal count_events (one per matching
|
|
51
|
+
row); "count_users" is unique-by-user. Getting these two confused is the most
|
|
52
|
+
common mistake \u2014 count double-counts a user who fired the event twice.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
SELECTOR & FILTERS
|
|
56
|
+
------------------
|
|
57
|
+
The selector is the event name plus an optional \`{ ... }\` filter set that
|
|
58
|
+
narrows which events count. Each filter compares an event LABEL to a quoted
|
|
59
|
+
string:
|
|
60
|
+
|
|
61
|
+
= equal != not equal
|
|
62
|
+
=~ regex match !~ regex NOT match
|
|
63
|
+
|
|
64
|
+
- Values are ALWAYS double-quoted strings, even for numeric labels \u2014 they are
|
|
65
|
+
coerced on the server (\`amount=~"^1[0-9]$"\`, \`status="200"\`).
|
|
66
|
+
- Multiple filters are AND-ed: \`{country="US", tier!="free"}\`.
|
|
67
|
+
- Every filter label AND the value label must be a label DECLARED on the source
|
|
68
|
+
event. Undeclared labels are a validation error, not a silent no-match.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
GROUP-BY
|
|
72
|
+
--------
|
|
73
|
+
Splits the result into one series per label combination.
|
|
74
|
+
by (a, b) one series per distinct (a, b) \u2014 keep only these labels
|
|
75
|
+
without (a, b) group by all declared labels EXCEPT a, b
|
|
76
|
+
|
|
77
|
+
NOTE: group-by is a DASHBOARD-only feature. In an experiment the group-by is
|
|
78
|
+
ignored \u2014 a per-user reducer is applied across the whole arm instead.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
NOT SUPPORTED (will fail to parse)
|
|
82
|
+
----------------------------------
|
|
83
|
+
- arithmetic / ratios / formulas: \`count(a) / count(b)\`
|
|
84
|
+
- more than one event per query
|
|
85
|
+
- arbitrary quantiles (only the fixed p50/p75/p90/p95/p99/p999)
|
|
86
|
+
- unquoted or numeric filter values: \`{status=200}\` \u2192 must be \`"200"\`
|
|
87
|
+
- trailing tokens after the query
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
EXAMPLES (query \u2014 what it measures)
|
|
91
|
+
--------------------------------------
|
|
92
|
+
count_users(checkout_completed)
|
|
93
|
+
distinct users who completed checkout.
|
|
94
|
+
|
|
95
|
+
count(add_to_cart{country="US"})
|
|
96
|
+
number of US add-to-cart events (a user can count many times).
|
|
97
|
+
|
|
98
|
+
sum(purchase{country="US"}, amount)
|
|
99
|
+
total purchase amount from US purchase events.
|
|
100
|
+
|
|
101
|
+
avg(req_dur{tier!="free"}, ms) without (region)
|
|
102
|
+
mean request duration for non-free tiers, one series per region-excluded
|
|
103
|
+
label combination.
|
|
104
|
+
|
|
105
|
+
p99(req_dur{route=~"/api/.*"}, ms) by (route, status)
|
|
106
|
+
99th-percentile latency of /api/* requests, split by route and status.
|
|
107
|
+
|
|
108
|
+
unique(login{method="sso"}, device_id)
|
|
109
|
+
distinct SSO devices seen (display-only; an experiment would use per-user avg).
|
|
110
|
+
|
|
111
|
+
retention_7d(session_start)
|
|
112
|
+
share of users who started a new session within 7 days.
|
|
113
|
+
`;
|
|
114
|
+
var grammarOp = {
|
|
115
|
+
group: ["metrics"],
|
|
116
|
+
name: "grammar",
|
|
117
|
+
summary: "Print the metric query DSL grammar",
|
|
118
|
+
description: "Print the full metric query DSL reference \u2014 grammar, aggregation semantics, filter/group-by rules, and glossed examples \u2014 used to author `metrics create --query`.",
|
|
119
|
+
params: [],
|
|
120
|
+
examples: [{ run: "shipeasy metrics grammar" }],
|
|
121
|
+
run: () => ({ grammar: METRIC_GRAMMAR })
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// src/custom/types.ts
|
|
125
|
+
var CustomOpError = class extends Error {
|
|
126
|
+
constructor(message, status = 400) {
|
|
127
|
+
super(message);
|
|
128
|
+
this.status = status;
|
|
129
|
+
this.name = "CustomOpError";
|
|
130
|
+
}
|
|
131
|
+
status;
|
|
132
|
+
};
|
|
133
|
+
var opId = (op) => [...op.group, op.name].join(".");
|
|
134
|
+
|
|
135
|
+
// src/custom/docs.ts
|
|
136
|
+
var SDK_REPOS = {
|
|
137
|
+
typescript: { owner: "shipeasy-ai", repo: "sdk" },
|
|
138
|
+
javascript: { owner: "shipeasy-ai", repo: "sdk" },
|
|
139
|
+
node: { owner: "shipeasy-ai", repo: "sdk" },
|
|
140
|
+
ts: { owner: "shipeasy-ai", repo: "sdk" },
|
|
141
|
+
python: { owner: "shipeasy-ai", repo: "sdk-python" },
|
|
142
|
+
go: { owner: "shipeasy-ai", repo: "sdk-go" },
|
|
143
|
+
java: { owner: "shipeasy-ai", repo: "sdk-java" },
|
|
144
|
+
kotlin: { owner: "shipeasy-ai", repo: "sdk-kotlin" },
|
|
145
|
+
php: { owner: "shipeasy-ai", repo: "sdk-php" },
|
|
146
|
+
swift: { owner: "shipeasy-ai", repo: "sdk-swift" },
|
|
147
|
+
ruby: { owner: "shipeasy-ai", repo: "sdk-ruby" }
|
|
148
|
+
};
|
|
149
|
+
var SDK_ENUM = Object.keys(SDK_REPOS);
|
|
150
|
+
var DEFAULT_MANIFEST = {
|
|
151
|
+
schemaVersion: 2,
|
|
152
|
+
sdk: "default",
|
|
153
|
+
placeholders: ["RESOURCE_NAME"],
|
|
154
|
+
skill: "skill/SKILL.md",
|
|
155
|
+
pages: { overview: "pages/overview.md", installation: "pages/installation.md" },
|
|
156
|
+
snippets: { release: { flags: "snippets/release/flags.md" } }
|
|
157
|
+
};
|
|
158
|
+
var DEFAULT_CONTENT = {
|
|
159
|
+
"pages/overview.md": "# Shipeasy SDK\n\nThis SDK has not published its `/docs/` folder yet. See https://docs.shipeasy.ai for the full reference.",
|
|
160
|
+
"pages/installation.md": "# Installation\n\nInstall the Shipeasy SDK for your language, then call `shipeasy({ serverKey })` (server) or `shipeasy({ clientKey })` (browser).",
|
|
161
|
+
"snippets/release/flags.md": "```\nconst on = await client.checkGate(user, '{{RESOURCE_NAME}}');\n```",
|
|
162
|
+
"skill/SKILL.md": "---\nname: shipeasy-sdk\ndescription: Use the Shipeasy SDK for flags, experiments, configs, and i18n.\n---\n\nThis SDK has not published a skill yet. See https://docs.shipeasy.ai."
|
|
163
|
+
};
|
|
164
|
+
function requireSdk(sdk) {
|
|
165
|
+
const s = typeof sdk === "string" ? sdk.trim() : "";
|
|
166
|
+
if (!s)
|
|
167
|
+
throw new CustomOpError(
|
|
168
|
+
`No SDK given and none recorded in .shipeasy. Pass --sdk <lang> (one of: ${SDK_ENUM.join(", ")}), or run \`shipeasy detect\` in the project to record its sdk.`,
|
|
169
|
+
400
|
|
170
|
+
);
|
|
171
|
+
return s;
|
|
172
|
+
}
|
|
173
|
+
function repoFor(sdk) {
|
|
174
|
+
const r = SDK_REPOS[sdk.toLowerCase()];
|
|
175
|
+
if (!r) throw new CustomOpError(`Unknown SDK '${sdk}'. One of: ${SDK_ENUM.join(", ")}`, 400);
|
|
176
|
+
return r;
|
|
177
|
+
}
|
|
178
|
+
function pagesBase(sdk) {
|
|
179
|
+
const { owner, repo } = repoFor(sdk);
|
|
180
|
+
return `https://${owner}.github.io/${repo}`;
|
|
181
|
+
}
|
|
182
|
+
async function fetchText(url) {
|
|
183
|
+
const res = await fetch(url);
|
|
184
|
+
if (!res.ok) return null;
|
|
185
|
+
return res.text();
|
|
186
|
+
}
|
|
187
|
+
async function loadManifest(sdk) {
|
|
188
|
+
const text = await fetchText(`${pagesBase(sdk)}/manifest.json`);
|
|
189
|
+
if (!text) return { manifest: DEFAULT_MANIFEST, fallback: true };
|
|
190
|
+
try {
|
|
191
|
+
return { manifest: JSON.parse(text), fallback: false };
|
|
192
|
+
} catch {
|
|
193
|
+
return { manifest: DEFAULT_MANIFEST, fallback: true };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function resolvePath(manifest, handle) {
|
|
197
|
+
if (handle.endsWith(".md")) return handle;
|
|
198
|
+
if (manifest.pages?.[handle]) return manifest.pages[handle];
|
|
199
|
+
if (handle.includes("/")) {
|
|
200
|
+
const [group, resource] = handle.split("/", 2);
|
|
201
|
+
const p = manifest.snippets?.[group]?.[resource];
|
|
202
|
+
if (p) return p;
|
|
203
|
+
}
|
|
204
|
+
throw new CustomOpError(
|
|
205
|
+
`Doc '${handle}' not found. Run 'docs list --sdk <lang>' to see available pages and snippets.`,
|
|
206
|
+
404
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
function substitute(body, manifest, args) {
|
|
210
|
+
let out = body;
|
|
211
|
+
for (const ph of manifest.placeholders ?? []) {
|
|
212
|
+
const value = args[ph] ?? (ph === "RESOURCE_NAME" ? args.name : void 0) ?? (ph === "FRAMEWORK" ? args.framework : void 0);
|
|
213
|
+
if (value !== void 0) out = out.replaceAll(`{{${ph}}}`, value);
|
|
214
|
+
}
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
var docsOps = [
|
|
218
|
+
{
|
|
219
|
+
group: ["docs"],
|
|
220
|
+
name: "list",
|
|
221
|
+
summary: "List an SDK's documentation tree",
|
|
222
|
+
description: "Fetch an SDK's `/docs/manifest.json` and return the doc tree \u2014 feature pages, nested snippet groups, and whether an installable skill exists.",
|
|
223
|
+
params: [{ name: "sdk", type: "string", description: "SDK language. Defaults to the `sdk` recorded in the nearest `.shipeasy` when omitted.", required: false, enum: SDK_ENUM }],
|
|
224
|
+
examples: [{ run: "shipeasy docs list --sdk python" }],
|
|
225
|
+
run: async (args) => {
|
|
226
|
+
const sdk = requireSdk(args.sdk);
|
|
227
|
+
const { manifest, fallback } = await loadManifest(sdk);
|
|
228
|
+
return {
|
|
229
|
+
sdk,
|
|
230
|
+
fallback,
|
|
231
|
+
pages: Object.keys(manifest.pages ?? {}),
|
|
232
|
+
snippets: Object.fromEntries(
|
|
233
|
+
Object.entries(manifest.snippets ?? {}).map(([g, r]) => [g, Object.keys(r)])
|
|
234
|
+
),
|
|
235
|
+
skill: Boolean(manifest.skill)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
group: ["docs"],
|
|
241
|
+
name: "get",
|
|
242
|
+
summary: "Fetch one SDK doc page or snippet",
|
|
243
|
+
description: "Fetch one feature page (`flags`, `experiments`, \u2026) or nested snippet (`release/experiments`, \u2026), substituting declared {{placeholders}} from caller args.",
|
|
244
|
+
params: [
|
|
245
|
+
{ name: "sdk", type: "string", description: "SDK language. Defaults to the `sdk` recorded in the nearest `.shipeasy` when omitted.", required: false, enum: SDK_ENUM },
|
|
246
|
+
{ name: "path", type: "string", description: "Page key or snippet 'group/resource'.", required: true, positional: true },
|
|
247
|
+
{ name: "framework", type: "string", description: "Framework hint (substitutes {{FRAMEWORK}})." },
|
|
248
|
+
{ name: "name", type: "string", description: "Resource name (substitutes {{RESOURCE_NAME}})." }
|
|
249
|
+
],
|
|
250
|
+
examples: [
|
|
251
|
+
{ note: "A feature page", run: "shipeasy docs get --sdk python experiments" },
|
|
252
|
+
{ note: "A nested snippet", run: "shipeasy docs get --sdk typescript release/flags --name checkout_v2" }
|
|
253
|
+
],
|
|
254
|
+
run: async (args) => {
|
|
255
|
+
const sdk = requireSdk(args.sdk);
|
|
256
|
+
const { manifest, fallback } = await loadManifest(sdk);
|
|
257
|
+
const path = resolvePath(manifest, args.path);
|
|
258
|
+
const body = fallback ? DEFAULT_CONTENT[path] : await fetchText(`${pagesBase(sdk)}/${path}`) ?? void 0;
|
|
259
|
+
if (body === void 0) throw new CustomOpError(`Doc '${path}' could not be fetched for '${sdk}'.`, 404);
|
|
260
|
+
return { sdk, path, fallback, content: substitute(body, manifest, args) };
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
group: ["docs"],
|
|
265
|
+
name: "skill",
|
|
266
|
+
summary: "Fetch an SDK's installable LLM skill",
|
|
267
|
+
description: "Fetch the SDK's `skill/SKILL.md` (frontmatter intact) so an agent can install it verbatim. The CLI `--install` writes it locally (a consumer fs side-effect).",
|
|
268
|
+
params: [
|
|
269
|
+
{ name: "sdk", type: "string", description: "SDK language. Defaults to the `sdk` recorded in the nearest `.shipeasy` when omitted.", required: false, enum: SDK_ENUM },
|
|
270
|
+
{ name: "install", type: "boolean", description: "CLI only: write the skill to the local agent skills dir." }
|
|
271
|
+
],
|
|
272
|
+
examples: [{ run: "shipeasy docs skill --sdk python" }],
|
|
273
|
+
run: async (args) => {
|
|
274
|
+
const sdk = requireSdk(args.sdk);
|
|
275
|
+
const { manifest, fallback } = await loadManifest(sdk);
|
|
276
|
+
const skillPath = manifest.skill ?? "skill/SKILL.md";
|
|
277
|
+
const content = fallback ? DEFAULT_CONTENT[skillPath] : await fetchText(`${pagesBase(sdk)}/${skillPath}`) ?? void 0;
|
|
278
|
+
if (content === void 0) throw new CustomOpError(`No skill published for '${sdk}'.`, 404);
|
|
279
|
+
return { sdk, skillPath, fallback, content };
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
// src/custom/index.ts
|
|
285
|
+
var customOperations = [grammarOp, ...docsOps];
|
|
286
|
+
export {
|
|
287
|
+
CustomOpError,
|
|
288
|
+
METRIC_GRAMMAR,
|
|
289
|
+
customOperations,
|
|
290
|
+
opId
|
|
291
|
+
};
|
|
292
|
+
//# sourceMappingURL=custom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/custom/grammar.ts","../src/custom/types.ts","../src/custom/docs.ts","../src/custom/index.ts"],"sourcesContent":["import type { CustomOp } from \"./types.js\";\n\n/**\n * The Shipeasy metric query DSL grammar — printed by `shipeasy metrics grammar`\n * / the `metrics_grammar` MCP tool.\n *\n * This is the one-stop reference for both humans and AI agents that need to\n * author a `metrics create --query \"...\"` string. It is intentionally\n * self-contained: the formal grammar (precise, for machine parsing), a full\n * aggregation reference (semantics + value-label rules + experiment behaviour),\n * the selector/filter/group-by rules, hard constraints, and glossed examples.\n * Keep it in sync with the parser (`cli/src/query-dsl/parse.ts`) and the IR\n * (`cli/src/query-dsl/ir.ts`) — they are the source of truth for semantics.\n */\nexport const METRIC_GRAMMAR = `SHIPEASY METRIC QUERY DSL\n=========================\n\nA metric is ONE aggregation over ONE event stream. This DSL is the string you\npass to \\`metrics create --query \"...\"\\` (equivalently the typed \\`query_ir\\`).\nThere is no arithmetic, no formulas across events, no subqueries — one event\nselector, one aggregation, an optional group-by.\n\n\nGRAMMAR (BNF)\n-------------\n Query := AggFunc \"(\" Selector (\",\" Identifier)? \")\" GroupBy?\n AggFunc := \"count_users\" | \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\"\n | \"unique\" | \"p50\" | \"p75\" | \"p90\" | \"p95\" | \"p99\" | \"p999\"\n | \"retention_\" <N> \"d\" (N = 1..90)\n Selector := Identifier (\"{\" Filter (\",\" Filter)* \",\"? \"}\")?\n Filter := Identifier MatchOp StringLiteral\n MatchOp := \"=\" | \"!=\" | \"=~\" | \"!~\"\n GroupBy := (\"by\" | \"without\") \"(\" Identifier (\",\" Identifier)* \",\"? \")\"\n StringLiteral := double-quoted; \\\\\" is a literal quote, \\\\\\\\ is a backslash\n Identifier := [A-Za-z_][A-Za-z0-9_]* (case-sensitive)\n\n The trailing Identifier after the selector — \"(\" Selector \",\" Identifier \")\" —\n is the VALUE LABEL: the numeric event label the aggregation reduces. Whether it\n is required, optional, or forbidden depends on the aggregation (see below).\n\n\nAGGREGATIONS\n------------\n Function Value label Meaning In experiments\n -------------- ------------ ------------------------------ ---------------\n count_users forbidden distinct users who fired it exact\n count forbidden number of events (rows) exact\n sum(e, v) required Σ of numeric label v exact\n avg(e, v) required mean of label v exact\n retention_Nd(e) forbidden % of users who returned exact\n within N days (N = 1..90)\n min(e, v) required minimum of label v approx → avg *\n max(e, v) required maximum of label v approx → avg *\n unique(e, v) required distinct values of label v approx → avg *\n p50 … p999(e,v) required quantile of v (50/75/90/ approx → avg *\n 95/99/99.9th percentile)\n\n * Display-only aggregations. The experiment t-test needs a per-user mean and\n variance, so min/max/unique/quantile are computed exactly on dashboards but\n collapse to a per-user \\`avg\\` when used as an experiment metric. If you need\n an exact experiment metric, pick count_users / count / sum / avg / retention.\n\n \"count\" is the DSL spelling of the internal count_events (one per matching\n row); \"count_users\" is unique-by-user. Getting these two confused is the most\n common mistake — count double-counts a user who fired the event twice.\n\n\nSELECTOR & FILTERS\n------------------\n The selector is the event name plus an optional \\`{ ... }\\` filter set that\n narrows which events count. Each filter compares an event LABEL to a quoted\n string:\n\n = equal != not equal\n =~ regex match !~ regex NOT match\n\n - Values are ALWAYS double-quoted strings, even for numeric labels — they are\n coerced on the server (\\`amount=~\"^1[0-9]$\"\\`, \\`status=\"200\"\\`).\n - Multiple filters are AND-ed: \\`{country=\"US\", tier!=\"free\"}\\`.\n - Every filter label AND the value label must be a label DECLARED on the source\n event. Undeclared labels are a validation error, not a silent no-match.\n\n\nGROUP-BY\n--------\n Splits the result into one series per label combination.\n by (a, b) one series per distinct (a, b) — keep only these labels\n without (a, b) group by all declared labels EXCEPT a, b\n\n NOTE: group-by is a DASHBOARD-only feature. In an experiment the group-by is\n ignored — a per-user reducer is applied across the whole arm instead.\n\n\nNOT SUPPORTED (will fail to parse)\n----------------------------------\n - arithmetic / ratios / formulas: \\`count(a) / count(b)\\`\n - more than one event per query\n - arbitrary quantiles (only the fixed p50/p75/p90/p95/p99/p999)\n - unquoted or numeric filter values: \\`{status=200}\\` → must be \\`\"200\"\\`\n - trailing tokens after the query\n\n\nEXAMPLES (query — what it measures)\n--------------------------------------\n count_users(checkout_completed)\n distinct users who completed checkout.\n\n count(add_to_cart{country=\"US\"})\n number of US add-to-cart events (a user can count many times).\n\n sum(purchase{country=\"US\"}, amount)\n total purchase amount from US purchase events.\n\n avg(req_dur{tier!=\"free\"}, ms) without (region)\n mean request duration for non-free tiers, one series per region-excluded\n label combination.\n\n p99(req_dur{route=~\"/api/.*\"}, ms) by (route, status)\n 99th-percentile latency of /api/* requests, split by route and status.\n\n unique(login{method=\"sso\"}, device_id)\n distinct SSO devices seen (display-only; an experiment would use per-user avg).\n\n retention_7d(session_start)\n share of users who started a new session within 7 days.\n`;\n\nexport const grammarOp: CustomOp = {\n group: [\"metrics\"],\n name: \"grammar\",\n summary: \"Print the metric query DSL grammar\",\n description:\n \"Print the full metric query DSL reference — grammar, aggregation semantics, \" +\n \"filter/group-by rules, and glossed examples — used to author `metrics create --query`.\",\n params: [],\n examples: [{ run: \"shipeasy metrics grammar\" }],\n run: () => ({ grammar: METRIC_GRAMMAR }),\n};\n","/**\n * The custom-operations registry — hand-written operations that are NOT admin\n * API endpoints (so they can't be generated from the spec): the metric-DSL\n * grammar (pure) and the SDK-docs fetcher (outbound `fetch` to GitHub Pages).\n *\n * It mirrors the old operations registry in spirit, but is deliberately tiny and\n * framework-agnostic: each `CustomOp` carries its command path, params, and a\n * self-contained `run`. Both consumers project it with a thin adapter — the CLI\n * (`commands/custom.ts`) and, later, the MCP server — so the surface stays in\n * sync across them. `run` never touches the filesystem, so it's worker-safe.\n */\nexport type CustomParamType = \"string\" | \"number\" | \"boolean\";\n\nexport interface CustomParam {\n name: string;\n type: CustomParamType;\n description?: string;\n required?: boolean;\n /** Render as a positional CLI argument (vs a `--flag`). */\n positional?: boolean;\n enum?: string[];\n}\n\nexport interface CustomOp {\n /** Command path, e.g. `[\"docs\"]` → `shipeasy docs <name>`, `[\"metrics\"]` → `metrics <name>`. */\n group: string[];\n /** Verb. */\n name: string;\n summary: string;\n description?: string;\n params: CustomParam[];\n examples?: { note?: string; run: string }[];\n /** Self-contained handler. `args` are the coerced param values. */\n run: (args: Record<string, unknown>) => Promise<unknown> | unknown;\n}\n\n/** Thrown by a custom op for a user-facing error with an HTTP-ish status. */\nexport class CustomOpError extends Error {\n constructor(\n message: string,\n public status = 400,\n ) {\n super(message);\n this.name = \"CustomOpError\";\n }\n}\n\nexport const opId = (op: CustomOp): string => [...op.group, op.name].join(\".\");\n","import { type CustomOp, CustomOpError } from \"./types.js\";\n\n/**\n * SDK-docs operations — `docs list/get/skill`. A generic fetcher over each SDK\n * repo's `/docs/` folder published to plain GitHub Pages (latest only, no\n * backend, no version arg). The `run`s do outbound `fetch` (worker-safe — not\n * the fs/AST boundary) and fall back to a built-in default doc set for repos\n * that haven't adopted the doc standard yet.\n */\nconst SDK_REPOS: Record<string, { owner: string; repo: string }> = {\n typescript: { owner: \"shipeasy-ai\", repo: \"sdk\" },\n javascript: { owner: \"shipeasy-ai\", repo: \"sdk\" },\n node: { owner: \"shipeasy-ai\", repo: \"sdk\" },\n ts: { owner: \"shipeasy-ai\", repo: \"sdk\" },\n python: { owner: \"shipeasy-ai\", repo: \"sdk-python\" },\n go: { owner: \"shipeasy-ai\", repo: \"sdk-go\" },\n java: { owner: \"shipeasy-ai\", repo: \"sdk-java\" },\n kotlin: { owner: \"shipeasy-ai\", repo: \"sdk-kotlin\" },\n php: { owner: \"shipeasy-ai\", repo: \"sdk-php\" },\n swift: { owner: \"shipeasy-ai\", repo: \"sdk-swift\" },\n ruby: { owner: \"shipeasy-ai\", repo: \"sdk-ruby\" },\n};\nconst SDK_ENUM = Object.keys(SDK_REPOS);\n\ninterface DocManifest {\n schemaVersion: number;\n sdk: string;\n placeholders?: string[];\n skill?: string;\n pages?: Record<string, string>;\n snippets?: Record<string, Record<string, string>>;\n}\n\nconst DEFAULT_MANIFEST: DocManifest = {\n schemaVersion: 2,\n sdk: \"default\",\n placeholders: [\"RESOURCE_NAME\"],\n skill: \"skill/SKILL.md\",\n pages: { overview: \"pages/overview.md\", installation: \"pages/installation.md\" },\n snippets: { release: { flags: \"snippets/release/flags.md\" } },\n};\nconst DEFAULT_CONTENT: Record<string, string> = {\n \"pages/overview.md\":\n \"# Shipeasy SDK\\n\\nThis SDK has not published its `/docs/` folder yet. See https://docs.shipeasy.ai for the full reference.\",\n \"pages/installation.md\":\n \"# Installation\\n\\nInstall the Shipeasy SDK for your language, then call `shipeasy({ serverKey })` (server) or `shipeasy({ clientKey })` (browser).\",\n \"snippets/release/flags.md\": \"```\\nconst on = await client.checkGate(user, '{{RESOURCE_NAME}}');\\n```\",\n \"skill/SKILL.md\":\n \"---\\nname: shipeasy-sdk\\ndescription: Use the Shipeasy SDK for flags, experiments, configs, and i18n.\\n---\\n\\nThis SDK has not published a skill yet. See https://docs.shipeasy.ai.\",\n};\n\n/**\n * Resolve the caller-supplied `sdk`. The adapters (CLI/MCP) default it from the\n * nearest `.shipeasy` before we get here, so an empty value means neither a flag\n * nor a bound project supplied one — surface that explicitly.\n */\nfunction requireSdk(sdk: unknown): string {\n const s = typeof sdk === \"string\" ? sdk.trim() : \"\";\n if (!s)\n throw new CustomOpError(\n `No SDK given and none recorded in .shipeasy. Pass --sdk <lang> (one of: ${SDK_ENUM.join(\", \")}), ` +\n `or run \\`shipeasy detect\\` in the project to record its sdk.`,\n 400,\n );\n return s;\n}\nfunction repoFor(sdk: string): { owner: string; repo: string } {\n const r = SDK_REPOS[sdk.toLowerCase()];\n if (!r) throw new CustomOpError(`Unknown SDK '${sdk}'. One of: ${SDK_ENUM.join(\", \")}`, 400);\n return r;\n}\nfunction pagesBase(sdk: string): string {\n const { owner, repo } = repoFor(sdk);\n return `https://${owner}.github.io/${repo}`;\n}\nasync function fetchText(url: string): Promise<string | null> {\n const res = await fetch(url);\n if (!res.ok) return null;\n return res.text();\n}\nasync function loadManifest(sdk: string): Promise<{ manifest: DocManifest; fallback: boolean }> {\n const text = await fetchText(`${pagesBase(sdk)}/manifest.json`);\n if (!text) return { manifest: DEFAULT_MANIFEST, fallback: true };\n try {\n return { manifest: JSON.parse(text) as DocManifest, fallback: false };\n } catch {\n return { manifest: DEFAULT_MANIFEST, fallback: true };\n }\n}\nfunction resolvePath(manifest: DocManifest, handle: string): string {\n if (handle.endsWith(\".md\")) return handle;\n if (manifest.pages?.[handle]) return manifest.pages[handle];\n if (handle.includes(\"/\")) {\n const [group, resource] = handle.split(\"/\", 2);\n const p = manifest.snippets?.[group]?.[resource];\n if (p) return p;\n }\n throw new CustomOpError(\n `Doc '${handle}' not found. Run 'docs list --sdk <lang>' to see available pages and snippets.`,\n 404,\n );\n}\nfunction substitute(body: string, manifest: DocManifest, args: Record<string, unknown>): string {\n let out = body;\n for (const ph of manifest.placeholders ?? []) {\n const value =\n (args[ph] as string | undefined) ??\n (ph === \"RESOURCE_NAME\" ? (args.name as string | undefined) : undefined) ??\n (ph === \"FRAMEWORK\" ? (args.framework as string | undefined) : undefined);\n if (value !== undefined) out = out.replaceAll(`{{${ph}}}`, value);\n }\n return out;\n}\n\nexport const docsOps: CustomOp[] = [\n {\n group: [\"docs\"],\n name: \"list\",\n summary: \"List an SDK's documentation tree\",\n description:\n \"Fetch an SDK's `/docs/manifest.json` and return the doc tree — feature pages, nested snippet groups, and whether an installable skill exists.\",\n params: [{ name: \"sdk\", type: \"string\", description: \"SDK language. Defaults to the `sdk` recorded in the nearest `.shipeasy` when omitted.\", required: false, enum: SDK_ENUM }],\n examples: [{ run: \"shipeasy docs list --sdk python\" }],\n run: async (args) => {\n const sdk = requireSdk(args.sdk);\n const { manifest, fallback } = await loadManifest(sdk);\n return {\n sdk,\n fallback,\n pages: Object.keys(manifest.pages ?? {}),\n snippets: Object.fromEntries(\n Object.entries(manifest.snippets ?? {}).map(([g, r]) => [g, Object.keys(r)]),\n ),\n skill: Boolean(manifest.skill),\n };\n },\n },\n {\n group: [\"docs\"],\n name: \"get\",\n summary: \"Fetch one SDK doc page or snippet\",\n description:\n \"Fetch one feature page (`flags`, `experiments`, …) or nested snippet (`release/experiments`, …), substituting declared {{placeholders}} from caller args.\",\n params: [\n { name: \"sdk\", type: \"string\", description: \"SDK language. Defaults to the `sdk` recorded in the nearest `.shipeasy` when omitted.\", required: false, enum: SDK_ENUM },\n { name: \"path\", type: \"string\", description: \"Page key or snippet 'group/resource'.\", required: true, positional: true },\n { name: \"framework\", type: \"string\", description: \"Framework hint (substitutes {{FRAMEWORK}}).\" },\n { name: \"name\", type: \"string\", description: \"Resource name (substitutes {{RESOURCE_NAME}}).\" },\n ],\n examples: [\n { note: \"A feature page\", run: \"shipeasy docs get --sdk python experiments\" },\n { note: \"A nested snippet\", run: \"shipeasy docs get --sdk typescript release/flags --name checkout_v2\" },\n ],\n run: async (args) => {\n const sdk = requireSdk(args.sdk);\n const { manifest, fallback } = await loadManifest(sdk);\n const path = resolvePath(manifest, args.path as string);\n const body = fallback ? DEFAULT_CONTENT[path] : ((await fetchText(`${pagesBase(sdk)}/${path}`)) ?? undefined);\n if (body === undefined) throw new CustomOpError(`Doc '${path}' could not be fetched for '${sdk}'.`, 404);\n return { sdk, path, fallback, content: substitute(body, manifest, args) };\n },\n },\n {\n group: [\"docs\"],\n name: \"skill\",\n summary: \"Fetch an SDK's installable LLM skill\",\n description:\n \"Fetch the SDK's `skill/SKILL.md` (frontmatter intact) so an agent can install it verbatim. The CLI `--install` writes it locally (a consumer fs side-effect).\",\n params: [\n { name: \"sdk\", type: \"string\", description: \"SDK language. Defaults to the `sdk` recorded in the nearest `.shipeasy` when omitted.\", required: false, enum: SDK_ENUM },\n { name: \"install\", type: \"boolean\", description: \"CLI only: write the skill to the local agent skills dir.\" },\n ],\n examples: [{ run: \"shipeasy docs skill --sdk python\" }],\n run: async (args) => {\n const sdk = requireSdk(args.sdk);\n const { manifest, fallback } = await loadManifest(sdk);\n const skillPath = manifest.skill ?? \"skill/SKILL.md\";\n const content = fallback ? DEFAULT_CONTENT[skillPath] : ((await fetchText(`${pagesBase(sdk)}/${skillPath}`)) ?? undefined);\n if (content === undefined) throw new CustomOpError(`No skill published for '${sdk}'.`, 404);\n return { sdk, skillPath, fallback, content };\n },\n },\n];\n","import { grammarOp } from \"./grammar.js\";\nimport { docsOps } from \"./docs.js\";\nimport type { CustomOp } from \"./types.js\";\n\nexport type { CustomOp, CustomParam, CustomParamType } from \"./types.js\";\nexport { CustomOpError, opId } from \"./types.js\";\nexport { METRIC_GRAMMAR } from \"./grammar.js\";\n\n/**\n * Every custom (non-spec) operation, in surface order. The CLI and MCP each\n * project this with a thin adapter so the sugar commands stay in sync.\n */\nexport const customOperations: CustomOp[] = [grammarOp, ...docsOps];\n"],"mappings":";AAcO,IAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiHvB,IAAM,YAAsB;AAAA,EACjC,OAAO,CAAC,SAAS;AAAA,EACjB,MAAM;AAAA,EACN,SAAS;AAAA,EACT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