@gurulu/cli 0.4.7 → 1.0.1

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.
Files changed (190) hide show
  1. package/LICENSE +92 -0
  2. package/README.md +35 -106
  3. package/dist/bin.d.ts +3 -0
  4. package/dist/bin.d.ts.map +1 -0
  5. package/dist/bin.js +25751 -0
  6. package/dist/commands/auth.d.ts +23 -20
  7. package/dist/commands/auth.d.ts.map +1 -0
  8. package/dist/commands/doctor.d.ts +20 -6
  9. package/dist/commands/doctor.d.ts.map +1 -0
  10. package/dist/commands/init.d.ts +33 -11
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/pull.d.ts +13 -0
  13. package/dist/commands/pull.d.ts.map +1 -0
  14. package/dist/commands/push.d.ts +40 -0
  15. package/dist/commands/push.d.ts.map +1 -0
  16. package/dist/commands/validate.d.ts +36 -0
  17. package/dist/commands/validate.d.ts.map +1 -0
  18. package/dist/index.d.ts +4 -1
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +25326 -876
  21. package/dist/lib/api.d.ts +139 -0
  22. package/dist/lib/api.d.ts.map +1 -0
  23. package/dist/lib/codegen.d.ts +4 -0
  24. package/dist/lib/codegen.d.ts.map +1 -0
  25. package/dist/lib/config.d.ts +43 -0
  26. package/dist/lib/config.d.ts.map +1 -0
  27. package/dist/lib/detect.d.ts +27 -0
  28. package/dist/lib/detect.d.ts.map +1 -0
  29. package/dist/lib/detect.js +106 -0
  30. package/dist/lib/exec-install.d.ts +21 -0
  31. package/dist/lib/exec-install.d.ts.map +1 -0
  32. package/dist/lib/install-plan.d.ts +25 -0
  33. package/dist/lib/install-plan.d.ts.map +1 -0
  34. package/dist/lib/install-plan.js +161 -0
  35. package/package.json +51 -20
  36. package/bin/gurulu.js +0 -2
  37. package/dist/api-client.d.ts +0 -33
  38. package/dist/api-client.js +0 -175
  39. package/dist/commands/add-server.d.ts +0 -9
  40. package/dist/commands/add-server.js +0 -162
  41. package/dist/commands/alerts.d.ts +0 -27
  42. package/dist/commands/alerts.js +0 -309
  43. package/dist/commands/api-keys.d.ts +0 -20
  44. package/dist/commands/api-keys.js +0 -130
  45. package/dist/commands/attribution.d.ts +0 -22
  46. package/dist/commands/attribution.js +0 -111
  47. package/dist/commands/audiences.d.ts +0 -23
  48. package/dist/commands/audiences.js +0 -243
  49. package/dist/commands/audit.d.ts +0 -20
  50. package/dist/commands/audit.js +0 -130
  51. package/dist/commands/auth.js +0 -249
  52. package/dist/commands/chat.d.ts +0 -19
  53. package/dist/commands/chat.js +0 -118
  54. package/dist/commands/config.d.ts +0 -10
  55. package/dist/commands/config.js +0 -92
  56. package/dist/commands/consent.d.ts +0 -27
  57. package/dist/commands/consent.js +0 -233
  58. package/dist/commands/conversion-paths.d.ts +0 -19
  59. package/dist/commands/conversion-paths.js +0 -55
  60. package/dist/commands/db.d.ts +0 -25
  61. package/dist/commands/db.js +0 -330
  62. package/dist/commands/destinations.d.ts +0 -20
  63. package/dist/commands/destinations.js +0 -191
  64. package/dist/commands/doctor.js +0 -360
  65. package/dist/commands/errors.d.ts +0 -27
  66. package/dist/commands/errors.js +0 -121
  67. package/dist/commands/events.d.ts +0 -33
  68. package/dist/commands/events.js +0 -371
  69. package/dist/commands/experiments.d.ts +0 -22
  70. package/dist/commands/experiments.js +0 -264
  71. package/dist/commands/funnels.d.ts +0 -17
  72. package/dist/commands/funnels.js +0 -203
  73. package/dist/commands/goals.d.ts +0 -18
  74. package/dist/commands/goals.js +0 -214
  75. package/dist/commands/heatmap.d.ts +0 -27
  76. package/dist/commands/heatmap.js +0 -112
  77. package/dist/commands/identity.d.ts +0 -29
  78. package/dist/commands/identity.js +0 -328
  79. package/dist/commands/init.js +0 -215
  80. package/dist/commands/insights.d.ts +0 -10
  81. package/dist/commands/insights.js +0 -77
  82. package/dist/commands/install.d.ts +0 -259
  83. package/dist/commands/install.js +0 -1590
  84. package/dist/commands/login.d.ts +0 -20
  85. package/dist/commands/login.js +0 -170
  86. package/dist/commands/logout.d.ts +0 -10
  87. package/dist/commands/logout.js +0 -41
  88. package/dist/commands/playground.d.ts +0 -11
  89. package/dist/commands/playground.js +0 -47
  90. package/dist/commands/releases.d.ts +0 -17
  91. package/dist/commands/releases.js +0 -54
  92. package/dist/commands/replay.d.ts +0 -18
  93. package/dist/commands/replay.js +0 -64
  94. package/dist/commands/secrets.d.ts +0 -19
  95. package/dist/commands/secrets.js +0 -145
  96. package/dist/commands/setup.d.ts +0 -21
  97. package/dist/commands/setup.js +0 -67
  98. package/dist/commands/sites.d.ts +0 -18
  99. package/dist/commands/sites.js +0 -139
  100. package/dist/commands/skad.d.ts +0 -18
  101. package/dist/commands/skad.js +0 -53
  102. package/dist/commands/sourcemap.d.ts +0 -33
  103. package/dist/commands/sourcemap.js +0 -204
  104. package/dist/commands/status.d.ts +0 -7
  105. package/dist/commands/status.js +0 -136
  106. package/dist/commands/upgrade.d.ts +0 -21
  107. package/dist/commands/upgrade.js +0 -183
  108. package/dist/commands/warehouse.d.ts +0 -20
  109. package/dist/commands/warehouse.js +0 -65
  110. package/dist/commands/warehouses.d.ts +0 -17
  111. package/dist/commands/warehouses.js +0 -182
  112. package/dist/commands/watch.d.ts +0 -45
  113. package/dist/commands/watch.js +0 -258
  114. package/dist/commands/whoami.d.ts +0 -9
  115. package/dist/commands/whoami.js +0 -50
  116. package/dist/config.d.ts +0 -75
  117. package/dist/config.js +0 -329
  118. package/dist/frameworks/detect.d.ts +0 -8
  119. package/dist/frameworks/detect.js +0 -458
  120. package/dist/install-intent-proposal.d.ts +0 -99
  121. package/dist/install-intent-proposal.js +0 -202
  122. package/dist/utils/api.d.ts +0 -20
  123. package/dist/utils/api.js +0 -47
  124. package/dist/utils/config.d.ts +0 -13
  125. package/dist/utils/config.js +0 -30
  126. package/dist/utils/confirm.d.ts +0 -17
  127. package/dist/utils/confirm.js +0 -40
  128. package/dist/utils/dry-run.d.ts +0 -20
  129. package/dist/utils/dry-run.js +0 -67
  130. package/dist/utils/from-file.d.ts +0 -9
  131. package/dist/utils/from-file.js +0 -72
  132. package/dist/utils/redact.d.ts +0 -14
  133. package/dist/utils/redact.js +0 -48
  134. package/dist/utils/ui.d.ts +0 -14
  135. package/dist/utils/ui.js +0 -59
  136. package/scripts/.gitkeep +0 -0
  137. package/scripts/README-gurulu-agentic-install.md +0 -114
  138. package/scripts/README-gurulu-scan.md +0 -98
  139. package/scripts/audit-cli-scopes.mjs +0 -204
  140. package/scripts/backfill-tenant-id.mjs +0 -172
  141. package/scripts/backfill-tenant-links.ts +0 -252
  142. package/scripts/backup-clickhouse.sh +0 -27
  143. package/scripts/backup-postgres.sh +0 -19
  144. package/scripts/bootstrap-runtime-schema.mjs +0 -87
  145. package/scripts/bootstrap-stripe.mjs +0 -158
  146. package/scripts/gurulu-agentic-install.lib.cjs +0 -762
  147. package/scripts/gurulu-agentic-install.mjs +0 -623
  148. package/scripts/gurulu-scan.lib.cjs +0 -1509
  149. package/scripts/gurulu-scan.mjs +0 -91
  150. package/scripts/gurulu-verify-install.lib.cjs +0 -334
  151. package/scripts/gurulu-verify-install.mjs +0 -59
  152. package/scripts/init-ssl.sh +0 -26
  153. package/scripts/migrate-flow-graph-enums.sh +0 -86
  154. package/scripts/monitor-disk.sh +0 -24
  155. package/scripts/patches/astro.patch.cjs +0 -74
  156. package/scripts/patches/auto-instrument/ast-helper.cjs +0 -480
  157. package/scripts/patches/auto-instrument/astro.cjs +0 -273
  158. package/scripts/patches/auto-instrument/express.cjs +0 -383
  159. package/scripts/patches/auto-instrument/fastify.cjs +0 -262
  160. package/scripts/patches/auto-instrument/hono.cjs +0 -392
  161. package/scripts/patches/auto-instrument/index.cjs +0 -80
  162. package/scripts/patches/auto-instrument/nestjs.cjs +0 -286
  163. package/scripts/patches/auto-instrument/nextjs-app-router.cjs +0 -345
  164. package/scripts/patches/auto-instrument/nextjs-pages.cjs +0 -361
  165. package/scripts/patches/auto-instrument/remix.cjs +0 -168
  166. package/scripts/patches/auto-instrument/sdk-helper-map.cjs +0 -241
  167. package/scripts/patches/auto-instrument/singleton-helper.cjs +0 -193
  168. package/scripts/patches/auto-instrument/sveltekit.cjs +0 -161
  169. package/scripts/patches/auto-instrument/vite-react.cjs +0 -37
  170. package/scripts/patches/auto-instrument/vue.cjs +0 -196
  171. package/scripts/patches/express.patch.cjs +0 -99
  172. package/scripts/patches/fastify.patch.cjs +0 -108
  173. package/scripts/patches/index.cjs +0 -300
  174. package/scripts/patches/nestjs.patch.cjs +0 -112
  175. package/scripts/patches/nextjs-app-router.patch.cjs +0 -97
  176. package/scripts/patches/nextjs-pages.patch.cjs +0 -97
  177. package/scripts/patches/remix.patch.cjs +0 -75
  178. package/scripts/patches/sveltekit.patch.cjs +0 -72
  179. package/scripts/patches/vite-react.patch.cjs +0 -73
  180. package/scripts/patches/vue.patch.cjs +0 -82
  181. package/scripts/renew-ssl.sh +0 -14
  182. package/scripts/resolve-migration.sh +0 -23
  183. package/scripts/seed-cli-dev-keys.mjs +0 -130
  184. package/scripts/seed-test-data.mjs +0 -391
  185. package/scripts/spike-browserless.ts +0 -65
  186. package/scripts/tenant-pivot-consistency-check.mjs +0 -205
  187. package/scripts/tenant-pivot-phase-3-cleanup.lib.cjs +0 -258
  188. package/scripts/tenant-pivot-phase-3-cleanup.mjs +0 -98
  189. package/scripts/test-identity-resolution.ts +0 -804
  190. package/scripts/validate-gurulu-schemas.mjs +0 -79
