@gurulu/cli 0.4.6 → 1.0.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.
Files changed (180) 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 +25410 -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 +25 -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 +24985 -853
  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/package.json +40 -20
  28. package/bin/gurulu.js +0 -2
  29. package/dist/api-client.d.ts +0 -33
  30. package/dist/api-client.js +0 -175
  31. package/dist/commands/add-server.d.ts +0 -9
  32. package/dist/commands/add-server.js +0 -162
  33. package/dist/commands/alerts.d.ts +0 -27
  34. package/dist/commands/alerts.js +0 -309
  35. package/dist/commands/api-keys.d.ts +0 -20
  36. package/dist/commands/api-keys.js +0 -130
  37. package/dist/commands/attribution.d.ts +0 -22
  38. package/dist/commands/attribution.js +0 -111
  39. package/dist/commands/audiences.d.ts +0 -23
  40. package/dist/commands/audiences.js +0 -243
  41. package/dist/commands/audit.d.ts +0 -20
  42. package/dist/commands/audit.js +0 -130
  43. package/dist/commands/auth.js +0 -249
  44. package/dist/commands/chat.d.ts +0 -18
  45. package/dist/commands/chat.js +0 -117
  46. package/dist/commands/config.d.ts +0 -10
  47. package/dist/commands/config.js +0 -92
  48. package/dist/commands/consent.d.ts +0 -27
  49. package/dist/commands/consent.js +0 -233
  50. package/dist/commands/conversion-paths.d.ts +0 -19
  51. package/dist/commands/conversion-paths.js +0 -55
  52. package/dist/commands/db.d.ts +0 -25
  53. package/dist/commands/db.js +0 -330
  54. package/dist/commands/destinations.d.ts +0 -20
  55. package/dist/commands/destinations.js +0 -191
  56. package/dist/commands/doctor.js +0 -360
  57. package/dist/commands/errors.d.ts +0 -27
  58. package/dist/commands/errors.js +0 -121
  59. package/dist/commands/events.d.ts +0 -33
  60. package/dist/commands/events.js +0 -349
  61. package/dist/commands/experiments.d.ts +0 -22
  62. package/dist/commands/experiments.js +0 -264
  63. package/dist/commands/funnels.d.ts +0 -17
  64. package/dist/commands/funnels.js +0 -203
  65. package/dist/commands/goals.d.ts +0 -18
  66. package/dist/commands/goals.js +0 -214
  67. package/dist/commands/heatmap.d.ts +0 -27
  68. package/dist/commands/heatmap.js +0 -112
  69. package/dist/commands/identity.d.ts +0 -29
  70. package/dist/commands/identity.js +0 -328
  71. package/dist/commands/init.js +0 -215
  72. package/dist/commands/insights.d.ts +0 -10
  73. package/dist/commands/insights.js +0 -65
  74. package/dist/commands/install.d.ts +0 -259
  75. package/dist/commands/install.js +0 -1590
  76. package/dist/commands/login.d.ts +0 -20
  77. package/dist/commands/login.js +0 -170
  78. package/dist/commands/logout.d.ts +0 -10
  79. package/dist/commands/logout.js +0 -41
  80. package/dist/commands/playground.d.ts +0 -11
  81. package/dist/commands/playground.js +0 -47
  82. package/dist/commands/releases.d.ts +0 -17
  83. package/dist/commands/releases.js +0 -54
  84. package/dist/commands/replay.d.ts +0 -18
  85. package/dist/commands/replay.js +0 -64
  86. package/dist/commands/secrets.d.ts +0 -19
  87. package/dist/commands/secrets.js +0 -145
  88. package/dist/commands/sites.d.ts +0 -18
  89. package/dist/commands/sites.js +0 -139
  90. package/dist/commands/skad.d.ts +0 -18
  91. package/dist/commands/skad.js +0 -53
  92. package/dist/commands/sourcemap.d.ts +0 -33
  93. package/dist/commands/sourcemap.js +0 -204
  94. package/dist/commands/status.d.ts +0 -7
  95. package/dist/commands/status.js +0 -136
  96. package/dist/commands/upgrade.d.ts +0 -21
  97. package/dist/commands/upgrade.js +0 -183
  98. package/dist/commands/warehouse.d.ts +0 -20
  99. package/dist/commands/warehouse.js +0 -65
  100. package/dist/commands/warehouses.d.ts +0 -17
  101. package/dist/commands/warehouses.js +0 -182
  102. package/dist/commands/watch.d.ts +0 -45
  103. package/dist/commands/watch.js +0 -258
  104. package/dist/commands/whoami.d.ts +0 -9
  105. package/dist/commands/whoami.js +0 -50
  106. package/dist/config.d.ts +0 -75
  107. package/dist/config.js +0 -329
  108. package/dist/frameworks/detect.d.ts +0 -8
  109. package/dist/frameworks/detect.js +0 -444
  110. package/dist/install-intent-proposal.d.ts +0 -99
  111. package/dist/install-intent-proposal.js +0 -202
  112. package/dist/utils/api.d.ts +0 -20
  113. package/dist/utils/api.js +0 -47
  114. package/dist/utils/config.d.ts +0 -13
  115. package/dist/utils/config.js +0 -30
  116. package/dist/utils/confirm.d.ts +0 -17
  117. package/dist/utils/confirm.js +0 -40
  118. package/dist/utils/dry-run.d.ts +0 -20
  119. package/dist/utils/dry-run.js +0 -67
  120. package/dist/utils/from-file.d.ts +0 -9
  121. package/dist/utils/from-file.js +0 -72
  122. package/dist/utils/redact.d.ts +0 -14
  123. package/dist/utils/redact.js +0 -48
  124. package/dist/utils/ui.d.ts +0 -14
  125. package/dist/utils/ui.js +0 -59
  126. package/scripts/.gitkeep +0 -0
  127. package/scripts/README-gurulu-agentic-install.md +0 -114
  128. package/scripts/README-gurulu-scan.md +0 -98
  129. package/scripts/audit-cli-scopes.mjs +0 -204
  130. package/scripts/backfill-tenant-id.mjs +0 -172
  131. package/scripts/backfill-tenant-links.ts +0 -252
  132. package/scripts/backup-clickhouse.sh +0 -27
  133. package/scripts/backup-postgres.sh +0 -19
  134. package/scripts/bootstrap-runtime-schema.mjs +0 -87
  135. package/scripts/bootstrap-stripe.mjs +0 -158
  136. package/scripts/gurulu-agentic-install.lib.cjs +0 -762
  137. package/scripts/gurulu-agentic-install.mjs +0 -623
  138. package/scripts/gurulu-scan.lib.cjs +0 -1509
  139. package/scripts/gurulu-scan.mjs +0 -91
  140. package/scripts/gurulu-verify-install.lib.cjs +0 -334
  141. package/scripts/gurulu-verify-install.mjs +0 -59
  142. package/scripts/init-ssl.sh +0 -26
  143. package/scripts/migrate-flow-graph-enums.sh +0 -86
  144. package/scripts/monitor-disk.sh +0 -24
  145. package/scripts/patches/astro.patch.cjs +0 -74
  146. package/scripts/patches/auto-instrument/ast-helper.cjs +0 -480
  147. package/scripts/patches/auto-instrument/astro.cjs +0 -273
  148. package/scripts/patches/auto-instrument/express.cjs +0 -383
  149. package/scripts/patches/auto-instrument/fastify.cjs +0 -262
  150. package/scripts/patches/auto-instrument/hono.cjs +0 -392
  151. package/scripts/patches/auto-instrument/index.cjs +0 -80
  152. package/scripts/patches/auto-instrument/nestjs.cjs +0 -286
  153. package/scripts/patches/auto-instrument/nextjs-app-router.cjs +0 -345
  154. package/scripts/patches/auto-instrument/nextjs-pages.cjs +0 -361
  155. package/scripts/patches/auto-instrument/remix.cjs +0 -168
  156. package/scripts/patches/auto-instrument/sdk-helper-map.cjs +0 -241
  157. package/scripts/patches/auto-instrument/singleton-helper.cjs +0 -193
  158. package/scripts/patches/auto-instrument/sveltekit.cjs +0 -161
  159. package/scripts/patches/auto-instrument/vite-react.cjs +0 -37
  160. package/scripts/patches/auto-instrument/vue.cjs +0 -196
  161. package/scripts/patches/express.patch.cjs +0 -99
  162. package/scripts/patches/fastify.patch.cjs +0 -108
  163. package/scripts/patches/index.cjs +0 -300
  164. package/scripts/patches/nestjs.patch.cjs +0 -112
  165. package/scripts/patches/nextjs-app-router.patch.cjs +0 -97
  166. package/scripts/patches/nextjs-pages.patch.cjs +0 -97
  167. package/scripts/patches/remix.patch.cjs +0 -75
  168. package/scripts/patches/sveltekit.patch.cjs +0 -72
  169. package/scripts/patches/vite-react.patch.cjs +0 -73
  170. package/scripts/patches/vue.patch.cjs +0 -82
  171. package/scripts/renew-ssl.sh +0 -14
  172. package/scripts/resolve-migration.sh +0 -23
  173. package/scripts/seed-cli-dev-keys.mjs +0 -130
  174. package/scripts/seed-test-data.mjs +0 -391
  175. package/scripts/spike-browserless.ts +0 -65
  176. package/scripts/tenant-pivot-consistency-check.mjs +0 -205
  177. package/scripts/tenant-pivot-phase-3-cleanup.lib.cjs +0 -258
  178. package/scripts/tenant-pivot-phase-3-cleanup.mjs +0 -98
  179. package/scripts/test-identity-resolution.ts +0 -804
  180. package/scripts/validate-gurulu-schemas.mjs +0 -79
