@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,20 +0,0 @@
1
- /**
2
- * Phase 18.5 W2 — `gurulu login`.
3
- *
4
- * Rewritten from the Phase 8 legacy command. Authenticates against
5
- * `POST /api/cli/verify-key`, persists the credentials into a profile,
6
- * and prints a short summary fetched from `GET /api/cli/me`.
7
- *
8
- * The old login command lived in this same file, but nothing outside this
9
- * package imports it directly — `src/index.ts` is the only caller.
10
- */
11
- export interface LoginArgs {
12
- profile?: string;
13
- email?: string;
14
- secretKey?: string;
15
- noInteractive?: boolean;
16
- useKeychain?: boolean;
17
- apiBase?: string;
18
- apiKey?: string;
19
- }
20
- export declare function loginCommand(args: LoginArgs): Promise<void>;
@@ -1,170 +0,0 @@
1
- "use strict";
2
- /**
3
- * Phase 18.5 W2 — `gurulu login`.
4
- *
5
- * Rewritten from the Phase 8 legacy command. Authenticates against
6
- * `POST /api/cli/verify-key`, persists the credentials into a profile,
7
- * and prints a short summary fetched from `GET /api/cli/me`.
8
- *
9
- * The old login command lived in this same file, but nothing outside this
10
- * package imports it directly — `src/index.ts` is the only caller.
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.loginCommand = loginCommand;
14
- const config_1 = require("../config");
15
- const api_client_1 = require("../api-client");
16
- const ui_1 = require("../utils/ui");
17
- function parseKeyFormat(key) {
18
- if (!key)
19
- return { valid: false, type: null };
20
- const m = key.match(/^(gsk|gpk)_(live|test)_([A-Za-z0-9]+)$/);
21
- if (!m)
22
- return { valid: false, type: null };
23
- if (m[3].length < 24)
24
- return { valid: false, type: null };
25
- return { valid: true, type: m[1] === 'gsk' ? 'sk' : 'pk' };
26
- }
27
- async function promptHidden(question) {
28
- // Best-effort secret input. Does not echo while typing when stdin is a TTY.
29
- return new Promise((resolve) => {
30
- const stdin = process.stdin;
31
- const stdout = process.stdout;
32
- stdout.write(question);
33
- const isTTY = !!stdin.isTTY;
34
- if (!isTTY) {
35
- // Non-TTY: fall back to visible readline.
36
- const readline = require('readline');
37
- const rl = readline.createInterface({ input: stdin, output: stdout });
38
- rl.question('', (answer) => {
39
- rl.close();
40
- resolve(answer.trim());
41
- });
42
- return;
43
- }
44
- stdin.setRawMode(true);
45
- stdin.resume();
46
- stdin.setEncoding('utf8');
47
- let buf = '';
48
- const onData = (ch) => {
49
- for (const c of ch) {
50
- if (c === '\n' || c === '\r' || c === '\u0004') {
51
- stdin.setRawMode(false);
52
- stdin.pause();
53
- stdin.removeListener('data', onData);
54
- stdout.write('\n');
55
- resolve(buf.trim());
56
- return;
57
- }
58
- if (c === '\u0003') {
59
- // Ctrl+C
60
- stdin.setRawMode(false);
61
- stdout.write('\n');
62
- process.exit(130);
63
- }
64
- if (c === '\u007f' || c === '\b') {
65
- if (buf.length > 0) {
66
- buf = buf.slice(0, -1);
67
- stdout.write('\b \b');
68
- }
69
- }
70
- else {
71
- buf += c;
72
- stdout.write('*');
73
- }
74
- }
75
- };
76
- stdin.on('data', onData);
77
- });
78
- }
79
- async function loginCommand(args) {
80
- const profileName = args.profile || 'personal';
81
- let email = args.email || process.env.GURULU_EMAIL;
82
- let secretKey = args.secretKey || args.apiKey || process.env.GURULU_SECRET_KEY;
83
- if (!email) {
84
- if (args.noInteractive) {
85
- (0, ui_1.error)('Email required. Use --email or set GURULU_EMAIL.');
86
- process.exit(1);
87
- }
88
- email = await (0, ui_1.prompt)('? Email: ');
89
- }
90
- if (!secretKey) {
91
- if (args.noInteractive) {
92
- (0, ui_1.error)('Secret key required. Use --secret-key or set GURULU_SECRET_KEY.');
93
- process.exit(1);
94
- }
95
- secretKey = await promptHidden('? Secret key (gsk_...): ');
96
- }
97
- const parsed = parseKeyFormat(secretKey || '');
98
- if (!parsed.valid || parsed.type !== 'sk') {
99
- (0, ui_1.error)('Invalid key format. Expected gsk_live_... or gsk_test_...');
100
- process.exit(1);
101
- }
102
- const apiBase = args.apiBase || (0, config_1.defaultApiBase)();
103
- (0, ui_1.info)('[•] Verifying credentials...');
104
- let verify;
105
- try {
106
- const res = await (0, api_client_1.cliApi)('/api/cli/verify-key', {
107
- method: 'POST',
108
- skipAuth: true,
109
- body: JSON.stringify({ email, secret_key: secretKey }),
110
- preloadedProfile: {
111
- name: profileName,
112
- email: email,
113
- secret_key: secretKey,
114
- api_base: apiBase,
115
- source: 'env',
116
- },
117
- });
118
- if (res.status === 401) {
119
- (0, ui_1.error)('Invalid email or key.');
120
- process.exit(1);
121
- }
122
- if (res.status === 429) {
123
- (0, ui_1.error)('Too many attempts. Try again in 5 minutes.');
124
- process.exit(1);
125
- }
126
- verify = await res.json();
127
- if (!res.ok || !verify?.ok) {
128
- (0, ui_1.error)(`Login failed: ${verify?.message || 'unknown error'}`);
129
- process.exit(1);
130
- }
131
- }
132
- catch (err) {
133
- (0, ui_1.error)(`Login failed: ${err.message}`);
134
- process.exit(1);
135
- }
136
- // Persist to profile.
137
- const { storedInKeychain } = await (0, config_1.saveProfile)(profileName, { email: email, secret_key: secretKey, api_base: apiBase }, { useKeychain: args.useKeychain ?? (0, config_1.isKeychainAvailable)() });
138
- // Summary from /me (non-fatal if it fails).
139
- let me = null;
140
- try {
141
- me = await (0, api_client_1.cliApiJson)('/api/cli/me', {
142
- preloadedProfile: {
143
- name: profileName,
144
- email: email,
145
- secret_key: secretKey,
146
- api_base: apiBase,
147
- source: 'file',
148
- },
149
- });
150
- }
151
- catch {
152
- /* ignore */
153
- }
154
- const tenantName = verify.tenant?.name || '—';
155
- const plan = verify.tenant?.plan || 'free';
156
- const tenantId = verify.tenant?.id || '';
157
- (0, ui_1.success)(`Authenticated as ${email} · ${tenantName} (${plan} plan)`);
158
- if (tenantId)
159
- (0, ui_1.info)(` Tenant: ${tenantId}`);
160
- if (me) {
161
- const sites = Array.isArray(me.sites) ? me.sites.length : 0;
162
- const keys = Array.isArray(me.apiKeys) ? me.apiKeys.length : 0;
163
- const live = (me.apiKeys || []).filter((k) => k.mode === 'live').length;
164
- const test = (me.apiKeys || []).filter((k) => k.mode === 'test').length;
165
- (0, ui_1.info)(` Sites: ${sites} active`);
166
- (0, ui_1.info)(` API keys: ${keys} (${live} live, ${test} test)`);
167
- }
168
- (0, ui_1.info)('');
169
- (0, ui_1.info)(`Config saved to ${(0, ui_1.dim)(storedInKeychain ? `~/.gurulu/config.json + macOS Keychain` : `~/.gurulu/config.json`)}`);
170
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * Phase 18.5 W2 — `gurulu logout`. Removes a stored profile (or all with
3
- * --all). Non-interactive unless --yes is passed.
4
- */
5
- export interface LogoutArgs {
6
- profile?: string;
7
- all?: boolean;
8
- yes?: boolean;
9
- }
10
- export declare function logoutCommand(args: LogoutArgs): Promise<void>;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /**
3
- * Phase 18.5 W2 — `gurulu logout`. Removes a stored profile (or all with
4
- * --all). Non-interactive unless --yes is passed.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.logoutCommand = logoutCommand;
8
- const config_1 = require("../config");
9
- const ui_1 = require("../utils/ui");
10
- async function logoutCommand(args) {
11
- if (args.all) {
12
- if (!args.yes) {
13
- const answer = await (0, ui_1.prompt)('? Remove ALL stored profiles? [y/N] ');
14
- if (!answer.toLowerCase().startsWith('y')) {
15
- (0, ui_1.info)('Aborted.');
16
- return;
17
- }
18
- }
19
- const removed = await (0, config_1.deleteAllProfiles)();
20
- (0, ui_1.success)(`Removed ${removed.length} profile(s).`);
21
- return;
22
- }
23
- const name = args.profile || 'personal';
24
- const stored = (0, config_1.getStoredProfile)(name);
25
- if (!stored) {
26
- (0, ui_1.error)(`Profile '${name}' not found.`);
27
- process.exit(1);
28
- }
29
- if (!args.yes) {
30
- const answer = await (0, ui_1.prompt)(`? Remove profile '${name}' (${stored.email})? [y/N] `);
31
- if (!answer.toLowerCase().startsWith('y')) {
32
- (0, ui_1.info)('Aborted.');
33
- return;
34
- }
35
- }
36
- const ok = await (0, config_1.deleteProfile)(name);
37
- if (ok)
38
- (0, ui_1.success)(`Profile '${name}' removed.`);
39
- else
40
- (0, ui_1.error)(`Failed to remove profile '${name}'.`);
41
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Phase 19.5 W2 B9 — `gurulu playground list`.
3
- */
4
- export interface PlaygroundArgs {
5
- action?: string;
6
- status?: string;
7
- limit?: number;
8
- json?: boolean;
9
- profile?: string;
10
- }
11
- export declare function playgroundCommand(args: PlaygroundArgs): Promise<void>;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- /**
3
- * Phase 19.5 W2 B9 — `gurulu playground list`.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.playgroundCommand = playgroundCommand;
7
- const api_client_1 = require("../api-client");
8
- const ui_1 = require("../utils/ui");
9
- async function playgroundCommand(args) {
10
- const action = args.action || 'list';
11
- switch (action) {
12
- case 'list':
13
- return listCmd(args);
14
- default:
15
- (0, ui_1.error)(`Unknown playground action: ${action}`);
16
- (0, ui_1.info)('Usage: gurulu playground [list]');
17
- process.exit(1);
18
- }
19
- }
20
- async function listCmd(args) {
21
- const qs = new URLSearchParams();
22
- if (args.status)
23
- qs.set('status', args.status);
24
- if (args.limit)
25
- qs.set('limit', String(args.limit));
26
- const path = `/api/cli/playground/sessions${qs.toString() ? `?${qs.toString()}` : ''}`;
27
- const body = await (0, api_client_1.cliApiJson)(path, { profile: args.profile });
28
- if (args.json) {
29
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
30
- return;
31
- }
32
- const rows = body.sessions || [];
33
- if (rows.length === 0) {
34
- (0, ui_1.info)('No playground sessions.');
35
- return;
36
- }
37
- process.stdout.write(['ID', 'SITE', 'STATUS', 'STARTED', 'VERIFICATIONS'].join('\t') + '\n');
38
- for (const s of rows) {
39
- process.stdout.write([
40
- s.id,
41
- s.siteName || s.siteId,
42
- s.status,
43
- String(s.startedAt),
44
- String(s.verificationsCount ?? 0),
45
- ].join('\t') + '\n');
46
- }
47
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Sprint E SE-B — `gurulu releases list`.
3
- *
4
- * Mirror of MCP `gurulu.releases.list`. Returns recent releases with
5
- * crash-free session %, adoption, and regression deltas.
6
- */
7
- export interface ReleasesArgs {
8
- action?: string;
9
- site?: string;
10
- range?: string;
11
- environment?: string;
12
- limit?: number;
13
- format?: string;
14
- json?: boolean;
15
- profile?: string;
16
- }
17
- export declare function releasesCommand(args: ReleasesArgs): Promise<void>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- /**
3
- * Sprint E SE-B — `gurulu releases list`.
4
- *
5
- * Mirror of MCP `gurulu.releases.list`. Returns recent releases with
6
- * crash-free session %, adoption, and regression deltas.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.releasesCommand = releasesCommand;
10
- const api_client_1 = require("../api-client");
11
- const ui_1 = require("../utils/ui");
12
- async function releasesCommand(args) {
13
- const action = args.action || 'list';
14
- switch (action) {
15
- case 'list':
16
- return listCmd(args);
17
- default:
18
- (0, ui_1.error)(`Unknown releases action: ${action}`);
19
- (0, ui_1.info)('Usage: gurulu releases list --site=<id> [--limit=20] [--range=7d|30d]');
20
- process.exit(1);
21
- }
22
- }
23
- async function listCmd(args) {
24
- if (!args.site) {
25
- (0, ui_1.error)('Usage: gurulu releases list --site=<id> [--limit=20]');
26
- process.exit(1);
27
- }
28
- const usp = new URLSearchParams();
29
- usp.set('site', args.site);
30
- if (args.range)
31
- usp.set('range', args.range);
32
- if (args.environment)
33
- usp.set('environment', args.environment);
34
- if (args.limit)
35
- usp.set('limit', String(args.limit));
36
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/releases?${usp.toString()}`, {
37
- profile: args.profile,
38
- });
39
- if (args.format === 'table') {
40
- const rows = body.releases || [];
41
- process.stdout.write(['VERSION', 'SESSIONS', 'CRASH_FREE_%', 'USERS', 'ERRORS'].join('\t') + '\n');
42
- for (const r of rows) {
43
- process.stdout.write([
44
- r.version ?? '-',
45
- r.totalSessions ?? 0,
46
- r.crashFreeSessionRate?.toFixed?.(2) ?? r.crashFreeSessionRate ?? '-',
47
- r.totalUsers ?? 0,
48
- r.errorCount ?? 0,
49
- ].join('\t') + '\n');
50
- }
51
- return;
52
- }
53
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
54
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Sprint E SE-B — `gurulu replay list|get`.
3
- *
4
- * Mirror of MCP `gurulu.replay.list` / `.get`. Hits new `/api/cli/replay/*`
5
- * proxy endpoints with CLI-auth.
6
- */
7
- export interface ReplayArgs {
8
- action?: string;
9
- site?: string;
10
- sessionId?: string;
11
- range?: string;
12
- hasError?: boolean;
13
- limit?: number;
14
- format?: string;
15
- json?: boolean;
16
- profile?: string;
17
- }
18
- export declare function replayCommand(args: ReplayArgs): Promise<void>;
@@ -1,64 +0,0 @@
1
- "use strict";
2
- /**
3
- * Sprint E SE-B — `gurulu replay list|get`.
4
- *
5
- * Mirror of MCP `gurulu.replay.list` / `.get`. Hits new `/api/cli/replay/*`
6
- * proxy endpoints with CLI-auth.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.replayCommand = replayCommand;
10
- const api_client_1 = require("../api-client");
11
- const ui_1 = require("../utils/ui");
12
- async function replayCommand(args) {
13
- const action = args.action || 'list';
14
- switch (action) {
15
- case 'list':
16
- return listCmd(args);
17
- case 'get':
18
- return getCmd(args);
19
- default:
20
- (0, ui_1.error)(`Unknown replay action: ${action}`);
21
- (0, ui_1.info)('Usage: gurulu replay [list|get] --site=<id> [--session-id=<id>]');
22
- process.exit(1);
23
- }
24
- }
25
- async function listCmd(args) {
26
- if (!args.site) {
27
- (0, ui_1.error)('Usage: gurulu replay list --site=<id> [--range=7d|30d] [--limit=20]');
28
- process.exit(1);
29
- }
30
- const usp = new URLSearchParams();
31
- usp.set('site', args.site);
32
- if (args.range)
33
- usp.set('range', args.range);
34
- if (args.hasError !== undefined)
35
- usp.set('hasError', String(args.hasError));
36
- if (args.limit)
37
- usp.set('limit', String(args.limit));
38
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/replay?${usp.toString()}`, {
39
- profile: args.profile,
40
- });
41
- if (args.format === 'table') {
42
- const rows = body.sessions || [];
43
- process.stdout.write(['SESSION', 'STARTED', 'DURATION', 'ERRORS', 'SEGMENTS'].join('\t') + '\n');
44
- for (const s of rows) {
45
- process.stdout.write([
46
- s.sessionId ?? s.id ?? '-',
47
- String(s.startedAt ?? '-'),
48
- String(s.duration ?? 0),
49
- s.hasError ? 'yes' : 'no',
50
- String(s.segments ?? 0),
51
- ].join('\t') + '\n');
52
- }
53
- return;
54
- }
55
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
56
- }
57
- async function getCmd(args) {
58
- if (!args.site || !args.sessionId) {
59
- (0, ui_1.error)('Usage: gurulu replay get --site=<id> --session-id=<id>');
60
- process.exit(1);
61
- }
62
- const body = await (0, api_client_1.cliApiJson)(`/api/cli/replay/${encodeURIComponent(args.sessionId)}?site=${encodeURIComponent(args.site)}`, { profile: args.profile });
63
- process.stdout.write(JSON.stringify(body, null, 2) + '\n');
64
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * CLI@0.4.4 — `gurulu secrets` — list & rotate keys in the tenant credential vault.
3
- *
4
- * Subcommands:
5
- * gurulu secrets list (key names only — never values)
6
- * gurulu secrets rotate --key API_TOKEN (issues new value, keeps old in 24h grace window)
7
- *
8
- * TODO(Sprint K): backend endpoints below are not yet live. The CLI command
9
- * surface is implemented now so customers can wire automation.
10
- * - GET /api/cli/secrets/list -> { secrets: [{ key, lastRotatedAt, rotationStatus }] }
11
- * - POST /api/cli/secrets/rotate { key } -> { key, newRevealedOnce: string, graceUntil: ISO }
12
- */
13
- export interface SecretsArgs {
14
- action?: string;
15
- key?: string;
16
- json?: boolean;
17
- profile?: string;
18
- }
19
- export declare function secretsCommand(args: SecretsArgs): Promise<void>;
@@ -1,145 +0,0 @@
1
- "use strict";
2
- /**
3
- * CLI@0.4.4 — `gurulu secrets` — list & rotate keys in the tenant credential vault.
4
- *
5
- * Subcommands:
6
- * gurulu secrets list (key names only — never values)
7
- * gurulu secrets rotate --key API_TOKEN (issues new value, keeps old in 24h grace window)
8
- *
9
- * TODO(Sprint K): backend endpoints below are not yet live. The CLI command
10
- * surface is implemented now so customers can wire automation.
11
- * - GET /api/cli/secrets/list -> { secrets: [{ key, lastRotatedAt, rotationStatus }] }
12
- * - POST /api/cli/secrets/rotate { key } -> { key, newRevealedOnce: string, graceUntil: ISO }
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.secretsCommand = secretsCommand;
16
- const config_1 = require("../config");
17
- const api_client_1 = require("../api-client");
18
- const ui_1 = require("../utils/ui");
19
- const redact_1 = require("../utils/redact");
20
- async function secretsCommand(args) {
21
- // Defensive — never echo args wholesale in any future debug path.
22
- if (process.env.GURULU_DEBUG === '1') {
23
- console.log(`[debug] secrets args: ${JSON.stringify((0, redact_1.redactSensitiveArgs)({ ...args }))}`);
24
- }
25
- switch (args.action) {
26
- case 'list':
27
- return secretsList(args);
28
- case 'rotate':
29
- return secretsRotate(args);
30
- default:
31
- (0, ui_1.error)(`Unknown action: ${args.action}. Use: list, rotate`);
32
- process.exit(1);
33
- }
34
- }
35
- async function loadProfileOrExit(args) {
36
- try {
37
- return await (0, config_1.loadActiveProfile)({ profile: args.profile });
38
- }
39
- catch {
40
- (0, ui_1.error)('Not authenticated. Run "gurulu login" first.');
41
- process.exit(1);
42
- }
43
- }
44
- function emitFallbackNotice(json) {
45
- if (json)
46
- return;
47
- (0, ui_1.info)((0, ui_1.dim)('Note: backend endpoint not yet live (Sprint K candidate). Command-shape is stable.'));
48
- }
49
- // ── list ───────────────────────────────────────────────────────────────────
50
- async function secretsList(args) {
51
- const profile = await loadProfileOrExit(args);
52
- try {
53
- const res = await (0, api_client_1.cliApi)('/api/cli/secrets/list', { preloadedProfile: profile });
54
- const data = await res.json().catch(() => ({}));
55
- if (res.status === 404) {
56
- emitFallbackNotice(args.json);
57
- if (args.json)
58
- console.log(JSON.stringify({ ok: false, pending: true, secrets: [] }));
59
- else
60
- (0, ui_1.info)('Pending: would list tenant secrets (key names only).');
61
- return;
62
- }
63
- if (!res.ok) {
64
- const msg = data.message || data.error || `HTTP ${res.status}`;
65
- if (args.json)
66
- console.log(JSON.stringify({ ok: false, error: msg }));
67
- else
68
- (0, ui_1.error)(msg);
69
- process.exit(1);
70
- }
71
- if (args.json) {
72
- console.log(JSON.stringify(data, null, 2));
73
- return;
74
- }
75
- const secrets = data.secrets || [];
76
- if (secrets.length === 0) {
77
- (0, ui_1.info)('No secrets in this tenant vault.');
78
- return;
79
- }
80
- console.log((0, ui_1.bold)('Secrets (values are never exposed):'));
81
- for (const s of secrets) {
82
- const rotated = s.lastRotatedAt ? (0, ui_1.dim)(` rotated ${s.lastRotatedAt}`) : '';
83
- const status = s.rotationStatus ? (0, ui_1.dim)(` [${s.rotationStatus}]`) : '';
84
- (0, ui_1.step)(`${s.key}${rotated}${status}`);
85
- }
86
- }
87
- catch (err) {
88
- if (args.json)
89
- console.log(JSON.stringify({ ok: false, error: err.message }));
90
- else
91
- (0, ui_1.error)(`Failed: ${err.message}`);
92
- process.exit(1);
93
- }
94
- }
95
- // ── rotate ─────────────────────────────────────────────────────────────────
96
- async function secretsRotate(args) {
97
- if (!args.key) {
98
- (0, ui_1.error)('Usage: gurulu secrets rotate --key <KEY_NAME>');
99
- process.exit(1);
100
- }
101
- const profile = await loadProfileOrExit(args);
102
- try {
103
- const res = await (0, api_client_1.cliApi)('/api/cli/secrets/rotate', {
104
- method: 'POST',
105
- body: JSON.stringify({ key: args.key }),
106
- preloadedProfile: profile,
107
- });
108
- const data = await res.json().catch(() => ({}));
109
- if (res.status === 404) {
110
- emitFallbackNotice(args.json);
111
- if (args.json)
112
- console.log(JSON.stringify({ ok: false, pending: true, key: args.key }));
113
- else
114
- (0, ui_1.info)(`Pending: would rotate ${args.key} (24h grace window).`);
115
- return;
116
- }
117
- if (!res.ok) {
118
- const msg = data.message || data.error || `HTTP ${res.status}`;
119
- if (args.json)
120
- console.log(JSON.stringify({ ok: false, error: msg }));
121
- else
122
- (0, ui_1.error)(msg);
123
- process.exit(1);
124
- }
125
- if (args.json) {
126
- console.log(JSON.stringify(data, null, 2));
127
- return;
128
- }
129
- (0, ui_1.success)(`Rotated ${args.key}`);
130
- if (data.newRevealedOnce) {
131
- (0, ui_1.warn)('New value (shown ONCE — store it now, you cannot retrieve it again):');
132
- console.log(` ${(0, ui_1.bold)(data.newRevealedOnce)}`);
133
- }
134
- if (data.graceUntil) {
135
- (0, ui_1.info)(`Old value remains valid until: ${data.graceUntil}`);
136
- }
137
- }
138
- catch (err) {
139
- if (args.json)
140
- console.log(JSON.stringify({ ok: false, error: err.message }));
141
- else
142
- (0, ui_1.error)(`Failed: ${err.message}`);
143
- process.exit(1);
144
- }
145
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * 2026-05-05 DF-5 — `gurulu setup --vertical saas` zero-friction lifecycle.
3
- *
4
- * Tek komutta:
5
- * - vertical event taxonomy'sini define et (idempotent)
6
- * - default funnel'ları kur
7
- * - acquisition + revenue + retention event'lerine goal bağla
8
- *
9
- * 23 ayrı komut yerine 1.
10
- */
11
- export interface SetupArgs {
12
- vertical?: string;
13
- site?: string;
14
- includeFunnels?: boolean;
15
- includeGoals?: boolean;
16
- dryRun?: boolean;
17
- json?: boolean;
18
- yes?: boolean;
19
- profile?: string;
20
- }
21
- export declare function setupCommand(args: SetupArgs): Promise<void>;