@@ -1,80 +0,0 @@
1
- // scripts/patches/auto-instrument/index.cjs — Phase 18.7 B auto-instrument
2
- // dispatcher.
3
- //
4
- // Maps a resolved framework name to the matching auto-instrument module and
5
- // exposes a single `dispatch(framework, ctx, events)` entry point used by
6
- // `scripts/gurulu-agentic-install.mjs` and `packages/cli/src/commands/
7
- // install.ts`. Modules themselves own singleton-helper planning and regex
8
- // instrumentation; this index is just the registry.
9
-
10
- const nextAppRouter = require('./nextjs-app-router.cjs');
11
- const nextPages = require('./nextjs-pages.cjs');
12
- const express = require('./express.cjs');
13
- const viteReact = require('./vite-react.cjs');
14
- const nestjs = require('./nestjs.cjs');
15
- const remix = require('./remix.cjs');
16
- const sveltekit = require('./sveltekit.cjs');
17
- const astro = require('./astro.cjs');
18
- const fastify = require('./fastify.cjs');
19
- const hono = require('./hono.cjs');
20
- const vue = require('./vue.cjs');
21
- const singleton = require('./singleton-helper.cjs');
22
-
23
- const MODULES = [
24
- nextAppRouter,
25
- nextPages,
26
- express,
27
- viteReact,
28
- nestjs,
29
- remix,
30
- sveltekit,
31
- astro,
32
- fastify,
33
- hono,
34
- vue,
35
- ];
36
-
37
- const MODULE_BY_FRAMEWORK = {};
38
- for (const mod of MODULES) {
39
- for (const fw of mod.supportedFrameworks) {
40
- MODULE_BY_FRAMEWORK[fw] = mod;
41
- }
42
- }
43
- // Aliases.
44
- MODULE_BY_FRAMEWORK['nextjs'] = nextAppRouter;
45
- MODULE_BY_FRAMEWORK['nextjs-app'] = nextAppRouter;
46
-
47
- function resolveModule(framework) {
48
- if (!framework) return null;
49
- return MODULE_BY_FRAMEWORK[framework] || null;
50
- }
51
-
52
- /**
53
- * Dispatch: given a framework, context, and a list of ProposedEvents, invoke
54
- * the matching module's `instrumentEvents()` and return its plan result. If
55
- * no module matches, returns a no-op plan with a note describing why.
56
- */
57
- function dispatch(framework, ctx, events) {
58
- const mod = resolveModule(framework);
59
- if (!mod) {
60
- return {
61
- changes: [],
62
- notes: [`auto-instrument:no-module-for-${framework || 'auto'}`],
63
- filesModified: 0,
64
- eventsInstrumented: 0,
65
- eventsSkipped: events ? events.length : 0,
66
- collision: false,
67
- module: null,
68
- };
69
- }
70
- const result = mod.instrumentEvents(ctx, events);
71
- return { ...result, module: mod.name };
72
- }
73
-
74
- module.exports = {
75
- MODULES,
76
- MODULE_BY_FRAMEWORK,
77
- resolveModule,
78
- dispatch,
79
- singleton,
80
- };
@@ -1,286 +0,0 @@
1
- // scripts/patches/auto-instrument/nestjs.cjs — Phase 20 W1 A3.
2
- //
3
- // AST-based auto-instrumentation for NestJS controllers. We parse every
4
- // controller file under `src/**` and look for class methods decorated with
5
- // `@Get`, `@Post`, etc. whose enclosing class carries a `@Controller('...')`
6
- // decorator. Matching methods get a `gurulu.track(...)` call inserted
7
- // before the last top-level return.
8
- //
9
- // Route matching: given a ProposedEvent with `source.route = 'POST /users'`
10
- // we match against `<controllerBase>/<methodPath>` where `controllerBase`
11
- // comes from the `@Controller('path')` argument and `methodPath` comes from
12
- // the method decorator argument (optional, defaults to '/').
13
-
14
- const fs = require('fs');
15
- const path = require('path');
16
-
17
- const ast = require('./ast-helper.cjs');
18
- const singleton = require('./singleton-helper.cjs');
19
-
20
- const NAME = 'auto-instrument-nestjs';
21
- const SUPPORTED = ['nestjs'];
22
-
23
- const HTTP_DECORATORS = new Set([
24
- 'Get', 'Post', 'Put', 'Patch', 'Delete', 'Options', 'Head', 'All',
25
- ]);
26
-
27
- function parseEventRoute(routeStr) {
28
- if (!routeStr || typeof routeStr !== 'string') return null;
29
- const m = routeStr.trim().match(/^([A-Z]+)\s+(\/.*)$/);
30
- if (!m) return null;
31
- return { method: m[1].toUpperCase(), urlPath: m[2].replace(/\/+$/, '') || '/' };
32
- }
33
-
34
- function walkSourceFiles(repoRoot) {
35
- const results = [];
36
- const stack = ['src'];
37
- while (stack.length > 0) {
38
- const rel = stack.pop();
39
- const abs = path.join(repoRoot, rel);
40
- if (!fs.existsSync(abs)) continue;
41
- let entries = [];
42
- try {
43
- entries = fs.readdirSync(abs, { withFileTypes: true });
44
- } catch (_) {
45
- continue;
46
- }
47
- for (const entry of entries) {
48
- if (entry.name === 'node_modules' || entry.name.startsWith('.')) continue;
49
- const childRel = path.posix.join(rel, entry.name);
50
- if (entry.isDirectory()) {
51
- stack.push(childRel);
52
- } else if (/\.(ts|js)$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {
53
- results.push(childRel);
54
- }
55
- }
56
- }
57
- return results;
58
- }
59
-
60
- /**
61
- * Normalize a base + method route into the "/base/method" form (no trailing
62
- * slash, no duplicate slashes). Leading slash enforced.
63
- */
64
- function joinRoute(base, method) {
65
- const a = String(base || '').replace(/^\//, '').replace(/\/+$/, '');
66
- const b = String(method || '').replace(/^\//, '').replace(/\/+$/, '');
67
- let joined = [a, b].filter(Boolean).join('/');
68
- joined = '/' + joined;
69
- return joined.replace(/\/+/g, '/').replace(/\/$/, '') || '/';
70
- }
71
-
72
- /**
73
- * Scan an AST for controller class methods and collect
74
- * `{ classNode, methodNode, method, urlPath }` entries.
75
- */
76
- function collectControllerMethods(tree) {
77
- const t = ast.t;
78
- const results = [];
79
- ast.traverse(tree, {
80
- ClassDeclaration(p) {
81
- const decorators = p.node.decorators || [];
82
- let controllerBase = '';
83
- let isController = false;
84
- for (const d of decorators) {
85
- if (!t.isDecorator(d)) continue;
86
- const expr = d.expression;
87
- if (t.isCallExpression(expr) && t.isIdentifier(expr.callee) && expr.callee.name === 'Controller') {
88
- isController = true;
89
- const arg0 = expr.arguments[0];
90
- if (t.isStringLiteral(arg0)) controllerBase = arg0.value;
91
- }
92
- }
93
- if (!isController) return;
94
- for (const member of p.node.body.body) {
95
- if (!t.isClassMethod(member) && !t.isClassProperty(member)) continue;
96
- const mDecorators = member.decorators || [];
97
- for (const dec of mDecorators) {
98
- if (!t.isDecorator(dec)) continue;
99
- const expr = dec.expression;
100
- if (!t.isCallExpression(expr)) continue;
101
- if (!t.isIdentifier(expr.callee)) continue;
102
- if (!HTTP_DECORATORS.has(expr.callee.name)) continue;
103
- const httpMethod = expr.callee.name.toUpperCase();
104
- const arg0 = expr.arguments[0];
105
- const methodPath = t.isStringLiteral(arg0) ? arg0.value : '';
106
- const fullPath = joinRoute(controllerBase, methodPath);
107
- // Only support class methods with block bodies.
108
- if (!t.isClassMethod(member) || !t.isBlockStatement(member.body)) continue;
109
- results.push({
110
- methodNode: member,
111
- body: member.body,
112
- httpMethod,
113
- urlPath: fullPath,
114
- });
115
- }
116
- }
117
- },
118
- });
119
- return results;
120
- }
121
-
122
- function astInstrumentFile(source, targets, opts = {}) {
123
- // targets: [{ httpMethod, urlPath, events: [] }]
124
- const tree = ast.parseSource(source);
125
- const methods = collectControllerMethods(tree);
126
- if (methods.length === 0) return { ok: false, reason: 'no-controllers' };
127
- let changed = false;
128
- const instrumentedNames = [];
129
- const skipped = [];
130
- for (const target of targets) {
131
- const match = methods.find(
132
- (m) => m.httpMethod === target.httpMethod && m.urlPath === target.urlPath,
133
- );
134
- if (!match) {
135
- for (const e of target.events) {
136
- skipped.push({ event: e.name, reason: 'controller-method-not-found' });
137
- }
138
- continue;
139
- }
140
- if (ast.hasInstrumentedMarker(match.methodNode)) {
141
- for (const e of target.events) skipped.push({ event: e.name, reason: 'already-instrumented' });
142
- continue;
143
- }
144
- const stmts = target.events.map((e) => ast.buildTrackStatement(e.name, e.autoProperties));
145
- ast.injectTrackBeforeLastReturn(match.methodNode, match.body, stmts);
146
- changed = true;
147
- for (const e of target.events) instrumentedNames.push(e.name);
148
- }
149
- if (!changed) {
150
- return { ok: true, after: source, instrumented: [], skipped, changed: false };
151
- }
152
- // Sprint D / D4 — alias-aware import.
153
- const specifier = ast.resolveGuruluImportSpecifier(opts.repoRoot, opts.relPath);
154
- ast.ensureGuruluImport(tree, specifier);
155
- const after = ast.generateSource(tree, source);
156
- return { ok: true, after, instrumented: instrumentedNames, skipped, changed: true };
157
- }
158
-
159
- function resolveControllerFileForEvent(ctx, httpMethod, urlPath) {
160
- const files = walkSourceFiles(ctx.repoRoot);
161
- for (const rel of files) {
162
- if (!/\.controller\.(ts|js)$/.test(rel) && !rel.includes('controller')) continue;
163
- const abs = path.join(ctx.repoRoot, rel);
164
- let src;
165
- try {
166
- src = fs.readFileSync(abs, 'utf8');
167
- } catch (_) {
168
- continue;
169
- }
170
- if (!src.includes('@Controller')) continue;
171
- try {
172
- const tree = ast.parseSource(src);
173
- const methods = collectControllerMethods(tree);
174
- if (methods.some((m) => m.httpMethod === httpMethod && m.urlPath === urlPath)) {
175
- return rel;
176
- }
177
- } catch (_) {
178
- // Skip malformed files.
179
- }
180
- }
181
- return null;
182
- }
183
-
184
- function instrumentEvents(ctx, events) {
185
- const helper = singleton.ensureSingletonHelper(ctx, 'nestjs');
186
- const changes = [...helper.changes];
187
- const notes = [...helper.notes];
188
- let eventsInstrumented = 0;
189
- let eventsSkipped = 0;
190
-
191
- if (helper.collision) {
192
- return {
193
- changes: [],
194
- notes,
195
- filesModified: 0,
196
- eventsInstrumented: 0,
197
- eventsSkipped: events ? events.length : 0,
198
- collision: true,
199
- };
200
- }
201
-
202
- // Group events by (file, httpMethod, urlPath).
203
- const fileGroups = new Map();
204
- for (const e of events || []) {
205
- const parsed = parseEventRoute(e && e.source && e.source.route);
206
- if (!parsed) {
207
- notes.push(`skip:${e && e.name}:no-source-route`);
208
- eventsSkipped++;
209
- continue;
210
- }
211
- const rel = resolveControllerFileForEvent(ctx, parsed.method, parsed.urlPath);
212
- if (!rel) {
213
- notes.push(`skip:${e.name}:controller-not-found`);
214
- eventsSkipped++;
215
- continue;
216
- }
217
- if (!fileGroups.has(rel)) fileGroups.set(rel, new Map());
218
- const perFile = fileGroups.get(rel);
219
- const key = `${parsed.method}::${parsed.urlPath}`;
220
- if (!perFile.has(key)) perFile.set(key, { httpMethod: parsed.method, urlPath: parsed.urlPath, events: [] });
221
- perFile.get(key).events.push(e);
222
- }
223
-
224
- for (const [rel, perFile] of fileGroups.entries()) {
225
- const abs = path.join(ctx.repoRoot, rel);
226
- const before = fs.readFileSync(abs, 'utf8');
227
- const targets = Array.from(perFile.values());
228
- // Sprint D / D4 — pass repoRoot + relPath to the import resolver.
229
- const fileOpts = { repoRoot: (ctx && ctx.repoRoot) || null, relPath: rel };
230
- let res;
231
- try {
232
- res = astInstrumentFile(before, targets, fileOpts);
233
- } catch (err) {
234
- const msg = (err && err.message) || String(err);
235
- // eslint-disable-next-line no-console
236
- console.warn(`[auto-instrument] patch.fallback ${rel}: ${msg}`);
237
- notes.push(`patch.fallback:${rel}:${msg}`);
238
- continue;
239
- }
240
- if (!res.ok) {
241
- for (const t of targets) {
242
- for (const e of t.events) {
243
- notes.push(`skip:${e.name}:${res.reason}`);
244
- eventsSkipped++;
245
- }
246
- }
247
- continue;
248
- }
249
- for (const s of res.skipped || []) {
250
- notes.push(`skip:${s.event}:${s.reason}`);
251
- eventsSkipped++;
252
- }
253
- if (res.changed) {
254
- changes.push({
255
- relPath: rel,
256
- before,
257
- after: res.after,
258
- reason: `auto-instrument-nestjs`,
259
- type: 'auto-instrument',
260
- });
261
- eventsInstrumented += (res.instrumented || []).length;
262
- }
263
- }
264
-
265
- const filesModified = changes.filter((c) => c.type === 'auto-instrument').length;
266
- return { changes, notes, filesModified, eventsInstrumented, eventsSkipped, collision: false };
267
- }
268
-
269
- function ensureSingletonHelper(ctx) {
270
- return singleton.ensureSingletonHelper(ctx, 'nestjs');
271
- }
272
-
273
- module.exports = {
274
- name: NAME,
275
- supportedFrameworks: SUPPORTED,
276
- ensureSingletonHelper,
277
- instrumentEvents,
278
- _internals: {
279
- parseEventRoute,
280
- walkSourceFiles,
281
- collectControllerMethods,
282
- astInstrumentFile,
283
- resolveControllerFileForEvent,
284
- joinRoute,
285
- },
286
- };