@@ -1,203 +0,0 @@
1
- "use strict";
2
- /**
3
- * `gurulu funnels list|show|create|update|delete` — manage conversion funnels.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.funnelsCommand = funnelsCommand;
7
- const api_client_1 = require("../api-client");
8
- const ui_1 = require("../utils/ui");
9
- const confirm_1 = require("../utils/confirm");
10
- const dry_run_1 = require("../utils/dry-run");
11
- const from_file_1 = require("../utils/from-file");
12
- async function funnelsCommand(args) {
13
- const action = args.action || 'list';
14
- switch (action) {
15
- case 'list':
16
- return listCmd(args);
17
- case 'show':
18
- return showCmd(args);
19
- case 'create':
20
- return createCmd(args);
21
- case 'update':
22
- return updateCmd(args);
23
- case 'delete':
24
- return deleteCmd(args);
25
- default:
26
- (0, ui_1.error)(`Unknown funnels action: ${action}`);
27
- (0, ui_1.info)('Usage: gurulu funnels [list|show|create|update|delete]');
28
- process.exit(1);
29
- }
30
- }
31
- function parseSteps(stepsStr) {
32
- return stepsStr
33
- .split(',')
34
- .map((s) => s.trim())
35
- .filter(Boolean)
36
- .map((event_name) => ({ event_name }));
37
- }
38
- async function listCmd(args) {
39
- const qs = args.site ? `?siteId=${encodeURIComponent(args.site)}` : '';
40
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/funnels${qs}`, {
41
- profile: args.profile,
42
- });
43
- const funnels = body.funnels || [];
44
- if (args.json) {
45
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
46
- return;
47
- }
48
- if (funnels.length === 0) {
49
- (0, ui_1.info)('No funnels yet.');
50
- return;
51
- }
52
- process.stdout.write(['NAME', 'ID', 'STEPS', 'STATUS', 'UPDATED'].join('\t') + '\n');
53
- for (const f of funnels) {
54
- const stepCount = Array.isArray(f.steps) ? f.steps.length : 0;
55
- process.stdout.write([
56
- f.name,
57
- f.id,
58
- String(stepCount),
59
- f.status,
60
- String(f.updatedAt || '-').slice(0, 19),
61
- ].join('\t') + '\n');
62
- }
63
- }
64
- async function showCmd(args) {
65
- if (!args.target) {
66
- (0, ui_1.error)('Usage: gurulu funnels show <id>');
67
- process.exit(1);
68
- }
69
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/funnels/${encodeURIComponent(args.target)}`, { profile: args.profile });
70
- if (args.json) {
71
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
72
- return;
73
- }
74
- const f = body.funnel;
75
- const steps = Array.isArray(f.steps) ? f.steps : [];
76
- process.stdout.write(`Name: ${f.name}\n`);
77
- process.stdout.write(`ID: ${f.id}\n`);
78
- process.stdout.write(`Site: ${f.siteId}\n`);
79
- process.stdout.write(`Description: ${f.description || '-'}\n`);
80
- process.stdout.write(`Status: ${f.status}\n`);
81
- process.stdout.write(`Steps (${steps.length}):\n`);
82
- for (let i = 0; i < steps.length; i++) {
83
- const s = steps[i];
84
- const label = s.label || s.event_name || s.eventName || '-';
85
- process.stdout.write(` ${i + 1}. ${label}\n`);
86
- }
87
- if (f.cachedMetrics) {
88
- const m = f.cachedMetrics;
89
- process.stdout.write(`Overall rate: ${m.overallRate ?? '-'}\n`);
90
- process.stdout.write(`Computed at: ${m.computedAt || f.lastComputedAt || '-'}\n`);
91
- }
92
- process.stdout.write(`Updated: ${f.updatedAt}\n`);
93
- }
94
- async function createCmd(args) {
95
- let payload = {};
96
- if (args.fromFile) {
97
- payload = (0, from_file_1.loadFromFile)(args.fromFile);
98
- }
99
- if (args.name)
100
- payload.name = args.name;
101
- if (args.site)
102
- payload.siteId = args.site;
103
- if (args.steps)
104
- payload.steps = parseSteps(args.steps);
105
- if (!payload.name) {
106
- (0, ui_1.error)('name is required (pass --name or --from-file)');
107
- process.exit(1);
108
- }
109
- if (!payload.siteId) {
110
- (0, ui_1.error)('site is required (pass --site)');
111
- process.exit(1);
112
- }
113
- if (!Array.isArray(payload.steps) || payload.steps.length < 2) {
114
- (0, ui_1.error)('At least 2 steps are required (pass --steps as comma-separated event names)');
115
- process.exit(1);
116
- }
117
- const qs = args.dryRun ? '?dryRun=1' : '';
118
- if (args.dryRun) {
119
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/funnels${qs}`, {
120
- profile: args.profile,
121
- method: 'POST',
122
- json: payload,
123
- });
124
- (0, dry_run_1.printDryRun)(body, args.json);
125
- return;
126
- }
127
- const ok = await (0, confirm_1.promptConfirm)(`Create funnel '${payload.name}'?`, {
128
- yes: args.yes,
129
- defaultYes: true,
130
- });
131
- if (!ok) {
132
- (0, ui_1.info)('Aborted.');
133
- return;
134
- }
135
- const body = await (0, api_client_1.cliApiJson)('/api/cli/funnels', {
136
- profile: args.profile,
137
- method: 'POST',
138
- json: payload,
139
- });
140
- if (args.json) {
141
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
142
- return;
143
- }
144
- (0, ui_1.success)(`Created funnel ${body.funnel?.id ?? ''}`);
145
- }
146
- async function updateCmd(args) {
147
- if (!args.target) {
148
- (0, ui_1.error)('Usage: gurulu funnels update <id> [--name ...] [--steps ...]');
149
- process.exit(1);
150
- }
151
- let payload = {};
152
- if (args.fromFile) {
153
- payload = (0, from_file_1.loadFromFile)(args.fromFile);
154
- }
155
- if (args.name)
156
- payload.name = args.name;
157
- if (args.description !== undefined)
158
- payload.description = args.description;
159
- if (args.steps)
160
- payload.steps = parseSteps(args.steps);
161
- const qs = args.dryRun ? '?dryRun=1' : '';
162
- if (args.dryRun) {
163
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/funnels/${encodeURIComponent(args.target)}${qs}`, { profile: args.profile, method: 'PUT', json: payload });
164
- (0, dry_run_1.printDryRun)(body, args.json);
165
- return;
166
- }
167
- const ok = await (0, confirm_1.promptConfirm)(`Update funnel '${args.target}'?`, {
168
- yes: args.yes,
169
- defaultYes: true,
170
- });
171
- if (!ok) {
172
- (0, ui_1.info)('Aborted.');
173
- return;
174
- }
175
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/funnels/${encodeURIComponent(args.target)}`, { profile: args.profile, method: 'PUT', json: payload });
176
- if (args.json) {
177
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
178
- return;
179
- }
180
- (0, ui_1.success)(`Updated funnel ${args.target}`);
181
- }
182
- async function deleteCmd(args) {
183
- if (!args.target) {
184
- (0, ui_1.error)('Usage: gurulu funnels delete <id>');
185
- process.exit(1);
186
- }
187
- const qs = args.dryRun ? '?dryRun=1' : '';
188
- if (args.dryRun) {
189
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/funnels/${encodeURIComponent(args.target)}${qs}`, { profile: args.profile, method: 'DELETE' });
190
- (0, dry_run_1.printDryRun)(body, args.json);
191
- return;
192
- }
193
- const ok = await (0, confirm_1.promptConfirm)(`About to delete funnel '${args.target}'. Continue?`, { yes: args.yes, defaultYes: false });
194
- if (!ok) {
195
- (0, ui_1.info)('Aborted.');
196
- return;
197
- }
198
- await (0, api_client_1.cliApiJson)(`/api/cli/funnels/${encodeURIComponent(args.target)}`, {
199
- profile: args.profile,
200
- method: 'DELETE',
201
- });
202
- (0, ui_1.success)(`Deleted funnel ${args.target}`);
203
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * `gurulu goals list|show|create|update|delete` — manage conversion goals.
3
- */
4
- export interface GoalsArgs {
5
- action?: string;
6
- target?: string;
7
- json?: boolean;
8
- profile?: string;
9
- fromFile?: string;
10
- site?: string;
11
- name?: string;
12
- description?: string;
13
- event?: string;
14
- propertiesFilter?: string;
15
- yes?: boolean;
16
- dryRun?: boolean;
17
- }
18
- export declare function goalsCommand(args: GoalsArgs): Promise<void>;
@@ -1,214 +0,0 @@
1
- "use strict";
2
- /**
3
- * `gurulu goals list|show|create|update|delete` — manage conversion goals.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.goalsCommand = goalsCommand;
7
- const api_client_1 = require("../api-client");
8
- const ui_1 = require("../utils/ui");
9
- const confirm_1 = require("../utils/confirm");
10
- const dry_run_1 = require("../utils/dry-run");
11
- const from_file_1 = require("../utils/from-file");
12
- async function goalsCommand(args) {
13
- const action = args.action || 'list';
14
- switch (action) {
15
- case 'list':
16
- return listCmd(args);
17
- case 'show':
18
- return showCmd(args);
19
- case 'create':
20
- return createCmd(args);
21
- case 'update':
22
- return updateCmd(args);
23
- case 'delete':
24
- return deleteCmd(args);
25
- default:
26
- (0, ui_1.error)(`Unknown goals action: ${action}`);
27
- (0, ui_1.info)('Usage: gurulu goals [list|show|create|update|delete]');
28
- process.exit(1);
29
- }
30
- }
31
- async function listCmd(args) {
32
- const qs = args.site ? `?siteId=${encodeURIComponent(args.site)}` : '';
33
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/goals${qs}`, {
34
- profile: args.profile,
35
- });
36
- const goals = body.goals || [];
37
- if (args.json) {
38
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
39
- return;
40
- }
41
- if (goals.length === 0) {
42
- (0, ui_1.info)('No goals yet.');
43
- return;
44
- }
45
- process.stdout.write(['NAME', 'ID', 'EVENT', 'STATUS', 'CONVERSIONS', 'UPDATED'].join('\t') + '\n');
46
- for (const g of goals) {
47
- const eventName = g.eventPattern?.event_name || '-';
48
- process.stdout.write([
49
- g.name,
50
- g.id,
51
- String(eventName),
52
- g.status,
53
- String(g.totalConversions ?? 0),
54
- String(g.updatedAt || '-').slice(0, 19),
55
- ].join('\t') + '\n');
56
- }
57
- }
58
- async function showCmd(args) {
59
- if (!args.target) {
60
- (0, ui_1.error)('Usage: gurulu goals show <id>');
61
- process.exit(1);
62
- }
63
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/goals/${encodeURIComponent(args.target)}`, { profile: args.profile });
64
- if (args.json) {
65
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
66
- return;
67
- }
68
- const g = body.goal;
69
- const eventName = g.eventPattern?.event_name || '-';
70
- const propsFilter = g.eventPattern?.properties_filter || null;
71
- process.stdout.write(`Name: ${g.name}\n`);
72
- process.stdout.write(`ID: ${g.id}\n`);
73
- process.stdout.write(`Site: ${g.siteId}\n`);
74
- process.stdout.write(`Description: ${g.description || '-'}\n`);
75
- process.stdout.write(`Event: ${eventName}\n`);
76
- process.stdout.write(`Properties filter: ${propsFilter ? JSON.stringify(propsFilter) : '-'}\n`);
77
- process.stdout.write(`Status: ${g.status}\n`);
78
- process.stdout.write(`Conversions: ${g.totalConversions}\n`);
79
- process.stdout.write(`Last converted: ${g.lastConvertedAt || '-'}\n`);
80
- process.stdout.write(`Updated: ${g.updatedAt}\n`);
81
- }
82
- async function createCmd(args) {
83
- let payload = {};
84
- if (args.fromFile) {
85
- payload = (0, from_file_1.loadFromFile)(args.fromFile);
86
- }
87
- if (args.name)
88
- payload.name = args.name;
89
- if (args.site)
90
- payload.siteId = args.site;
91
- // Build eventPattern from --event and --properties-filter
92
- const eventPattern = payload.eventPattern || {};
93
- if (args.event)
94
- eventPattern.event_name = args.event;
95
- if (args.propertiesFilter) {
96
- try {
97
- eventPattern.properties_filter = JSON.parse(args.propertiesFilter);
98
- }
99
- catch {
100
- (0, ui_1.error)('--properties-filter must be valid JSON');
101
- process.exit(1);
102
- }
103
- }
104
- if (Object.keys(eventPattern).length > 0)
105
- payload.eventPattern = eventPattern;
106
- if (!payload.name) {
107
- (0, ui_1.error)('name is required (pass --name or --from-file)');
108
- process.exit(1);
109
- }
110
- if (!payload.siteId) {
111
- (0, ui_1.error)('site is required (pass --site)');
112
- process.exit(1);
113
- }
114
- const qs = args.dryRun ? '?dryRun=1' : '';
115
- if (args.dryRun) {
116
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/goals${qs}`, {
117
- profile: args.profile,
118
- method: 'POST',
119
- json: payload,
120
- });
121
- (0, dry_run_1.printDryRun)(body, args.json);
122
- return;
123
- }
124
- const ok = await (0, confirm_1.promptConfirm)(`Create goal '${payload.name}'?`, {
125
- yes: args.yes,
126
- defaultYes: true,
127
- });
128
- if (!ok) {
129
- (0, ui_1.info)('Aborted.');
130
- return;
131
- }
132
- const body = await (0, api_client_1.cliApiJson)('/api/cli/goals', {
133
- profile: args.profile,
134
- method: 'POST',
135
- json: payload,
136
- });
137
- if (args.json) {
138
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
139
- return;
140
- }
141
- (0, ui_1.success)(`Created goal ${body.goal?.id ?? ''}`);
142
- }
143
- async function updateCmd(args) {
144
- if (!args.target) {
145
- (0, ui_1.error)('Usage: gurulu goals update <id> [--name ...] [--event ...]');
146
- process.exit(1);
147
- }
148
- let payload = {};
149
- if (args.fromFile) {
150
- payload = (0, from_file_1.loadFromFile)(args.fromFile);
151
- }
152
- if (args.name)
153
- payload.name = args.name;
154
- if (args.description !== undefined)
155
- payload.description = args.description;
156
- // Build eventPattern if --event or --properties-filter provided
157
- if (args.event || args.propertiesFilter) {
158
- const eventPattern = payload.eventPattern || {};
159
- if (args.event)
160
- eventPattern.event_name = args.event;
161
- if (args.propertiesFilter) {
162
- try {
163
- eventPattern.properties_filter = JSON.parse(args.propertiesFilter);
164
- }
165
- catch {
166
- (0, ui_1.error)('--properties-filter must be valid JSON');
167
- process.exit(1);
168
- }
169
- }
170
- payload.eventPattern = eventPattern;
171
- }
172
- const qs = args.dryRun ? '?dryRun=1' : '';
173
- if (args.dryRun) {
174
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/goals/${encodeURIComponent(args.target)}${qs}`, { profile: args.profile, method: 'PUT', json: payload });
175
- (0, dry_run_1.printDryRun)(body, args.json);
176
- return;
177
- }
178
- const ok = await (0, confirm_1.promptConfirm)(`Update goal '${args.target}'?`, {
179
- yes: args.yes,
180
- defaultYes: true,
181
- });
182
- if (!ok) {
183
- (0, ui_1.info)('Aborted.');
184
- return;
185
- }
186
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/goals/${encodeURIComponent(args.target)}`, { profile: args.profile, method: 'PUT', json: payload });
187
- if (args.json) {
188
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
189
- return;
190
- }
191
- (0, ui_1.success)(`Updated goal ${args.target}`);
192
- }
193
- async function deleteCmd(args) {
194
- if (!args.target) {
195
- (0, ui_1.error)('Usage: gurulu goals delete <id>');
196
- process.exit(1);
197
- }
198
- const qs = args.dryRun ? '?dryRun=1' : '';
199
- if (args.dryRun) {
200
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/goals/${encodeURIComponent(args.target)}${qs}`, { profile: args.profile, method: 'DELETE' });
201
- (0, dry_run_1.printDryRun)(body, args.json);
202
- return;
203
- }
204
- const ok = await (0, confirm_1.promptConfirm)(`About to delete goal '${args.target}'. Continue?`, { yes: args.yes, defaultYes: false });
205
- if (!ok) {
206
- (0, ui_1.info)('Aborted.');
207
- return;
208
- }
209
- await (0, api_client_1.cliApiJson)(`/api/cli/goals/${encodeURIComponent(args.target)}`, {
210
- profile: args.profile,
211
- method: 'DELETE',
212
- });
213
- (0, ui_1.success)(`Deleted goal ${args.target}`);
214
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * Sprint J-Heat HM10 — `gurulu heatmap ...` subcommands.
3
- *
4
- * Read-only surface backed by `/api/cli/heatmap/list` and
5
- * `/api/cli/heatmap/get`. Lets agents and operators inspect heatmap
6
- * snapshots without opening the dashboard.
7
- *
8
- * gurulu heatmap list --site <id|name> [--range 7d|30d] [--json]
9
- * gurulu heatmap export --site <id|name> --page <pageUrl>
10
- * [--type click|scroll]
11
- * [--range 7d|30d]
12
- * [--viewport mobile|tablet|desktop]
13
- * [--page-id <hash>]
14
- * [--json]
15
- */
16
- export interface HeatmapArgs {
17
- action?: string;
18
- site?: string;
19
- page?: string;
20
- pageId?: string;
21
- type?: string;
22
- range?: string;
23
- viewport?: string;
24
- json?: boolean;
25
- profile?: string;
26
- }
27
- export declare function heatmapCommand(args: HeatmapArgs): Promise<void>;
@@ -1,112 +0,0 @@
1
- "use strict";
2
- /**
3
- * Sprint J-Heat HM10 — `gurulu heatmap ...` subcommands.
4
- *
5
- * Read-only surface backed by `/api/cli/heatmap/list` and
6
- * `/api/cli/heatmap/get`. Lets agents and operators inspect heatmap
7
- * snapshots without opening the dashboard.
8
- *
9
- * gurulu heatmap list --site <id|name> [--range 7d|30d] [--json]
10
- * gurulu heatmap export --site <id|name> --page <pageUrl>
11
- * [--type click|scroll]
12
- * [--range 7d|30d]
13
- * [--viewport mobile|tablet|desktop]
14
- * [--page-id <hash>]
15
- * [--json]
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.heatmapCommand = heatmapCommand;
19
- const api_client_1 = require("../api-client");
20
- const ui_1 = require("../utils/ui");
21
- async function resolveSiteId(target, profile) {
22
- if (!target)
23
- throw new Error('--site is required');
24
- const body = await (0, api_client_1.cliApiJson)('/api/cli/sites', { profile });
25
- const sites = body.sites || [];
26
- const byId = sites.find((s) => s.id === target);
27
- if (byId)
28
- return byId.id;
29
- const byName = sites.find((s) => s.name === target);
30
- if (byName)
31
- return byName.id;
32
- const byDomain = sites.find((s) => s.domain === target);
33
- if (byDomain)
34
- return byDomain.id;
35
- const prefix = sites.find((s) => s.id.startsWith(target));
36
- if (prefix)
37
- return prefix.id;
38
- throw new Error(`Site '${target}' not found.`);
39
- }
40
- async function heatmapCommand(args) {
41
- const action = args.action || 'list';
42
- switch (action) {
43
- case 'list':
44
- return listCmd(args);
45
- case 'export':
46
- return exportCmd(args);
47
- default:
48
- (0, ui_1.error)(`Unknown heatmap action: ${action}`);
49
- (0, ui_1.info)('Usage: gurulu heatmap [list|export]');
50
- process.exit(1);
51
- }
52
- }
53
- async function listCmd(args) {
54
- if (!args.site) {
55
- (0, ui_1.error)('--site is required.');
56
- process.exit(1);
57
- }
58
- const siteId = await resolveSiteId(args.site, args.profile);
59
- const range = args.range === '30d' ? '30d' : '7d';
60
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/heatmap/list?siteId=${encodeURIComponent(siteId)}&range=${range}`, {
61
- profile: args.profile,
62
- });
63
- if (args.json) {
64
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
65
- return;
66
- }
67
- const pages = body.pages || [];
68
- if (pages.length === 0) {
69
- (0, ui_1.info)(`No heatmap data for site '${body.siteName}' (range=${range}).`);
70
- return;
71
- }
72
- process.stdout.write(['CLICKS', 'VISITORS', 'M/T/D', 'LAST SEEN', 'PAGE URL'].join('\t') + '\n');
73
- for (const p of pages) {
74
- const mtd = `${p.viewportBuckets.mobile}/${p.viewportBuckets.tablet}/${p.viewportBuckets.desktop}`;
75
- process.stdout.write([
76
- String(p.clickCount),
77
- String(p.visitors),
78
- mtd,
79
- String(p.lastSeen).slice(0, 19),
80
- p.pageUrl,
81
- ].join('\t') + '\n');
82
- }
83
- }
84
- async function exportCmd(args) {
85
- if (!args.site) {
86
- (0, ui_1.error)('--site is required.');
87
- process.exit(1);
88
- }
89
- if (!args.page) {
90
- (0, ui_1.error)('--page <pageUrl> is required.');
91
- process.exit(1);
92
- }
93
- const siteId = await resolveSiteId(args.site, args.profile);
94
- const range = args.range === '30d' ? '30d' : '7d';
95
- const type = args.type === 'scroll' ? 'scroll' : 'click';
96
- const qp = new URLSearchParams({
97
- siteId,
98
- pageUrl: args.page,
99
- range,
100
- type,
101
- });
102
- if (args.pageId)
103
- qp.set('pageId', args.pageId);
104
- if (args.viewport)
105
- qp.set('viewportBucket', args.viewport);
106
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/heatmap/get?${qp.toString()}`, {
107
- profile: args.profile,
108
- });
109
- // Export commands always emit machine-readable output by default; the
110
- // `--json` flag is accepted for symmetry with the rest of the CLI.
111
- process.stdout.write(JSON.stringify(body, null, args.json ? 2 : 0) + '\n');
112
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Phase 19.5 W2 B8 — `gurulu identity decay|transfers|cdc-sources`.
3
- *
4
- * Sprint E SE-D — `gurulu identity identify|alias|merge` write surface
5
- * (mirrors MCP `gurulu.identity.identify` / `.alias` / `.merge`).
6
- */
7
- export interface IdentityArgs {
8
- action?: string;
9
- sub?: string;
10
- direction?: string;
11
- status?: string;
12
- limit?: number;
13
- site?: string;
14
- userId?: string;
15
- email?: string;
16
- phone?: string;
17
- traits?: string;
18
- previousUserId?: string;
19
- newUserId?: string;
20
- canonicalId?: string;
21
- duplicateId?: string;
22
- yes?: boolean;
23
- json?: boolean;
24
- profile?: string;
25
- file?: string;
26
- format?: string;
27
- resumeFrom?: number;
28
- }
29
- export declare function identityCommand(args: IdentityArgs): Promise<void>;